1 | MODULE 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 daymod ! calendar |
---|
16 | USE in_out_manager ! I/O manager |
---|
17 | USE lib_mpp ! distributed memory computing |
---|
18 | |
---|
19 | USE domcfg ! domain configuration (dom_cfg routine) |
---|
20 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
21 | USE domain ! domain initialization (dom_init routine) |
---|
22 | USE obc_par ! open boundary cond. parameters |
---|
23 | USE obcini ! open boundary cond. initialization (obc_ini routine) |
---|
24 | USE solver ! solver initialization (solver_init routine) |
---|
25 | USE istate ! initial state setting (istate_init routine) |
---|
26 | USE eosbn2 ! equation of state (eos bn2 routine) |
---|
27 | USE zpshde ! partial step: hor. derivative (zps_hde routine) |
---|
28 | |
---|
29 | ! ocean physics |
---|
30 | USE traqsr ! solar radiation penetration (tra_qsr_init routine) |
---|
31 | USE ldfdyn ! lateral viscosity setting (ldfdyn_init routine) |
---|
32 | USE ldftra ! lateral diffusivity setting (ldftra_init routine) |
---|
33 | USE zdfini |
---|
34 | !!!USE zdf_oce ! ocean vertical physics (zdf_init routine) |
---|
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 trddyn ! ocean momentum trends (trd_dyn_init routine) |
---|
41 | USE trdtra ! ocean active tracer trends (trd_tra_init routine) |
---|
42 | USE trdmld ! ocean active tracer mixed layer trend ??? |
---|
43 | USE trdvor ! vorticity budget |
---|
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 , LODYC-IPSL (2003) |
---|
57 | !!---------------------------------------------------------------------- |
---|
58 | |
---|
59 | CONTAINS |
---|
60 | |
---|
61 | SUBROUTINE opa_model |
---|
62 | !!---------------------------------------------------------------------- |
---|
63 | !! *** ROUTINE opa *** |
---|
64 | !! |
---|
65 | !! ** Purpose : opa solves the primitive equations on an orthogonal |
---|
66 | !! curvilinear mesh on the sphere. |
---|
67 | !! |
---|
68 | !! ** Method : - model general initialization |
---|
69 | !! - launch the time-stepping (stp routine) |
---|
70 | !! |
---|
71 | !! References : |
---|
72 | !! Madec, Delecluse,Imbard, and Levy, 1997: reference manual. |
---|
73 | !! internal report, IPSL. |
---|
74 | !! |
---|
75 | !! History : |
---|
76 | !! 4.0 ! 90-10 (C. Levy, G. Madec) Original code |
---|
77 | !! 7.0 ! 91-11 (M. Imbard, C. Levy, G. Madec) |
---|
78 | !! 7.1 ! 93-03 (M. Imbard, C. Levy, G. Madec, O. Marti, |
---|
79 | !! M. Guyon, A. Lazar, P. Delecluse, C. Perigaud, |
---|
80 | !! G. Caniaux, B. Colot, C. Maes ) release 7.1 |
---|
81 | !! ! 92-06 (L.Terray) coupling implementation |
---|
82 | !! ! 93-11 (M.A. Filiberti) IGLOO sea-ice |
---|
83 | !! 8.0 ! 96-03 (M. Imbard, C. Levy, G. Madec, O. Marti, |
---|
84 | !! M. Guyon, A. Lazar, P. Delecluse, L.Terray, |
---|
85 | !! M.A. Filiberti, J. Vialar, A.M. Treguier, |
---|
86 | !! M. Levy) release 8.0 |
---|
87 | !! 8.1 ! 97-06 (M. Imbard, G. Madec) |
---|
88 | !! 8.2 ! 99-11 (M. Imbard, H. Goosse) LIM sea-ice model |
---|
89 | !! ! 99-12 (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols) OPEN-MP |
---|
90 | !! ! 00-07 (J-M Molines, M. Imbard) Open Boundary Conditions (CLIPPER) |
---|
91 | !! 9.0 ! 02-08 (G. Madec) F90: Free form and modules |
---|
92 | !!---------------------------------------------------------------------- |
---|
93 | !! * Local declarations |
---|
94 | INTEGER :: istp ! time step index |
---|
95 | #if defined key_coupled |
---|
96 | INTEGER :: itro, istp0 ! ??? |
---|
97 | #endif |
---|
98 | CHARACTER (len=64) :: & |
---|
99 | cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
100 | !!---------------------------------------------------------------------- |
---|
101 | |
---|
102 | |
---|
103 | ! Initializations |
---|
104 | ! =============== |
---|
105 | |
---|
106 | ! open listing and namelist units |
---|
107 | IF ( numout /= 0 .AND. numout /= 6 ) THEN |
---|
108 | OPEN( UNIT=numout, FILE='ocean.output', FORM='FORMATTED' ) |
---|
109 | ENDIF |
---|
110 | IF( lk_mpp ) OPEN( UNIT=nummpp, FILE='mpp.output', FORM='FORMATTED' ) |
---|
111 | |
---|
112 | |
---|
113 | ! Nodes selection |
---|
114 | narea = mynode() |
---|
115 | narea = narea + 1 ! mynode return the rank of proc (0 --> jpnij -1 ) |
---|
116 | lwp = narea == 1 |
---|
117 | |
---|
118 | OPEN( UNIT=numnam, FILE='namelist', FORM='FORMATTED', STATUS='OLD' ) |
---|
119 | |
---|
120 | IF(lwp) THEN |
---|
121 | WRITE(numout,*) |
---|
122 | WRITE(numout,*) ' L O D Y C - I P S L' |
---|
123 | WRITE(numout,*) ' O P A model' |
---|
124 | WRITE(numout,*) ' Ocean General Circulation Model' |
---|
125 | WRITE(numout,*) ' version OPA 9.0 (2003)' |
---|
126 | WRITE(numout,*) |
---|
127 | ENDIF |
---|
128 | |
---|
129 | ! ! ============================== ! |
---|
130 | ! ! Model general initialization ! |
---|
131 | ! ! ============================== ! |
---|
132 | |
---|
133 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
134 | |
---|
135 | ! Domain decomposition |
---|
136 | IF( jpni*jpnj == jpnij ) THEN |
---|
137 | CALL mpp_init ! standard cutting out |
---|
138 | ELSE |
---|
139 | CALL mpp_init2 ! eliminate land processors |
---|
140 | ENDIF |
---|
141 | |
---|
142 | CALL phy_cst ! Physical constants |
---|
143 | |
---|
144 | CALL dom_cfg ! Domain configuration |
---|
145 | |
---|
146 | CALL dom_init ! Domain |
---|
147 | |
---|
148 | IF( lk_obc ) CALL obc_init ! Open boundaries |
---|
149 | |
---|
150 | CALL solver_init ! Elliptic solver |
---|
151 | |
---|
152 | CALL day( nit000 ) ! Calendar |
---|
153 | |
---|
154 | CALL istate_init ! ocean initial state (Dynamics and tracers) |
---|
155 | !!add |
---|
156 | CALL eos( tb, sb, rhd, rhop ) ! before potential and in situ densities |
---|
157 | |
---|
158 | CALL bn2( tb, sb, rn2 ) ! before Brunt-Vaisala frequency |
---|
159 | |
---|
160 | IF( lk_zps ) CALL zps_hde( nit000, tb, sb, rhd, & ! Partial steps: before Horizontal DErivative |
---|
161 | gtu, gsu, gru, & ! of t, s, rd at the bottom ocean level |
---|
162 | gtv, gsv, grv ) |
---|
163 | |
---|
164 | !!add |
---|
165 | |
---|
166 | CALL oc_fz_pt ! Surface freezing point |
---|
167 | |
---|
168 | #if defined key_ice_lim |
---|
169 | CALL ice_init ! Sea ice model |
---|
170 | #endif |
---|
171 | |
---|
172 | #if defined key_passivetrc |
---|
173 | CALL initrc ! Passive tracers |
---|
174 | #endif |
---|
175 | |
---|
176 | ! ! Ocean scheme |
---|
177 | |
---|
178 | CALL opa_flg ! Choice of algorithms |
---|
179 | |
---|
180 | ! ! Ocean physics |
---|
181 | |
---|
182 | CALL tra_qsr_init ! Solar radiation penetration |
---|
183 | |
---|
184 | CALL ldf_dyn_init ! Lateral ocean momentum physics |
---|
185 | |
---|
186 | CALL ldf_tra_init ! Lateral ocean tracer physics |
---|
187 | |
---|
188 | CALL zdf_init ! Vertical ocean physics |
---|
189 | |
---|
190 | ! ! Ocean trends |
---|
191 | IF( lk_trddyn .OR. lk_trdvor) CALL trd_dyn_init ! momentum |
---|
192 | IF( lk_trdtra .OR. lk_trdmld ) & |
---|
193 | & CALL trd_tra_init ! active tracers |
---|
194 | #if defined key_coupled |
---|
195 | itro = nitend - nit000 + 1 ! Coupled |
---|
196 | istp0 = NINT( rdt ) |
---|
197 | CALL cpl_init( itro, nexco, istp0 ) ! Signal processing and process id exchange |
---|
198 | #endif |
---|
199 | |
---|
200 | CALL flx_fwb_init ! FreshWater Budget correction |
---|
201 | |
---|
202 | IF( ln_diaptr ) CALL dia_ptr_init ! Poleward TRansports initialization |
---|
203 | |
---|
204 | ! ! =============== ! |
---|
205 | ! ! time stepping ! |
---|
206 | ! ! =============== ! |
---|
207 | |
---|
208 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
209 | |
---|
210 | istp = nit000 |
---|
211 | DO WHILE ( istp <= nitend .AND. nstop == 0 ) |
---|
212 | CALL stp( istp ) |
---|
213 | istp = istp + 1 |
---|
214 | END DO |
---|
215 | ! ! ========= ! |
---|
216 | ! ! Job end ! |
---|
217 | ! ! ========= ! |
---|
218 | |
---|
219 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
220 | |
---|
221 | IF( nstop /= 0 ) THEN ! error print |
---|
222 | IF(lwp) WRITE(numout,cform_err) |
---|
223 | IF(lwp) WRITE(numout,*) nstop, ' error have been found' |
---|
224 | ENDIF |
---|
225 | |
---|
226 | IF( lk_mpp ) CALL mppstop ! Close all files (mpp) |
---|
227 | |
---|
228 | END SUBROUTINE opa_model |
---|
229 | |
---|
230 | |
---|
231 | SUBROUTINE opa_flg |
---|
232 | !!---------------------------------------------------------------------- |
---|
233 | !! *** ROUTINE opa *** |
---|
234 | !! |
---|
235 | !! ** Purpose : Initialize logical flags that control the choice of |
---|
236 | !! some algorithm or control print |
---|
237 | !! |
---|
238 | !! ** Method : Read in namilist namflg logical flags |
---|
239 | !! |
---|
240 | !! History : |
---|
241 | !! 9.0 ! 03-11 (G. Madec) Original code |
---|
242 | !!---------------------------------------------------------------------- |
---|
243 | !! * Local declarations |
---|
244 | |
---|
245 | NAMELIST/namflg/ ln_dynhpg_imp |
---|
246 | !!---------------------------------------------------------------------- |
---|
247 | |
---|
248 | ! Read Namelist namflg : algorithm FLaG |
---|
249 | ! -------------------- |
---|
250 | REWIND ( numnam ) |
---|
251 | READ ( numnam, namflg ) |
---|
252 | |
---|
253 | ! Parameter control and print |
---|
254 | ! --------------------------- |
---|
255 | ! Control print |
---|
256 | IF(lwp) THEN |
---|
257 | WRITE(numout,*) |
---|
258 | WRITE(numout,*) 'opa_flg : algorithm flag initialization' |
---|
259 | WRITE(numout,*) '~~~~~~~' |
---|
260 | WRITE(numout,*) ' Namelist namflg : set algorithm flags' |
---|
261 | WRITE(numout,*) |
---|
262 | WRITE(numout,*) ' centered (F) or semi-implicit (T) ln_dynhpg_imp = ', ln_dynhpg_imp |
---|
263 | WRITE(numout,*) ' hydrostatic pressure gradient' |
---|
264 | ENDIF |
---|
265 | |
---|
266 | END SUBROUTINE opa_flg |
---|
267 | |
---|
268 | !!====================================================================== |
---|
269 | END MODULE opa |
---|