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

Last change on this file since 359 was 359, checked in by opalod, 18 years ago

nemo_v1_update_033 : RB + CT : Add new surface pressure gradient algorithms

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