New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
opa.F90 in trunk/NEMO/OPA_SRC – NEMO

source: trunk/NEMO/OPA_SRC/opa.F90 @ 268

Last change on this file since 268 was 268, checked in by opalod, 19 years ago

nemo_v1_update_05:RB+OA: Update and rewritting of part of the TOP component

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.4 KB
Line 
1MODULE opa
2   !!==============================================================================
3   !!                       ***  MODULE opa   ***
4   !! Ocean system   : OPA ocean dynamics (including on-line tracers and sea-ice)
5   !!==============================================================================
6
7   !!----------------------------------------------------------------------
8   !!   opa_model      : solve ocean dynamics, tracer and/or sea-ice
9   !!   opa_flg        : initialisation of algorithm flag
10   !!----------------------------------------------------------------------
11   !! * Modules used
12   USE cpl_oce         ! ocean-atmosphere-sea ice coupled exchanges
13   USE dom_oce         ! ocean space domain variables
14   USE oce             ! dynamics and tracers variables
15   USE trdmod_oce      ! ocean variables trends
16   USE daymod          ! calendar
17   USE in_out_manager  ! I/O manager
18   USE lib_mpp         ! distributed memory computing
19
20   USE domcfg          ! domain configuration               (dom_cfg routine)
21   USE mppini          ! shared/distributed memory setting (mpp_init routine)
22   USE domain          ! domain initialization             (dom_init routine)
23   USE obc_par         ! open boundary cond. parameters
24   USE obcini          ! open boundary cond. initialization (obc_ini routine)
25   USE solver          ! solver initialization          (solver_init routine)
26   USE istate          ! initial state setting          (istate_init routine)
27   USE eosbn2          ! equation of state            (eos bn2 routine)
28   USE zpshde          ! partial step: hor. derivative (zps_hde routine)
29
30   ! ocean physics
31   USE traqsr          ! solar radiation penetration   (tra_qsr_init routine)
32   USE ldfdyn          ! lateral viscosity setting      (ldfdyn_init routine)
33   USE ldftra          ! lateral diffusivity setting    (ldftra_init routine)
34   USE zdfini
35
36   USE phycst          ! physical constant                  (par_cst routine)
37   USE iceini          ! initialization of sea-ice         (ice_init routine)
38   USE cpl             ! coupled ocean/atmos.              (cpl_init routine)
39   USE ocfzpt          ! ocean freezing point              (oc_fz_pt routine)
40   USE trdicp          ! momentum/tracers trends       (trd_icp_init routine)
41   USE trdvor          ! vorticity trends              (trd_vor_init routine)
42   USE trdmld          ! tracer mixed layer trends     (trd_mld_init routine)
43   USE flxfwb          !
44
45   USE diaptr          ! poleward transports           (dia_ptr_init routine)
46
47   USE step            ! OPA time-stepping                  (stp     routine)
48   USE prtctl          ! Print control                 (prt_ctl_init routine)
49   USE ini1d           ! re-initialization of u-v mask for the 1D configuration
50   USE dyncor1d        ! Coriolis factor at T-point
51   USE step1d          ! Time stepping loop for the 1D configuration
52
53   USE initrc          ! Initialization of the passive tracers
54
55   IMPLICIT NONE
56   PRIVATE
57
58   !! * Routine accessibility
59   PUBLIC opa_model      ! called by model.F90
60   !!----------------------------------------------------------------------
61   !!  OPA 9.0 , LOCEAN-IPSL (2005)
62   !! $Header$
63   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
64   !!----------------------------------------------------------------------
65
66CONTAINS
67
68   SUBROUTINE opa_model
69      !!----------------------------------------------------------------------
70      !!                     ***  ROUTINE opa  ***
71      !!
72      !! ** Purpose :   opa solves the primitive equations on an orthogonal
73      !!      curvilinear mesh on the sphere.
74      !!
75      !! ** Method  : - model general initialization
76      !!              - launch the time-stepping (stp routine)
77      !!
78      !! References :
79      !!      Madec, Delecluse,Imbard, and Levy, 1997: reference manual.
80      !!              internal report, IPSL.
81      !!
82      !! History :
83      !!   4.0  !  90-10  (C. Levy, G. Madec)  Original code
84      !!   7.0  !  91-11  (M. Imbard, C. Levy, G. Madec)
85      !!   7.1  !  93-03  (M. Imbard, C. Levy, G. Madec, O. Marti,
86      !!                   M. Guyon, A. Lazar, P. Delecluse, C. Perigaud,
87      !!                   G. Caniaux, B. Colot, C. Maes ) release 7.1
88      !!        !  92-06  (L.Terray) coupling implementation
89      !!        !  93-11  (M.A. Filiberti) IGLOO sea-ice
90      !!   8.0  !  96-03  (M. Imbard, C. Levy, G. Madec, O. Marti,
91      !!                   M. Guyon, A. Lazar, P. Delecluse, L.Terray,
92      !!                   M.A. Filiberti, J. Vialar, A.M. Treguier,
93      !!                   M. Levy)  release 8.0
94      !!   8.1  !  97-06  (M. Imbard, G. Madec)
95      !!   8.2  !  99-11  (M. Imbard, H. Goosse)  LIM sea-ice model
96      !!        !  99-12  (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols)  OPEN-MP
97      !!        !  00-07  (J-M Molines, M. Imbard)  Open Boundary Conditions  (CLIPPER)
98      !!   9.0  !  02-08  (G. Madec)  F90: Free form and modules
99      !!    "   !  04-08  (C. Talandier) New trends organization
100      !!    "   !  05-06  (C. Ethe) Add the 1D configuration possibility
101      !!----------------------------------------------------------------------
102      !! * Local declarations
103      INTEGER ::   istp       ! time step index
104#if defined key_coupled
105      INTEGER ::   itro, istp0        ! ???
106#endif
107      CHARACTER (len=64) ::        &
108         cform_aaa="( /, 'AAAAAAAA', / ) "     ! flag for output listing
109      CHARACTER (len=28) :: file_out
110      !!----------------------------------------------------------------------
111     
112     
113      ! Initializations
114      ! ===============
115
116      file_out = 'ocean.output'
117     
118      ! open listing and namelist units
119      IF ( numout /= 0 .AND. numout /= 6 ) THEN
120         OPEN( UNIT=numout, FILE=TRIM(file_out), FORM='FORMATTED' )
121      ENDIF
122
123      OPEN( UNIT=numnam, FILE='namelist', FORM='FORMATTED', STATUS='OLD' )
124
125
126      ! Nodes selection
127      narea = mynode()
128      narea = narea + 1    ! mynode return the rank of proc (0 --> jpnij -1 )
129      lwp   = narea == 1
130
131      IF(lwp) THEN
132         WRITE(numout,*)
133         WRITE(numout,*) '                 L O D Y C - I P S L'
134         WRITE(numout,*) '                     O P A model'
135         WRITE(numout,*) '            Ocean General Circulation Model'
136         WRITE(numout,*) '               version OPA 9.0  (2005) '
137         WRITE(numout,*)
138         WRITE(numout,*) '                   PROC number: ', narea
139         WRITE(numout,*)
140      ENDIF
141
142      !                                     ! ============================== !
143      !                                     !  Model general initialization  !
144      !                                     ! ============================== !
145
146      IF(lwp) WRITE(numout,cform_aaa)       ! Flag AAAAAAA
147
148                                            ! Domain decomposition
149      IF( jpni*jpnj == jpnij ) THEN
150         CALL mpp_init                          ! standard cutting out
151      ELSE
152         CALL mpp_init2                         ! eliminate land processors
153      ENDIF
154     
155      CALL phy_cst                          ! Physical constants
156
157      CALL dom_cfg                          ! Domain configuration
158     
159      CALL dom_init                         ! Domain
160
161      IF( ln_ctl )      CALL prt_ctl_init   ! Print control
162
163      IF( lk_cfg_1d )   CALL fcorio_1d      ! redefine Coriolis at T-point
164
165      IF( lk_obc    )   CALL obc_init       ! Open boundaries
166
167      CALL solver_init                      ! Elliptic solver
168
169      CALL day( nit000 )                    ! Calendar
170
171      CALL istate_init                      ! ocean initial state (Dynamics and tracers)
172!!add
173                       CALL eos( tb, sb, rhd, rhop )        ! before potential and in situ densities
174
175                       CALL bn2( tb, sb, rn2 )              ! before Brunt-Vaisala frequency
176
177      IF( lk_zps .AND. .NOT. lk_cfg_1d )   &
178         &             CALL zps_hde( nit000, tb, sb, rhd,  &  ! Partial steps: before Horizontal DErivative
179                                            gtu, gsu, gru, &  ! of t, s, rd at the bottom ocean level
180                                            gtv, gsv, grv )
181
182!!add
183
184      CALL oc_fz_pt                         ! Surface freezing point
185
186#if defined key_ice_lim
187      CALL ice_init                         ! Sea ice model
188#endif
189
190#if defined key_passivetrc
191      CALL ini_trc                           ! Passive tracers
192#endif
193
194      !                                     ! Ocean scheme
195
196      CALL opa_flg                              ! Choice of algorithms
197
198      !                                     ! Ocean physics
199
200      CALL tra_qsr_init                         ! Solar radiation penetration
201
202      CALL ldf_dyn_init                         ! Lateral ocean momentum physics
203
204      CALL ldf_tra_init                         ! Lateral ocean tracer physics
205
206      CALL zdf_init                             ! Vertical ocean physics
207
208      !                                     ! Ocean trends
209      ! Control parameters
210      IF( lk_trdtra .OR. lk_trdmld )   l_trdtra = .TRUE.
211      IF( lk_trddyn .OR. lk_trdvor )   l_trddyn = .TRUE.
212
213      IF( lk_trddyn .OR. lk_trdtra )   &
214         &            CALL trd_icp_init         ! active tracers and/or momentum
215
216      IF( lk_trdmld ) CALL trd_mld_init         ! mixed layer
217
218      IF( lk_trdvor ) CALL trd_vor_init         ! vorticity
219
220#if defined key_coupled
221      itro  = nitend - nit000 + 1           ! Coupled
222      istp0 = NINT( rdt )
223      CALL cpl_init( itro, nexco, istp0 )   ! Signal processing and process id exchange
224#endif
225
226      CALL flx_fwb_init                     ! FreshWater Budget correction
227
228      CALL dia_ptr_init                     ! Poleward TRansports initialization
229
230      !                                     ! =============== !
231      !                                     !  time stepping  !
232      !                                     ! =============== !
233
234      IF(lwp) WRITE(numout,cform_aaa)       ! Flag AAAAAAA
235
236      IF( lk_cfg_1d  )  THEN
237         CALL init_1d
238         istp = nit000
239         DO WHILE ( istp <= nitend .AND. nstop == 0 )
240            CALL stp_1d( istp )
241            istp = istp + 1
242         END DO
243      ELSE
244         istp = nit000
245         DO WHILE ( istp <= nitend .AND. nstop == 0 )
246            CALL stp( istp )
247            istp = istp + 1
248         END DO
249      ENDIF
250      !                                     ! ========= !
251      !                                     !  Job end  !
252      !                                     ! ========= !
253
254      IF(lwp) WRITE(numout,cform_aaa)       ! Flag AAAAAAA
255
256      IF( nstop /= 0 ) THEN                 ! error print
257      IF(lwp) WRITE(numout,cform_err)
258      IF(lwp) WRITE(numout,*) nstop, ' error have been found' 
259      ENDIF
260
261      CALL opa_closefile
262      IF( lk_mpp )   CALL mppstop                          ! Close all files (mpp)
263
264   END SUBROUTINE opa_model
265
266
267   SUBROUTINE opa_flg
268      !!----------------------------------------------------------------------
269      !!                     ***  ROUTINE opa  ***
270      !!
271      !! ** Purpose :   Initialize logical flags that control the choice of
272      !!      some algorithm or control print
273      !!
274      !! ** Method  :    Read in namilist namflg logical flags
275      !!
276      !! History :
277      !!   9.0  !  03-11  (G. Madec)  Original code
278      !!----------------------------------------------------------------------
279      !! * Local declarations
280
281      NAMELIST/namflg/ ln_dynhpg_imp
282      !!----------------------------------------------------------------------
283
284      ! Read Namelist namflg : algorithm FLaG
285      ! --------------------
286      REWIND ( numnam )
287      READ   ( numnam, namflg )
288
289      ! Parameter control and print
290      ! ---------------------------
291      ! Control print
292      IF(lwp) THEN
293         WRITE(numout,*)
294         WRITE(numout,*) 'opa_flg : algorithm flag initialization'
295         WRITE(numout,*) '~~~~~~~'
296         WRITE(numout,*) '          Namelist namflg : set algorithm flags'
297         WRITE(numout,*)
298         WRITE(numout,*) '             centered (F) or semi-implicit (T)   ln_dynhpg_imp = ', ln_dynhpg_imp
299         WRITE(numout,*) '             hydrostatic pressure gradient'
300      ENDIF
301
302   END SUBROUTINE opa_flg
303
304   SUBROUTINE opa_closefile
305      !!----------------------------------------------------------------------
306      !!                     ***  ROUTINE opa_closefile  ***
307      !!
308      !! ** Purpose :   Close the files
309      !!           
310      !! ** Method  :
311      !!
312      !! History :
313      !!   9.0  !  05-01  (O. Le Galloudec)  Original code
314      !!----------------------------------------------------------------------
315      !! * Modules used
316      USE dtatem        ! temperature data
317      USE dtasal        ! salinity data
318      USE dtasst        ! sea surface temperature data
319      !!----------------------------------------------------------------------
320
321      IF ( lk_mpp ) CALL mppsync
322
323      ! 1. Unit close
324      ! -------------
325
326      CLOSE( numnam )       ! namelist
327      CLOSE( numout )       ! standard model output file
328      CLOSE( numstp )       ! time-step file
329      CLOSE( numwrs )       ! ocean restart file
330
331      IF( lk_dtatem )   CLOSE( numtdt )
332      IF( lk_dtasal )   CLOSE( numsdt )
333      IF( lk_dtasst )   CLOSE( numsst )
334
335      IF(lwp) CLOSE( numsol )
336
337      IF( lk_cpl ) THEN
338         CLOSE( numlhf )
339         CLOSE( numlts )
340      ENDIF
341
342      CLOSE( numwri )
343
344   END SUBROUTINE opa_closefile
345
346   !!======================================================================
347END MODULE opa
Note: See TracBrowser for help on using the repository browser.