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 @ 258

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

nemo_v1_update_004 : CT : Integration of the control print option for debugging work

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