1 | MODULE nemogcm |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE nemogcm *** |
---|
4 | !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats |
---|
5 | !!====================================================================== |
---|
6 | !! History : 3.6 ! 2011-11 (S. Alderson, G. Madec) original code |
---|
7 | !! - ! 2013-06 (I. Epicoco, S. Mocavero, CMCC) nemo_northcomms: setup avoiding MPI communication |
---|
8 | !! - ! 2014-12 (G. Madec) remove KPP scheme and cross-land advection (cla) |
---|
9 | !! 4.0 ! 2016-10 (G. Madec, S. Flavoni) domain configuration / user defined interface |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !! nemo_gcm : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice |
---|
14 | !! nemo_init : initialization of the NEMO system |
---|
15 | !! nemo_ctl : initialisation of the contol print |
---|
16 | !! nemo_closefile: close remaining open files |
---|
17 | !! nemo_alloc : dynamical allocation |
---|
18 | !!---------------------------------------------------------------------- |
---|
19 | USE step_oce ! module used in the ocean time stepping module |
---|
20 | USE sbc_oce ! surface boundary condition: ocean |
---|
21 | USE phycst ! physical constant (par_cst routine) |
---|
22 | USE domain ! domain initialization (dom_init & dom_cfg routines) |
---|
23 | USE closea ! treatment of closed seas (for ln_closea) |
---|
24 | USE usrdef_nam ! user defined configuration |
---|
25 | USE daymod ! calendar |
---|
26 | USE restart ! open restart file |
---|
27 | USE step ! NEMO time-stepping (stp routine) |
---|
28 | USE cpl_oasis3 ! |
---|
29 | USE sbcssm ! |
---|
30 | USE icbini ! handle bergs, initialisation |
---|
31 | USE icbstp ! handle bergs, calving, themodynamics and transport |
---|
32 | USE bdyini ! open boundary cond. setting (bdy_init routine). mandatory for sea-ice |
---|
33 | USE bdydta ! open boundary cond. setting (bdy_dta_init routine). mandatory for sea-ice |
---|
34 | USE diu_layers ! diurnal bulk SST and coolskin |
---|
35 | USE step_diu ! diurnal bulk SST timestepping (called from here if run offline) |
---|
36 | ! |
---|
37 | USE prtctl ! Print control |
---|
38 | USE in_out_manager ! I/O manager |
---|
39 | USE lib_mpp ! distributed memory computing |
---|
40 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
41 | USE lbcnfd , ONLY : isendto, nsndto ! Setup of north fold exchanges |
---|
42 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
43 | #if defined key_iomput |
---|
44 | USE xios ! xIOserver |
---|
45 | #endif |
---|
46 | #if defined key_agrif && defined key_si3 |
---|
47 | USE agrif_ice_update ! ice update |
---|
48 | #endif |
---|
49 | USE halo_mng |
---|
50 | |
---|
51 | IMPLICIT NONE |
---|
52 | PRIVATE |
---|
53 | |
---|
54 | PUBLIC nemo_gcm ! called by model.F90 |
---|
55 | PUBLIC nemo_init ! needed by AGRIF |
---|
56 | |
---|
57 | CHARACTER(lc) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
58 | |
---|
59 | #if defined key_mpp_mpi |
---|
60 | INCLUDE 'mpif.h' |
---|
61 | #endif |
---|
62 | |
---|
63 | !!---------------------------------------------------------------------- |
---|
64 | !! NEMO/SAS 4.0 , NEMO Consortium (2018) |
---|
65 | !! $Id$ |
---|
66 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
67 | !!---------------------------------------------------------------------- |
---|
68 | CONTAINS |
---|
69 | |
---|
70 | SUBROUTINE nemo_gcm |
---|
71 | !!---------------------------------------------------------------------- |
---|
72 | !! *** ROUTINE nemo_gcm *** |
---|
73 | !! |
---|
74 | !! ** Purpose : NEMO 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 | !! - finalize the run by closing files and communications |
---|
80 | !! |
---|
81 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
82 | !! Madec, 2008, internal report, IPSL. |
---|
83 | !!---------------------------------------------------------------------- |
---|
84 | INTEGER :: istp ! time step index |
---|
85 | !!---------------------------------------------------------------------- |
---|
86 | ! |
---|
87 | #if defined key_agrif |
---|
88 | CALL Agrif_Init_Grids() ! AGRIF: set the meshes |
---|
89 | #endif |
---|
90 | ! !-----------------------! |
---|
91 | CALL nemo_init !== Initialisations ==! |
---|
92 | ! !-----------------------! |
---|
93 | #if defined key_agrif |
---|
94 | Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs ! agrif_oce module copies of time level indices |
---|
95 | CALL Agrif_Declare_Var ! " " " " " DYN/TRA |
---|
96 | # if defined key_top |
---|
97 | CALL Agrif_Declare_Var_top ! " " " " " TOP |
---|
98 | # endif |
---|
99 | #endif |
---|
100 | ! check that all process are still there... If some process have an error, |
---|
101 | ! they will never enter in step and other processes will wait until the end of the cpu time! |
---|
102 | CALL mpp_max( 'nemogcm', nstop ) |
---|
103 | |
---|
104 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
105 | |
---|
106 | ! !-----------------------! |
---|
107 | ! !== time stepping ==! |
---|
108 | ! !-----------------------! |
---|
109 | istp = nit000 |
---|
110 | ! |
---|
111 | #if defined key_agrif |
---|
112 | ! !== AGRIF time-stepping ==! |
---|
113 | CALL Agrif_Regrid() |
---|
114 | ! |
---|
115 | #if defined key_si3 |
---|
116 | ! Recursive update from highest nested level to lowest: |
---|
117 | Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs ! agrif_oce module copies of time level indices |
---|
118 | CALL Agrif_step_child_adj(Agrif_update_ice) |
---|
119 | #endif |
---|
120 | ! |
---|
121 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
122 | CALL stp |
---|
123 | istp = istp + 1 |
---|
124 | END DO |
---|
125 | ! |
---|
126 | #else |
---|
127 | ! |
---|
128 | IF( .NOT.ln_diurnal_only ) THEN !== Standard time-stepping ==! |
---|
129 | ! |
---|
130 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
131 | #if defined key_mpp_mpi |
---|
132 | ncom_stp = istp |
---|
133 | IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() |
---|
134 | IF ( istp == nitend ) elapsed_time = MPI_Wtime() - elapsed_time |
---|
135 | #endif |
---|
136 | CALL stp ( istp ) |
---|
137 | istp = istp + 1 |
---|
138 | END DO |
---|
139 | ! |
---|
140 | ELSE !== diurnal SST time-steeping only ==! |
---|
141 | ! |
---|
142 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
143 | CALL stp_diurnal( istp ) ! time step only the diurnal SST |
---|
144 | istp = istp + 1 |
---|
145 | END DO |
---|
146 | ! |
---|
147 | ENDIF |
---|
148 | ! |
---|
149 | #endif |
---|
150 | ! |
---|
151 | IF( ln_icebergs ) CALL icb_end( nitend ) |
---|
152 | |
---|
153 | ! !------------------------! |
---|
154 | ! !== finalize the run ==! |
---|
155 | ! !------------------------! |
---|
156 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
157 | ! |
---|
158 | IF( nstop /= 0 .AND. lwp ) THEN ! error print |
---|
159 | WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' |
---|
160 | IF( ngrdstop > 0 ) THEN |
---|
161 | WRITE(ctmp9,'(i2)') ngrdstop |
---|
162 | WRITE(ctmp2,*) ' E R R O R detected in Agrif grid '//TRIM(ctmp9) |
---|
163 | WRITE(ctmp3,*) ' Look for "E R R O R" messages in all existing '//TRIM(ctmp9)//'_ocean_output* files' |
---|
164 | CALL ctl_stop( ' ', ctmp1, ' ', ctmp2, ' ', ctmp3 ) |
---|
165 | ELSE |
---|
166 | WRITE(ctmp2,*) ' Look for "E R R O R" messages in all existing ocean_output* files' |
---|
167 | CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 ) |
---|
168 | ENDIF |
---|
169 | ENDIF |
---|
170 | ! |
---|
171 | IF( ln_timing ) CALL timing_finalize |
---|
172 | ! |
---|
173 | CALL nemo_closefile |
---|
174 | ! |
---|
175 | #if defined key_iomput |
---|
176 | CALL xios_finalize ! end mpp communications with xios |
---|
177 | IF( lk_oasis ) CALL cpl_finalize ! end coupling and mpp communications with OASIS |
---|
178 | #else |
---|
179 | IF ( lk_oasis ) THEN ; CALL cpl_finalize ! end coupling and mpp communications with OASIS |
---|
180 | ELSEIF( lk_mpp ) THEN ; CALL mppstop ! end mpp communications |
---|
181 | ENDIF |
---|
182 | #endif |
---|
183 | ! |
---|
184 | IF(lwm) THEN |
---|
185 | IF( nstop == 0 ) THEN ; STOP 0 |
---|
186 | ELSE ; STOP 123 |
---|
187 | ENDIF |
---|
188 | ENDIF |
---|
189 | ! |
---|
190 | END SUBROUTINE nemo_gcm |
---|
191 | |
---|
192 | |
---|
193 | SUBROUTINE nemo_init |
---|
194 | !!---------------------------------------------------------------------- |
---|
195 | !! *** ROUTINE nemo_init *** |
---|
196 | !! |
---|
197 | !! ** Purpose : initialization of the NEMO GCM |
---|
198 | !!---------------------------------------------------------------------- |
---|
199 | INTEGER :: ios, ilocal_comm ! local integers |
---|
200 | !! |
---|
201 | NAMELIST/namctl/ sn_cfctl, ln_timing, ln_diacfl, & |
---|
202 | & nn_isplt, nn_jsplt, nn_ictls, nn_ictle, nn_jctls, nn_jctle |
---|
203 | NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr |
---|
204 | !!---------------------------------------------------------------------- |
---|
205 | ! |
---|
206 | IF( lk_oasis ) THEN ; cxios_context = 'sas' |
---|
207 | ELSE ; cxios_context = 'nemo' |
---|
208 | ENDIF |
---|
209 | nn_hls = 1 |
---|
210 | ! |
---|
211 | ! !-------------------------------------------------! |
---|
212 | ! ! set communicator & select the local rank ! |
---|
213 | ! ! must be done as soon as possible to get narea ! |
---|
214 | ! !-------------------------------------------------! |
---|
215 | ! |
---|
216 | #if defined key_iomput |
---|
217 | IF( Agrif_Root() ) THEN |
---|
218 | IF( lk_oasis ) THEN |
---|
219 | CALL cpl_init( "sas", ilocal_comm ) ! nemo local communicator given by oasis |
---|
220 | CALL xios_initialize( "not used",local_comm=ilocal_comm ) ! send nemo communicator to xios |
---|
221 | ELSE |
---|
222 | CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm ) ! nemo local communicator given by xios |
---|
223 | ENDIF |
---|
224 | ENDIF |
---|
225 | CALL mpp_start( ilocal_comm ) |
---|
226 | #else |
---|
227 | IF( lk_oasis ) THEN |
---|
228 | IF( Agrif_Root() ) THEN |
---|
229 | CALL cpl_init( "sas", ilocal_comm ) ! nemo local communicator given by oasis |
---|
230 | ENDIF |
---|
231 | CALL mpp_start( ilocal_comm ) |
---|
232 | ELSE |
---|
233 | CALL mpp_start( ) |
---|
234 | ENDIF |
---|
235 | #endif |
---|
236 | ! |
---|
237 | narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) |
---|
238 | lwm = (narea == 1) ! control of output namelists |
---|
239 | ! |
---|
240 | ! !---------------------------------------------------------------! |
---|
241 | ! ! Open output files, reference and configuration namelist files ! |
---|
242 | ! !---------------------------------------------------------------! |
---|
243 | ! |
---|
244 | ! open ocean.output as soon as possible to get all output prints (including errors messages) |
---|
245 | IF( lk_oasis ) THEN |
---|
246 | IF( lwm ) CALL ctl_opn( numout, 'sas.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
247 | ! open reference and configuration namelist files |
---|
248 | CALL load_nml( numnam_ref, 'namelist_sas_ref', -1, lwm ) |
---|
249 | CALL load_nml( numnam_cfg, 'namelist_sas_cfg', -1, lwm ) |
---|
250 | IF( lwm ) CALL ctl_opn( numond, 'output.namelist_sas.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
251 | ELSE |
---|
252 | IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
253 | ! open reference and configuration namelist files |
---|
254 | CALL load_nml( numnam_ref, 'namelist_ref', -1, lwm ) |
---|
255 | CALL load_nml( numnam_cfg, 'namelist_cfg', -1, lwm ) |
---|
256 | IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
257 | ENDIF |
---|
258 | ! open /dev/null file to be able to supress output write easily |
---|
259 | IF( Agrif_Root() ) THEN |
---|
260 | CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
261 | #ifdef key_agrif |
---|
262 | ELSE |
---|
263 | numnul = Agrif_Parent(numnul) |
---|
264 | #endif |
---|
265 | ENDIF |
---|
266 | ! |
---|
267 | ! !--------------------! |
---|
268 | ! ! Open listing units ! -> need sn_cfctl from namctl to define lwp |
---|
269 | ! !--------------------! |
---|
270 | ! |
---|
271 | READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) |
---|
272 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) |
---|
273 | READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) |
---|
274 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) |
---|
275 | ! |
---|
276 | ! finalize the definition of namctl variables |
---|
277 | IF( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax .OR. MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) & |
---|
278 | & CALL nemo_set_cfctl( sn_cfctl, .FALSE. ) |
---|
279 | ! |
---|
280 | lwp = (narea == 1) .OR. sn_cfctl%l_oceout ! control of all listing output print |
---|
281 | ! |
---|
282 | IF(lwp) THEN ! open listing units |
---|
283 | ! |
---|
284 | IF( .NOT. lwm ) THEN ! alreay opened for narea == 1 |
---|
285 | IF(lk_oasis) THEN ; CALL ctl_opn( numout, 'sas.output','REPLACE','FORMATTED','SEQUENTIAL',-1,-1, .FALSE., narea ) |
---|
286 | ELSE ; CALL ctl_opn( numout, 'ocean.output','REPLACE','FORMATTED','SEQUENTIAL',-1,-1, .FALSE., narea ) |
---|
287 | ENDIF |
---|
288 | ENDIF |
---|
289 | ! |
---|
290 | WRITE(numout,*) |
---|
291 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' |
---|
292 | WRITE(numout,*) ' NEMO team' |
---|
293 | WRITE(numout,*) ' Ocean General Circulation Model' |
---|
294 | WRITE(numout,*) ' NEMO version 4.0 (2019) ' |
---|
295 | WRITE(numout,*) ' StandAlone Surface version (SAS) ' |
---|
296 | WRITE(numout,*) " ._ ._ ._ ._ ._ " |
---|
297 | WRITE(numout,*) " _.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._)`\_ " |
---|
298 | WRITE(numout,*) |
---|
299 | WRITE(numout,*) " o _, _, " |
---|
300 | WRITE(numout,*) " o .' ( .-' / " |
---|
301 | WRITE(numout,*) " o _/..._'. .' / " |
---|
302 | WRITE(numout,*) " ( o .-'` ` '-./ _.' " |
---|
303 | WRITE(numout,*) " ) ( o) ;= <_ ( " |
---|
304 | WRITE(numout,*) " ( '-.,\\__ __.-;`\ '. ) " |
---|
305 | WRITE(numout,*) " ) ) \) |`\ \) '. \ ( ( " |
---|
306 | WRITE(numout,*) " ( ( \_/ '-._\ ) ) " |
---|
307 | WRITE(numout,*) " ) ) jgs ` ( ( " |
---|
308 | WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
---|
309 | WRITE(numout,*) |
---|
310 | WRITE(numout,*) |
---|
311 | ! |
---|
312 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
313 | ! |
---|
314 | ENDIF |
---|
315 | ! |
---|
316 | IF(lwm) WRITE( numond, namctl ) |
---|
317 | ! |
---|
318 | ! !------------------------------------! |
---|
319 | ! ! Set global domain size parameters ! |
---|
320 | ! !------------------------------------! |
---|
321 | ! |
---|
322 | READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) |
---|
323 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) |
---|
324 | READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) |
---|
325 | 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) |
---|
326 | ! |
---|
327 | IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file |
---|
328 | CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) |
---|
329 | ELSE ! user-defined namelist |
---|
330 | CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) |
---|
331 | ENDIF |
---|
332 | ! |
---|
333 | IF(lwm) WRITE( numond, namcfg ) |
---|
334 | ! |
---|
335 | ! !-----------------------------------------! |
---|
336 | ! ! mpp parameters and domain decomposition ! |
---|
337 | ! !-----------------------------------------! |
---|
338 | CALL mpp_init |
---|
339 | |
---|
340 | CALL halo_mng_init() |
---|
341 | ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays |
---|
342 | CALL nemo_alloc() |
---|
343 | |
---|
344 | ! Initialise time level indices |
---|
345 | Nbb = 1; Nnn = 2; Naa = 3; Nrhs = Naa |
---|
346 | #if defined key_agrif |
---|
347 | Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs ! agrif_oce module copies of time level indices |
---|
348 | #endif |
---|
349 | |
---|
350 | ! !-------------------------------! |
---|
351 | ! ! NEMO general initialization ! |
---|
352 | ! !-------------------------------! |
---|
353 | |
---|
354 | CALL nemo_ctl ! Control prints |
---|
355 | ! |
---|
356 | ! ! General initialization |
---|
357 | IF( ln_timing ) CALL timing_init ( 'timing_sas.output' ) |
---|
358 | IF( ln_timing ) CALL timing_start( 'nemo_init') |
---|
359 | |
---|
360 | CALL phy_cst ! Physical constants |
---|
361 | CALL eos_init ! Equation of seawater |
---|
362 | #if defined key_agrif |
---|
363 | CALL Agrif_Declare_Var_ini ! " " " " " DOM |
---|
364 | #endif |
---|
365 | CALL dom_init( Nbb, Nnn, Naa, 'SAS') ! Domain |
---|
366 | IF( sn_cfctl%l_prtctl ) & |
---|
367 | & CALL prt_ctl_init ! Print control |
---|
368 | |
---|
369 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
370 | IF( ln_rstart ) CALL rst_read_open |
---|
371 | |
---|
372 | ! ! external forcing |
---|
373 | CALL sbc_init( Nbb, Nnn, Naa ) ! Forcings : surface module |
---|
374 | |
---|
375 | ! ==> clem: open boundaries init. is mandatory for sea-ice because ice BDY is not decoupled from |
---|
376 | ! the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules. |
---|
377 | ! This is not clean and should be changed in the future. |
---|
378 | CALL bdy_init |
---|
379 | ! ==> |
---|
380 | CALL icb_init( rn_Dt, nit000) ! initialise icebergs instance |
---|
381 | ! |
---|
382 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
383 | ! |
---|
384 | IF( ln_timing ) CALL timing_stop( 'nemo_init') |
---|
385 | ! |
---|
386 | END SUBROUTINE nemo_init |
---|
387 | |
---|
388 | |
---|
389 | SUBROUTINE nemo_ctl |
---|
390 | !!---------------------------------------------------------------------- |
---|
391 | !! *** ROUTINE nemo_ctl *** |
---|
392 | !! |
---|
393 | !! ** Purpose : control print setting |
---|
394 | !! |
---|
395 | !! ** Method : - print namctl and namcfg information and check some consistencies |
---|
396 | !!---------------------------------------------------------------------- |
---|
397 | ! |
---|
398 | IF(lwp) THEN ! control print |
---|
399 | WRITE(numout,*) |
---|
400 | WRITE(numout,*) 'nemo_ctl: Control prints' |
---|
401 | WRITE(numout,*) '~~~~~~~~' |
---|
402 | WRITE(numout,*) ' Namelist namctl' |
---|
403 | WRITE(numout,*) ' sn_cfctl%l_runstat = ', sn_cfctl%l_runstat |
---|
404 | WRITE(numout,*) ' sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat |
---|
405 | WRITE(numout,*) ' sn_cfctl%l_oceout = ', sn_cfctl%l_oceout |
---|
406 | WRITE(numout,*) ' sn_cfctl%l_layout = ', sn_cfctl%l_layout |
---|
407 | WRITE(numout,*) ' sn_cfctl%l_prtctl = ', sn_cfctl%l_prtctl |
---|
408 | WRITE(numout,*) ' sn_cfctl%l_prttrc = ', sn_cfctl%l_prttrc |
---|
409 | WRITE(numout,*) ' sn_cfctl%l_oasout = ', sn_cfctl%l_oasout |
---|
410 | WRITE(numout,*) ' sn_cfctl%procmin = ', sn_cfctl%procmin |
---|
411 | WRITE(numout,*) ' sn_cfctl%procmax = ', sn_cfctl%procmax |
---|
412 | WRITE(numout,*) ' sn_cfctl%procincr = ', sn_cfctl%procincr |
---|
413 | WRITE(numout,*) ' sn_cfctl%ptimincr = ', sn_cfctl%ptimincr |
---|
414 | WRITE(numout,*) ' timing by routine ln_timing = ', ln_timing |
---|
415 | WRITE(numout,*) ' CFL diagnostics ln_diacfl = ', ln_diacfl |
---|
416 | ENDIF |
---|
417 | ! |
---|
418 | IF( .NOT.ln_read_cfg ) ln_closea = .FALSE. ! dealing possible only with a domcfg file |
---|
419 | IF(lwp) THEN ! control print |
---|
420 | WRITE(numout,*) |
---|
421 | WRITE(numout,*) ' Namelist namcfg' |
---|
422 | WRITE(numout,*) ' read domain configuration file ln_read_cfg = ', ln_read_cfg |
---|
423 | WRITE(numout,*) ' filename to be read cn_domcfg = ', TRIM(cn_domcfg) |
---|
424 | WRITE(numout,*) ' keep closed seas in the domain (if exist) ln_closea = ', ln_closea |
---|
425 | WRITE(numout,*) ' create a configuration definition file ln_write_cfg = ', ln_write_cfg |
---|
426 | WRITE(numout,*) ' filename to be written cn_domcfg_out = ', TRIM(cn_domcfg_out) |
---|
427 | WRITE(numout,*) ' use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr |
---|
428 | ENDIF |
---|
429 | ! |
---|
430 | IF( 1._wp /= SIGN(1._wp,-0._wp) ) CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.', & |
---|
431 | & 'Compile with key_nosignedzero enabled:', & |
---|
432 | & '--> add -Dkey_nosignedzero to the definition of %CPP in your arch file' ) |
---|
433 | ! |
---|
434 | #if defined key_agrif |
---|
435 | IF( ln_timing ) CALL ctl_stop( 'AGRIF not implemented with ln_timing = true') |
---|
436 | #endif |
---|
437 | ! |
---|
438 | END SUBROUTINE nemo_ctl |
---|
439 | |
---|
440 | |
---|
441 | SUBROUTINE nemo_closefile |
---|
442 | !!---------------------------------------------------------------------- |
---|
443 | !! *** ROUTINE nemo_closefile *** |
---|
444 | !! |
---|
445 | !! ** Purpose : Close the files |
---|
446 | !!---------------------------------------------------------------------- |
---|
447 | ! |
---|
448 | IF( lk_mpp ) CALL mppsync |
---|
449 | ! |
---|
450 | CALL iom_close ! close all input/output files managed by iom_* |
---|
451 | ! |
---|
452 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
453 | IF( numrun /= -1 ) CLOSE( numrun ) ! run statistics file |
---|
454 | IF( lwm.AND.numond /= -1 ) CLOSE( numond ) ! oce output namelist |
---|
455 | IF( lwm.AND.numoni /= -1 ) CLOSE( numoni ) ! ice output namelist |
---|
456 | IF( numevo_ice /= -1 ) CLOSE( numevo_ice ) ! ice variables (temp. evolution) |
---|
457 | IF( numout /= 6 ) CLOSE( numout ) ! standard model output file |
---|
458 | ! |
---|
459 | numout = 6 ! redefine numout in case it is used after this point... |
---|
460 | ! |
---|
461 | END SUBROUTINE nemo_closefile |
---|
462 | |
---|
463 | |
---|
464 | SUBROUTINE nemo_alloc |
---|
465 | !!---------------------------------------------------------------------- |
---|
466 | !! *** ROUTINE nemo_alloc *** |
---|
467 | !! |
---|
468 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
469 | !! |
---|
470 | !! ** Method : |
---|
471 | !!---------------------------------------------------------------------- |
---|
472 | USE diawri , ONLY : dia_wri_alloc |
---|
473 | USE dom_oce , ONLY : dom_oce_alloc |
---|
474 | USE bdy_oce , ONLY : ln_bdy, bdy_oce_alloc |
---|
475 | USE oce ! mandatory for sea-ice because needed for bdy arrays |
---|
476 | ! |
---|
477 | INTEGER :: ierr |
---|
478 | !!---------------------------------------------------------------------- |
---|
479 | ! |
---|
480 | ierr = dia_wri_alloc() |
---|
481 | ierr = ierr + dom_oce_alloc() ! ocean domain |
---|
482 | ierr = ierr + oce_alloc () ! (ts...) needed for agrif and/or SI3 and bdy |
---|
483 | ierr = ierr + bdy_oce_alloc() ! bdy masks (incl. initialization) |
---|
484 | ! |
---|
485 | CALL mpp_sum( 'nemogcm', ierr ) |
---|
486 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) |
---|
487 | ! |
---|
488 | END SUBROUTINE nemo_alloc |
---|
489 | |
---|
490 | SUBROUTINE nemo_set_cfctl(sn_cfctl, setto ) |
---|
491 | !!---------------------------------------------------------------------- |
---|
492 | !! *** ROUTINE nemo_set_cfctl *** |
---|
493 | !! |
---|
494 | !! ** Purpose : Set elements of the output control structure to setto. |
---|
495 | !! |
---|
496 | !! ** Method : Note this routine can be used to switch on/off some |
---|
497 | !! types of output for selected areas. |
---|
498 | !!---------------------------------------------------------------------- |
---|
499 | TYPE(sn_ctl), INTENT(inout) :: sn_cfctl |
---|
500 | LOGICAL , INTENT(in ) :: setto |
---|
501 | !!---------------------------------------------------------------------- |
---|
502 | sn_cfctl%l_runstat = setto |
---|
503 | sn_cfctl%l_trcstat = setto |
---|
504 | sn_cfctl%l_oceout = setto |
---|
505 | sn_cfctl%l_layout = setto |
---|
506 | sn_cfctl%l_prtctl = setto |
---|
507 | sn_cfctl%l_prttrc = setto |
---|
508 | sn_cfctl%l_oasout = setto |
---|
509 | END SUBROUTINE nemo_set_cfctl |
---|
510 | |
---|
511 | !!====================================================================== |
---|
512 | END MODULE nemogcm |
---|
513 | |
---|