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/OFF_SRC – NEMO

source: trunk/NEMO/OFF_SRC/opa.F90 @ 1101

Last change on this file since 1101 was 1101, checked in by cetlod, 16 years ago

update opa.F90 main routine for OFFLINE option, see ticket:207

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.6 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   !!----------------------------------------------------------------------
10   !! * Modules used
11   USE dom_oce         ! ocean space domain variables
12   USE oce             ! dynamics and tracers variables
13   USE daymod          ! calendar
14   USE in_out_manager  ! I/O manager
15   USE lib_mpp         ! distributed memory computing
16
17   USE domcfg          ! domain configuration               (dom_cfg routine)
18   USE mppini          ! shared/distributed memory setting (mpp_init routine)
19   USE domain          ! domain initialization             (dom_init routine)
20   USE istate          ! initial state setting          (istate_init routine)
21   USE eosbn2          ! equation of state            (eos bn2 routine)
22   USE zpshde          ! partial step: hor. derivative (zps_hde routine)
23
24   ! ocean physics
25   USE ldftra          ! lateral diffusivity setting    (ldftra_init routine)
26   USE zdfini
27   USE traqsr          ! solar radiation penetration   (tra_qsr_init routine)
28
29   USE phycst          ! physical constant                  (par_cst routine)
30   USE dtadyn          ! Lecture and Interpolation of the dynamical fields
31   USE trcini          ! Initilization of the passive tracers
32   USE step            ! OPA time-stepping                  (stp     routine)
33
34   IMPLICIT NONE
35   PRIVATE
36
37   !! * Routine accessibility
38   PUBLIC opa_model      ! called by model.F90
39   !!----------------------------------------------------------------------
40   !!   OPA 9.0 , LOCEAN-IPSL  (2005)
41   !!   $Header$
42   !!   This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
43   !!----------------------------------------------------------------------
44
45CONTAINS
46
47   SUBROUTINE opa_model
48      !!----------------------------------------------------------------------
49      !!                     ***  ROUTINE opa  ***
50      !!
51      !! ** Purpose :   opa solves the primitive equations on an orthogonal
52      !!      curvilinear mesh on the sphere.
53      !!
54      !! ** Method  : - model general initialization
55      !!              - launch the time-stepping (stp routine)
56      !!
57      !! References :
58      !!      Madec, Delecluse,Imbard, and Levy, 1997: reference manual.
59      !!              internal report, IPSL.
60      !!
61      !! History :
62      !!   4.0  !  90-10  (C. Levy, G. Madec)  Original code
63      !!   7.0  !  91-11  (M. Imbard, C. Levy, G. Madec)
64      !!   7.1  !  93-03  (M. Imbard, C. Levy, G. Madec, O. Marti,
65      !!                   M. Guyon, A. Lazar, P. Delecluse, C. Perigaud,
66      !!                   G. Caniaux, B. Colot, C. Maes ) release 7.1
67      !!        !  92-06  (L.Terray) coupling implementation
68      !!        !  93-11  (M.A. Filiberti) IGLOO sea-ice
69      !!   8.0  !  96-03  (M. Imbard, C. Levy, G. Madec, O. Marti,
70      !!                   M. Guyon, A. Lazar, P. Delecluse, L.Terray,
71      !!                   M.A. Filiberti, J. Vialar, A.M. Treguier,
72      !!                   M. Levy)  release 8.0
73      !!   8.1  !  97-06  (M. Imbard, G. Madec)
74      !!   8.2  !  99-11  (M. Imbard, H. Goosse)  LIM sea-ice model
75      !!        !  99-12  (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols)  OPEN-MP
76      !!        !  00-07  (J-M Molines, M. Imbard)  Open Boundary Conditions  (CLIPPER)
77      !!   9.0  !  02-08  (G. Madec)  F90: Free form and modules
78      !!----------------------------------------------------------------------
79      !! * Local declarations
80      INTEGER ::   istp       ! time step index
81      CHARACTER (len=20) ::   namelistname
82      CHARACTER (len=28) ::   file_out
83      CHARACTER (len=64) ::        &
84         cform_aaa="( /, 'AAAAAAAA', / ) "     ! flag for output listing
85
86      !!----------------------------------------------------------------------
87
88      ! Initializations
89      ! ===============
90
91      file_out = 'ocean.output'
92
93      ! open listing and namelist units
94      CALL ctlopn( numout, file_out, 'UNKNOWN', 'FORMATTED',   &
95         &         'SEQUENTIAL', 1, 6, .FALSE., 1 )
96
97      namelistname = 'namelist'
98      CALL ctlopn( numnam, namelistname, 'OLD', 'FORMATTED', 'SEQUENTIAL',   &
99         &         1, numout, .FALSE., 1 )
100
101      WRITE(numout,*)
102      WRITE(numout,*) '                 L O D Y C - I P S L'
103      WRITE(numout,*) '                     O P A model'
104      WRITE(numout,*) '            Ocean General Circulation Model'
105      WRITE(numout,*) '               version OPA 9.0  (2005) '
106      WRITE(numout,*)
107      WRITE(numout,*)
108
109      ! Nodes selection
110      narea = mynode()
111      narea = narea + 1    ! mynode return the rank of proc (0 --> jpnij -1 )
112      lwp   = narea == 1
113
114      ! open additionnal listing
115      IF( ln_ctl )   THEN
116         IF( narea-1 > 0 )   THEN
117            WRITE(file_out,FMT="('ocean.output_',I4.4)") narea-1
118            CALL ctlopn( numout, file_out, 'UNKNOWN', 'FORMATTED',   &
119               &         'SEQUENTIAL', 1, numout, .FALSE., 1 )
120            lwp = .TRUE.
121            !
122            WRITE(numout,*)
123            WRITE(numout,*) '                 L O D Y C - I P S L'
124            WRITE(numout,*) '                     O P A model'
125            WRITE(numout,*) '            Ocean General Circulation Model'
126            WRITE(numout,*) '               version OPA 9.0  (2005) '
127            WRITE(numout,*) '                   MPI Ocean output '
128            WRITE(numout,*)
129            WRITE(numout,*)
130         ENDIF
131      ENDIF
132
133
134      !                                     ! ============================== !
135      !                                     !  Model general initialization  !
136      !                                     ! ============================== !
137
138      IF(lwp) WRITE(numout,cform_aaa)       ! Flag AAAAAAA
139
140                                            ! Domain decomposition
141      IF( jpni*jpnj == jpnij ) THEN
142         CALL mpp_init                          ! standard cutting out
143      ELSE
144         CALL mpp_init2                         ! eliminate land processors
145      ENDIF
146     
147      CALL phy_cst                          ! Physical constants
148
149      CALL dom_cfg                          ! Domain configuration
150     
151      CALL dom_init                         ! Domain
152
153      CALL day( nit000 )                    ! Calendar
154
155      CALL istate_init                      ! ocean initial state (Dynamics and tracers)
156!!add
157                       CALL eos( tn, sn, rhd, rhop )        ! before potential and in situ densities
158
159                       CALL bn2( tn, sn, rn2 )              ! before Brunt-Vaisala frequency
160
161      IF( ln_zps    )   CALL zps_hde( nit000, tn, sn, rhd,  &  ! Partial steps: before Horizontal DErivative
162                                          gtu, gsu, gru, &  ! of t, s, rd at the bottom ocean level
163                                          gtv, gsv, grv )
164
165!!add
166
167      ! Initialization for the dynamics
168      !
169      CALL dta_dyn(nit000)     
170
171#if defined key_top
172      CALL trc_ini                           ! Passive tracers
173#endif
174
175      !                                     ! Ocean physics
176      CALL tra_qsr_init                         ! Solar radiation penetration
177
178#if ! defined key_off_degrad
179      CALL ldf_tra_init                         ! Lateral ocean tracer physics
180#endif
181
182      CALL zdf_init                             ! Vertical ocean physics
183
184      !                                     ! Ocean trends
185
186      !                                     ! =============== !
187      !                                     !  time stepping  !
188      !                                     ! =============== !
189
190      IF(lwp) WRITE(numout,cform_aaa)       ! Flag AAAAAAA
191
192      istp = nit000
193      DO WHILE ( istp <= nitend .AND. nstop == 0 )
194         CALL stp( istp )
195         istp = istp + 1
196      END DO
197      !                                     ! ========= !
198      !                                     !  Job end  !
199      !                                     ! ========= !
200
201      IF(lwp) WRITE(numout,cform_aaa)       ! Flag AAAAAAA
202
203      IF( nstop /= 0 ) THEN                 ! error print
204      IF(lwp) WRITE(numout,cform_err)
205      IF(lwp) WRITE(numout,*) nstop, ' error have been found' 
206      ENDIF
207
208      IF( lk_mpp )   CALL mppstop                          ! Close all files (mpp)
209
210   END SUBROUTINE opa_model
211
212   !!======================================================================
213END MODULE opa
Note: See TracBrowser for help on using the repository browser.