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

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

CL : Add CVS Header and CeCILL licence information

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