[2574] | 1 | MODULE nemogcm |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE nemogcm *** |
---|
| 4 | !! Off-line Ocean : passive tracer evolution, dynamics read in files |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 3.3 ! 2010-05 (C. Ethe) Full reorganization of the off-line: phasing with the on-line |
---|
[7646] | 7 | !! 3.4 ! 2011-01 (C. Ethe, A. R. Porter, STFC Daresbury) dynamical allocation |
---|
| 8 | !! 4.0 ! 2016-10 (C. Ethe, G. Madec, S. Flavoni) domain configuration / user defined interface |
---|
[12377] | 9 | !! 4.1 ! 2019-08 (A. Coward, D. Storkey) rewrite in preparation for new timestepping scheme |
---|
[2574] | 10 | !!---------------------------------------------------------------------- |
---|
| 11 | |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
[9213] | 13 | !! nemo_gcm : off-line: solve ocean tracer only |
---|
| 14 | !! nemo_gcm : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice |
---|
| 15 | !! nemo_init : initialization of the NEMO system |
---|
| 16 | !! nemo_ctl : initialisation of the contol print |
---|
| 17 | !! nemo_closefile: close remaining open files |
---|
| 18 | !! nemo_alloc : dynamical allocation |
---|
| 19 | !! istate_init : simple initialization to zero of ocean fields |
---|
| 20 | !! stp_ctl : reduced step control (no dynamics in off-line) |
---|
[2574] | 21 | !!---------------------------------------------------------------------- |
---|
[9213] | 22 | USE dom_oce ! ocean space domain variables |
---|
| 23 | USE oce ! dynamics and tracers variables |
---|
| 24 | USE trc_oce ! Shared ocean/passive tracers variables |
---|
| 25 | USE c1d ! 1D configuration |
---|
| 26 | USE domain ! domain initialization from coordinate & bathymetry (dom_init routine) |
---|
| 27 | USE closea ! treatment of closed seas (for ln_closea) |
---|
| 28 | USE usrdef_nam ! user defined configuration |
---|
| 29 | USE eosbn2 ! equation of state (eos bn2 routine) |
---|
[13237] | 30 | #if defined key_qco |
---|
| 31 | USE domqco ! tools for scale factor (dom_qco_r3c routine) |
---|
| 32 | #endif |
---|
[13286] | 33 | USE bdyini ! open boundary cond. setting (bdy_init routine) |
---|
[2574] | 34 | ! ! ocean physics |
---|
[9213] | 35 | USE ldftra ! lateral diffusivity setting (ldf_tra_init routine) |
---|
| 36 | USE ldfslp ! slopes of neutral surfaces (ldf_slp_init routine) |
---|
[9751] | 37 | USE traqsr ! solar radiation penetration (tra_qsr_init routine) |
---|
[9213] | 38 | USE trabbl ! bottom boundary layer (tra_bbl_init routine) |
---|
| 39 | USE traldf ! lateral physics (tra_ldf_init routine) |
---|
| 40 | USE sbcmod ! surface boundary condition (sbc_init routine) |
---|
| 41 | USE phycst ! physical constant (par_cst routine) |
---|
| 42 | USE dtadyn ! Lecture and Interpolation of the dynamical fields |
---|
| 43 | USE trcini ! Initilization of the passive tracers |
---|
| 44 | USE daymod ! calendar (day routine) |
---|
| 45 | USE trcstp ! passive tracer time-stepping (trc_stp routine) |
---|
| 46 | USE dtadyn ! Lecture and interpolation of the dynamical fields |
---|
[7646] | 47 | ! ! Passive tracers needs |
---|
[9213] | 48 | USE trc ! passive tracer : variables |
---|
| 49 | USE trcnam ! passive tracer : namelist |
---|
| 50 | USE trcrst ! passive tracer restart |
---|
| 51 | USE diaptr ! Need to initialise this as some variables are used in if statements later |
---|
| 52 | USE sbc_oce , ONLY : ln_rnf |
---|
| 53 | USE sbcrnf ! surface boundary condition : runoffs |
---|
[2574] | 54 | ! ! I/O & MPP |
---|
[9213] | 55 | USE iom ! I/O library |
---|
| 56 | USE in_out_manager ! I/O manager |
---|
| 57 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
| 58 | USE lib_mpp ! distributed memory computing |
---|
[2574] | 59 | #if defined key_iomput |
---|
[9213] | 60 | USE xios ! xIOserver |
---|
[2574] | 61 | #endif |
---|
[9213] | 62 | USE prtctl ! Print control (prt_ctl_init routine) |
---|
| 63 | USE timing ! Timing |
---|
| 64 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
[13286] | 65 | USE lbcnfd , ONLY : isendto, nsndto ! Setup of north fold exchanges |
---|
[12377] | 66 | USE step, ONLY : Nbb, Nnn, Naa, Nrhs ! time level indices |
---|
[13286] | 67 | USE halo_mng |
---|
[2574] | 68 | |
---|
| 69 | IMPLICIT NONE |
---|
| 70 | PRIVATE |
---|
| 71 | |
---|
| 72 | PUBLIC nemo_gcm ! called by nemo.F90 |
---|
| 73 | |
---|
| 74 | CHARACTER (len=64) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
| 75 | |
---|
| 76 | !!---------------------------------------------------------------------- |
---|
[9213] | 77 | !! NEMO/OFF 4.0 , NEMO Consortium (2018) |
---|
[5215] | 78 | !! $Id$ |
---|
[10068] | 79 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[2574] | 80 | !!---------------------------------------------------------------------- |
---|
| 81 | CONTAINS |
---|
| 82 | |
---|
| 83 | SUBROUTINE nemo_gcm |
---|
| 84 | !!---------------------------------------------------------------------- |
---|
| 85 | !! *** ROUTINE nemo_gcm *** |
---|
| 86 | !! |
---|
[9213] | 87 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
| 88 | !! curvilinear mesh on the sphere. |
---|
[2574] | 89 | !! |
---|
| 90 | !! ** Method : - model general initialization |
---|
| 91 | !! - launch the time-stepping (dta_dyn and trc_stp) |
---|
| 92 | !! - finalize the run by closing files and communications |
---|
| 93 | !! |
---|
| 94 | !! References : Madec, Delecluse,Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 95 | !! Madec, 2008, internal report, IPSL. |
---|
| 96 | !!---------------------------------------------------------------------- |
---|
[12933] | 97 | INTEGER :: istp ! time step index |
---|
[2574] | 98 | !!---------------------------------------------------------------------- |
---|
| 99 | |
---|
| 100 | CALL nemo_init ! Initializations |
---|
| 101 | |
---|
| 102 | ! check that all process are still there... If some process have an error, |
---|
| 103 | ! they will never enter in step and other processes will wait until the end of the cpu time! |
---|
[10425] | 104 | CALL mpp_max( 'nemogcm', nstop ) |
---|
[2574] | 105 | |
---|
| 106 | ! !-----------------------! |
---|
| 107 | ! !== time stepping ==! |
---|
| 108 | ! !-----------------------! |
---|
| 109 | istp = nit000 |
---|
[6140] | 110 | ! |
---|
[9213] | 111 | IF( ln_rnf ) CALL sbc_rnf(istp) ! runoffs initialization |
---|
[3827] | 112 | ! |
---|
[9213] | 113 | CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS) |
---|
[3827] | 114 | ! |
---|
[9213] | 115 | DO WHILE ( istp <= nitend .AND. nstop == 0 ) !== OFF time-stepping ==! |
---|
[2574] | 116 | ! |
---|
[7646] | 117 | IF( istp /= nit000 ) CALL day ( istp ) ! Calendar (day was already called at nit000 in day_init) |
---|
[9539] | 118 | CALL iom_setkt ( istp - nit000 + 1, cxios_context ) ! say to iom that we are at time step kstp |
---|
[10222] | 119 | #if defined key_sed_off |
---|
[12377] | 120 | CALL dta_dyn_sed( istp, Nnn ) ! Interpolation of the dynamical fields |
---|
[10222] | 121 | #else |
---|
[12377] | 122 | CALL dta_dyn ( istp, Nbb, Nnn, Naa ) ! Interpolation of the dynamical fields |
---|
[12026] | 123 | #endif |
---|
[13237] | 124 | #if ! defined key_sed_off |
---|
| 125 | IF( .NOT.ln_linssh ) THEN |
---|
| 126 | CALL dta_dyn_atf( istp, Nbb, Nnn, Naa ) ! time filter of sea surface height and vertical scale factors |
---|
| 127 | # if defined key_qco |
---|
| 128 | CALL dom_qco_r3c( ssh(:,:,Kmm), r3t_f, r3u_f, r3v_f ) |
---|
| 129 | # endif |
---|
| 130 | ENDIF |
---|
[12377] | 131 | CALL trc_stp ( istp, Nbb, Nnn, Nrhs, Naa ) ! time-stepping |
---|
[13237] | 132 | # if defined key_qco |
---|
| 133 | !r3t(:,:,Kmm) = r3t_f(:,:) ! update ssh to h0 ratio |
---|
| 134 | !r3u(:,:,Kmm) = r3u_f(:,:) |
---|
| 135 | !r3v(:,:,Kmm) = r3v_f(:,:) |
---|
| 136 | # endif |
---|
[10222] | 137 | #endif |
---|
[12377] | 138 | ! Swap time levels |
---|
| 139 | Nrhs = Nbb |
---|
| 140 | Nbb = Nnn |
---|
| 141 | Nnn = Naa |
---|
| 142 | Naa = Nrhs |
---|
| 143 | ! |
---|
[13237] | 144 | #if ! defined key_qco |
---|
[12377] | 145 | #if ! defined key_sed_off |
---|
| 146 | IF( .NOT.ln_linssh ) CALL dta_dyn_sf_interp( istp, Nnn ) ! calculate now grid parameters |
---|
| 147 | #endif |
---|
[13237] | 148 | #endif |
---|
[12933] | 149 | CALL stp_ctl ( istp ) ! Time loop: control and print |
---|
[2574] | 150 | istp = istp + 1 |
---|
| 151 | END DO |
---|
[9213] | 152 | ! |
---|
[3769] | 153 | #if defined key_iomput |
---|
[5504] | 154 | CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF |
---|
[3769] | 155 | #endif |
---|
[2574] | 156 | |
---|
| 157 | ! !------------------------! |
---|
| 158 | ! !== finalize the run ==! |
---|
| 159 | ! !------------------------! |
---|
| 160 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 161 | |
---|
| 162 | IF( nstop /= 0 .AND. lwp ) THEN ! error print |
---|
[11536] | 163 | WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' |
---|
[13011] | 164 | WRITE(ctmp2,*) ' Look for "E R R O R" messages in all existing ocean_output* files' |
---|
| 165 | CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 ) |
---|
[2574] | 166 | ENDIF |
---|
| 167 | ! |
---|
[9124] | 168 | IF( ln_timing ) CALL timing_finalize |
---|
[3294] | 169 | ! |
---|
[2574] | 170 | CALL nemo_closefile |
---|
| 171 | ! |
---|
[9213] | 172 | #if defined key_iomput |
---|
| 173 | CALL xios_finalize ! end mpp communications with xios |
---|
| 174 | #else |
---|
| 175 | IF( lk_mpp ) CALL mppstop ! end mpp communications |
---|
| 176 | #endif |
---|
[2574] | 177 | ! |
---|
[11536] | 178 | IF(lwm) THEN |
---|
| 179 | IF( nstop == 0 ) THEN ; STOP 0 |
---|
| 180 | ELSE ; STOP 123 |
---|
| 181 | ENDIF |
---|
| 182 | ENDIF |
---|
| 183 | ! |
---|
[2574] | 184 | END SUBROUTINE nemo_gcm |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | SUBROUTINE nemo_init |
---|
| 188 | !!---------------------------------------------------------------------- |
---|
[9213] | 189 | !! *** ROUTINE nemo_init *** |
---|
[2574] | 190 | !! |
---|
| 191 | !! ** Purpose : initialization of the nemo model in off-line mode |
---|
| 192 | !!---------------------------------------------------------------------- |
---|
[11536] | 193 | INTEGER :: ios, ilocal_comm ! local integers |
---|
[2574] | 194 | !! |
---|
[13286] | 195 | NAMELIST/namctl/ sn_cfctl, ln_timing, ln_diacfl, & |
---|
| 196 | & nn_isplt, nn_jsplt, nn_ictls, nn_ictle, nn_jctls, nn_jctle |
---|
[9213] | 197 | NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr |
---|
[2574] | 198 | !!---------------------------------------------------------------------- |
---|
[9213] | 199 | ! |
---|
[5407] | 200 | cxios_context = 'nemo' |
---|
[13286] | 201 | nn_hls = 1 |
---|
[3716] | 202 | ! |
---|
[11536] | 203 | ! !-------------------------------------------------! |
---|
| 204 | ! ! set communicator & select the local rank ! |
---|
| 205 | ! ! must be done as soon as possible to get narea ! |
---|
| 206 | ! !-------------------------------------------------! |
---|
[2574] | 207 | ! |
---|
[11536] | 208 | #if defined key_iomput |
---|
| 209 | CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm ) ! nemo local communicator given by xios |
---|
| 210 | CALL mpp_start( ilocal_comm ) |
---|
| 211 | #else |
---|
| 212 | CALL mpp_start( ) |
---|
| 213 | #endif |
---|
| 214 | ! |
---|
| 215 | narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) |
---|
| 216 | lwm = (narea == 1) ! control of output namelists |
---|
| 217 | ! |
---|
| 218 | ! !---------------------------------------------------------------! |
---|
| 219 | ! ! Open output files, reference and configuration namelist files ! |
---|
| 220 | ! !---------------------------------------------------------------! |
---|
| 221 | ! |
---|
| 222 | ! open ocean.output as soon as possible to get all output prints (including errors messages) |
---|
| 223 | IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 224 | ! open reference and configuration namelist files |
---|
[12377] | 225 | CALL load_nml( numnam_ref, 'namelist_ref', -1, lwm ) |
---|
| 226 | CALL load_nml( numnam_cfg, 'namelist_cfg', -1, lwm ) |
---|
[11536] | 227 | IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 228 | ! open /dev/null file to be able to supress output write easily |
---|
[12641] | 229 | IF( Agrif_Root() ) THEN |
---|
[11536] | 230 | CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
[12641] | 231 | #ifdef key_agrif |
---|
| 232 | ELSE |
---|
| 233 | numnul = Agrif_Parent(numnul) |
---|
| 234 | #endif |
---|
| 235 | ENDIF |
---|
[11536] | 236 | ! |
---|
| 237 | ! !--------------------! |
---|
[12377] | 238 | ! ! Open listing units ! -> need sn_cfctl from namctl to define lwp |
---|
[11536] | 239 | ! !--------------------! |
---|
| 240 | ! |
---|
[4147] | 241 | READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) |
---|
[11536] | 242 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) |
---|
[4147] | 243 | READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) |
---|
[11536] | 244 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) |
---|
[4147] | 245 | ! |
---|
[12377] | 246 | ! finalize the definition of namctl variables |
---|
[12933] | 247 | IF( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax .OR. MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) & |
---|
| 248 | & CALL nemo_set_cfctl( sn_cfctl, .FALSE. ) |
---|
[7646] | 249 | ! |
---|
[12377] | 250 | lwp = (narea == 1) .OR. sn_cfctl%l_oceout ! control of all listing output print |
---|
| 251 | ! |
---|
[2574] | 252 | IF(lwp) THEN ! open listing units |
---|
| 253 | ! |
---|
[11536] | 254 | IF( .NOT. lwm ) & ! alreay opened for narea == 1 |
---|
| 255 | & CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) |
---|
[2574] | 256 | ! |
---|
| 257 | WRITE(numout,*) |
---|
[11536] | 258 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' |
---|
[2574] | 259 | WRITE(numout,*) ' NEMO team' |
---|
[9213] | 260 | WRITE(numout,*) ' Off-line TOP Model' |
---|
[10570] | 261 | WRITE(numout,*) ' NEMO version 4.0 (2019) ' |
---|
[2574] | 262 | WRITE(numout,*) |
---|
[10570] | 263 | WRITE(numout,*) " ._ ._ ._ ._ ._ " |
---|
| 264 | WRITE(numout,*) " _.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._)`\_ " |
---|
[2574] | 265 | WRITE(numout,*) |
---|
[10570] | 266 | WRITE(numout,*) " o _, _, " |
---|
| 267 | WRITE(numout,*) " o .' ( .-' / " |
---|
| 268 | WRITE(numout,*) " o _/..._'. .' / " |
---|
| 269 | WRITE(numout,*) " ( o .-'` ` '-./ _.' " |
---|
| 270 | WRITE(numout,*) " ) ( o) ;= <_ ( " |
---|
| 271 | WRITE(numout,*) " ( '-.,\\__ __.-;`\ '. ) " |
---|
| 272 | WRITE(numout,*) " ) ) \) |`\ \) '. \ ( ( " |
---|
| 273 | WRITE(numout,*) " ( ( \_/ '-._\ ) ) " |
---|
| 274 | WRITE(numout,*) " ) ) ` ( ( " |
---|
| 275 | WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
---|
| 276 | WRITE(numout,*) |
---|
[2574] | 277 | ! |
---|
[9213] | 278 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 279 | ! |
---|
[2574] | 280 | ENDIF |
---|
[10457] | 281 | ! |
---|
[11536] | 282 | IF(lwm) WRITE( numond, namctl ) |
---|
| 283 | ! |
---|
| 284 | ! !------------------------------------! |
---|
| 285 | ! ! Set global domain size parameters ! |
---|
| 286 | ! !------------------------------------! |
---|
| 287 | ! |
---|
| 288 | READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) |
---|
| 289 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) |
---|
| 290 | READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) |
---|
| 291 | 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) |
---|
| 292 | ! |
---|
| 293 | IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file |
---|
[13286] | 294 | CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) |
---|
[11536] | 295 | ELSE ! user-defined namelist |
---|
[13286] | 296 | CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) |
---|
[11536] | 297 | ENDIF |
---|
| 298 | ! |
---|
| 299 | IF(lwm) WRITE( numond, namcfg ) |
---|
| 300 | l_offline = .true. ! passive tracers are run offline |
---|
| 301 | ! |
---|
| 302 | ! !-----------------------------------------! |
---|
| 303 | ! ! mpp parameters and domain decomposition ! |
---|
| 304 | ! !-----------------------------------------! |
---|
| 305 | ! |
---|
| 306 | CALL mpp_init |
---|
[2715] | 307 | |
---|
[13286] | 308 | CALL halo_mng_init() |
---|
[9213] | 309 | ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays |
---|
[2715] | 310 | CALL nemo_alloc() |
---|
| 311 | |
---|
[12377] | 312 | ! Initialise time level indices |
---|
| 313 | Nbb = 1; Nnn = 2; Naa = 3; Nrhs = Naa |
---|
| 314 | |
---|
[9213] | 315 | ! !-------------------------------! |
---|
| 316 | ! ! NEMO general initialization ! |
---|
| 317 | ! !-------------------------------! |
---|
[2574] | 318 | |
---|
[9213] | 319 | CALL nemo_ctl ! Control prints |
---|
[2574] | 320 | ! |
---|
[9213] | 321 | ! ! General initialization |
---|
[9019] | 322 | IF( ln_timing ) CALL timing_init |
---|
| 323 | IF( ln_timing ) CALL timing_start( 'nemo_init') |
---|
[3294] | 324 | ! |
---|
[9367] | 325 | CALL phy_cst ! Physical constants |
---|
| 326 | CALL eos_init ! Equation of state |
---|
| 327 | IF( lk_c1d ) CALL c1d_init ! 1D column configuration |
---|
[12377] | 328 | CALL dom_init( Nbb, Nnn, Naa, "OPA") ! Domain |
---|
| 329 | IF( sn_cfctl%l_prtctl ) & |
---|
| 330 | & CALL prt_ctl_init ! Print control |
---|
[7646] | 331 | |
---|
[12377] | 332 | CALL istate_init( Nnn, Naa ) ! ocean initial state (Dynamics and tracers) |
---|
[7646] | 333 | |
---|
[12377] | 334 | CALL sbc_init( Nbb, Nnn, Naa ) ! Forcings : surface module |
---|
[12843] | 335 | CALL bdy_init ! Open boundaries initialisation |
---|
[2574] | 336 | |
---|
[9213] | 337 | ! ! Tracer physics |
---|
| 338 | CALL ldf_tra_init ! Lateral ocean tracer physics |
---|
| 339 | CALL ldf_eiv_init ! Eddy induced velocity param |
---|
| 340 | CALL tra_ldf_init ! lateral mixing |
---|
| 341 | IF( l_ldfslp ) CALL ldf_slp_init ! slope of lateral mixing |
---|
[9751] | 342 | IF( ln_traqsr ) CALL tra_qsr_init ! penetrative solar radiation |
---|
[9213] | 343 | IF( ln_trabbl ) CALL tra_bbl_init ! advective (and/or diffusive) bottom boundary layer scheme |
---|
[2715] | 344 | |
---|
[9213] | 345 | ! ! Passive tracers |
---|
[9019] | 346 | CALL trc_nam_run ! Needed to get restart parameters for passive tracers |
---|
| 347 | CALL trc_rst_cal( nit000, 'READ' ) ! calendar |
---|
[10222] | 348 | #if defined key_sed_off |
---|
[12377] | 349 | CALL dta_dyn_sed_init( Nnn ) ! Initialization for the dynamics |
---|
[10222] | 350 | #else |
---|
[12377] | 351 | CALL dta_dyn_init( Nbb, Nnn, Naa ) ! Initialization for the dynamics |
---|
[10222] | 352 | #endif |
---|
[2574] | 353 | |
---|
[12377] | 354 | CALL trc_init( Nbb, Nnn, Naa ) ! Passive tracers initialization |
---|
[9213] | 355 | CALL dia_ptr_init ! Poleward TRansports initialization |
---|
| 356 | |
---|
[5504] | 357 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
[4749] | 358 | ! |
---|
[9019] | 359 | IF( ln_timing ) CALL timing_stop( 'nemo_init') |
---|
[3294] | 360 | ! |
---|
[2574] | 361 | END SUBROUTINE nemo_init |
---|
| 362 | |
---|
| 363 | |
---|
| 364 | SUBROUTINE nemo_ctl |
---|
| 365 | !!---------------------------------------------------------------------- |
---|
| 366 | !! *** ROUTINE nemo_ctl *** |
---|
| 367 | !! |
---|
[7646] | 368 | !! ** Purpose : control print setting |
---|
[2574] | 369 | !! |
---|
[12377] | 370 | !! ** Method : - print namctl and namcfg information and check some consistencies |
---|
[2574] | 371 | !!---------------------------------------------------------------------- |
---|
| 372 | ! |
---|
[7646] | 373 | IF(lwp) THEN ! control print |
---|
[2574] | 374 | WRITE(numout,*) |
---|
[7646] | 375 | WRITE(numout,*) 'nemo_ctl: Control prints' |
---|
[9213] | 376 | WRITE(numout,*) '~~~~~~~~' |
---|
[2574] | 377 | WRITE(numout,*) ' Namelist namctl' |
---|
[10570] | 378 | WRITE(numout,*) ' sn_cfctl%l_runstat = ', sn_cfctl%l_runstat |
---|
| 379 | WRITE(numout,*) ' sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat |
---|
| 380 | WRITE(numout,*) ' sn_cfctl%l_oceout = ', sn_cfctl%l_oceout |
---|
| 381 | WRITE(numout,*) ' sn_cfctl%l_layout = ', sn_cfctl%l_layout |
---|
[12377] | 382 | WRITE(numout,*) ' sn_cfctl%l_prtctl = ', sn_cfctl%l_prtctl |
---|
| 383 | WRITE(numout,*) ' sn_cfctl%l_prttrc = ', sn_cfctl%l_prttrc |
---|
| 384 | WRITE(numout,*) ' sn_cfctl%l_oasout = ', sn_cfctl%l_oasout |
---|
[10570] | 385 | WRITE(numout,*) ' sn_cfctl%procmin = ', sn_cfctl%procmin |
---|
| 386 | WRITE(numout,*) ' sn_cfctl%procmax = ', sn_cfctl%procmax |
---|
| 387 | WRITE(numout,*) ' sn_cfctl%procincr = ', sn_cfctl%procincr |
---|
| 388 | WRITE(numout,*) ' sn_cfctl%ptimincr = ', sn_cfctl%ptimincr |
---|
[9019] | 389 | WRITE(numout,*) ' timing by routine ln_timing = ', ln_timing |
---|
| 390 | WRITE(numout,*) ' CFL diagnostics ln_diacfl = ', ln_diacfl |
---|
[2574] | 391 | ENDIF |
---|
[7646] | 392 | |
---|
[13286] | 393 | IF( .NOT.ln_read_cfg ) ln_closea = .false. ! dealing possible only with a domcfg file |
---|
[7646] | 394 | IF(lwp) THEN ! control print |
---|
[4147] | 395 | WRITE(numout,*) |
---|
| 396 | WRITE(numout,*) ' Namelist namcfg' |
---|
[9213] | 397 | WRITE(numout,*) ' read domain configuration file ln_read_cfg = ', ln_read_cfg |
---|
[7646] | 398 | WRITE(numout,*) ' filename to be read cn_domcfg = ', TRIM(cn_domcfg) |
---|
[9436] | 399 | WRITE(numout,*) ' keep closed seas in the domain (if exist) ln_closea = ', ln_closea |
---|
[9213] | 400 | WRITE(numout,*) ' create a configuration definition file ln_write_cfg = ', ln_write_cfg |
---|
[7646] | 401 | WRITE(numout,*) ' filename to be written cn_domcfg_out = ', TRIM(cn_domcfg_out) |
---|
| 402 | WRITE(numout,*) ' use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr |
---|
[4147] | 403 | ENDIF |
---|
[9213] | 404 | ! |
---|
| 405 | IF( 1._wp /= SIGN(1._wp,-0._wp) ) CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.', & |
---|
| 406 | & 'Compile with key_nosignedzero enabled' ) |
---|
[3764] | 407 | ! |
---|
[2574] | 408 | END SUBROUTINE nemo_ctl |
---|
| 409 | |
---|
| 410 | |
---|
| 411 | SUBROUTINE nemo_closefile |
---|
| 412 | !!---------------------------------------------------------------------- |
---|
| 413 | !! *** ROUTINE nemo_closefile *** |
---|
| 414 | !! |
---|
| 415 | !! ** Purpose : Close the files |
---|
| 416 | !!---------------------------------------------------------------------- |
---|
| 417 | ! |
---|
[9213] | 418 | IF( lk_mpp ) CALL mppsync |
---|
[2574] | 419 | ! |
---|
| 420 | CALL iom_close ! close all input/output files managed by iom_* |
---|
| 421 | ! |
---|
| 422 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
[7646] | 423 | IF( lwm.AND.numond /= -1 ) CLOSE( numond ) ! oce output namelist |
---|
[9213] | 424 | ! |
---|
[2574] | 425 | numout = 6 ! redefine numout in case it is used after this point... |
---|
| 426 | ! |
---|
| 427 | END SUBROUTINE nemo_closefile |
---|
| 428 | |
---|
[2715] | 429 | |
---|
| 430 | SUBROUTINE nemo_alloc |
---|
| 431 | !!---------------------------------------------------------------------- |
---|
| 432 | !! *** ROUTINE nemo_alloc *** |
---|
| 433 | !! |
---|
| 434 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 435 | !! |
---|
| 436 | !! ** Method : |
---|
| 437 | !!---------------------------------------------------------------------- |
---|
[9213] | 438 | USE diawri , ONLY : dia_wri_alloc |
---|
| 439 | USE dom_oce, ONLY : dom_oce_alloc |
---|
| 440 | USE zdf_oce, ONLY : zdf_oce_alloc |
---|
| 441 | USE trc_oce, ONLY : trc_oce_alloc |
---|
[12843] | 442 | USE bdy_oce, ONLY : bdy_oce_alloc |
---|
[2715] | 443 | ! |
---|
| 444 | INTEGER :: ierr |
---|
| 445 | !!---------------------------------------------------------------------- |
---|
| 446 | ! |
---|
[9213] | 447 | ierr = oce_alloc () ! ocean |
---|
| 448 | ierr = ierr + dia_wri_alloc() |
---|
| 449 | ierr = ierr + dom_oce_alloc() ! ocean domain |
---|
| 450 | ierr = ierr + zdf_oce_alloc() ! ocean vertical physics |
---|
| 451 | ierr = ierr + trc_oce_alloc() ! shared TRC / TRA arrays |
---|
[12843] | 452 | ierr = ierr + bdy_oce_alloc() ! bdy masks (incl. initialization) |
---|
[2715] | 453 | ! |
---|
[10425] | 454 | CALL mpp_sum( 'nemogcm', ierr ) |
---|
[2715] | 455 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) |
---|
| 456 | ! |
---|
| 457 | END SUBROUTINE nemo_alloc |
---|
| 458 | |
---|
[12933] | 459 | SUBROUTINE nemo_set_cfctl(sn_cfctl, setto ) |
---|
[10570] | 460 | !!---------------------------------------------------------------------- |
---|
| 461 | !! *** ROUTINE nemo_set_cfctl *** |
---|
| 462 | !! |
---|
| 463 | !! ** Purpose : Set elements of the output control structure to setto. |
---|
[12933] | 464 | !! |
---|
[10570] | 465 | !! ** Method : Note this routine can be used to switch on/off some |
---|
[12933] | 466 | !! types of output for selected areas. |
---|
[10570] | 467 | !!---------------------------------------------------------------------- |
---|
[12933] | 468 | TYPE(sn_ctl), INTENT(inout) :: sn_cfctl |
---|
| 469 | LOGICAL , INTENT(in ) :: setto |
---|
[10570] | 470 | !!---------------------------------------------------------------------- |
---|
[12933] | 471 | sn_cfctl%l_runstat = setto |
---|
| 472 | sn_cfctl%l_trcstat = setto |
---|
[10570] | 473 | sn_cfctl%l_oceout = setto |
---|
| 474 | sn_cfctl%l_layout = setto |
---|
[12377] | 475 | sn_cfctl%l_prtctl = setto |
---|
| 476 | sn_cfctl%l_prttrc = setto |
---|
| 477 | sn_cfctl%l_oasout = setto |
---|
[10570] | 478 | END SUBROUTINE nemo_set_cfctl |
---|
| 479 | |
---|
[12377] | 480 | SUBROUTINE istate_init( Kmm, Kaa ) |
---|
[5504] | 481 | !!---------------------------------------------------------------------- |
---|
| 482 | !! *** ROUTINE istate_init *** |
---|
| 483 | !! |
---|
| 484 | !! ** Purpose : Initialization to zero of the dynamics and tracers. |
---|
| 485 | !!---------------------------------------------------------------------- |
---|
[12377] | 486 | INTEGER, INTENT(in) :: Kmm, Kaa ! ocean time level indices |
---|
[5504] | 487 | ! |
---|
| 488 | ! now fields ! after fields ! |
---|
[12377] | 489 | uu (:,:,:,Kmm) = 0._wp ; uu(:,:,:,Kaa) = 0._wp ! |
---|
| 490 | vv (:,:,:,Kmm) = 0._wp ; vv(:,:,:,Kaa) = 0._wp ! |
---|
| 491 | ww (:,:,:) = 0._wp ! ! |
---|
| 492 | hdiv (:,:,:) = 0._wp ! ! |
---|
| 493 | ts (:,:,:,:,Kmm) = 0._wp ! ! |
---|
[5504] | 494 | ! |
---|
| 495 | rhd (:,:,:) = 0.e0 |
---|
| 496 | rhop (:,:,:) = 0.e0 |
---|
| 497 | rn2 (:,:,:) = 0.e0 |
---|
| 498 | ! |
---|
| 499 | END SUBROUTINE istate_init |
---|
| 500 | |
---|
[9213] | 501 | |
---|
[12933] | 502 | SUBROUTINE stp_ctl( kt ) |
---|
[5504] | 503 | !!---------------------------------------------------------------------- |
---|
| 504 | !! *** ROUTINE stp_ctl *** |
---|
| 505 | !! |
---|
| 506 | !! ** Purpose : Control the run |
---|
| 507 | !! |
---|
| 508 | !! ** Method : - Save the time step in numstp |
---|
| 509 | !! |
---|
| 510 | !! ** Actions : 'time.step' file containing the last ocean time-step |
---|
| 511 | !!---------------------------------------------------------------------- |
---|
| 512 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
| 513 | !!---------------------------------------------------------------------- |
---|
| 514 | ! |
---|
[10425] | 515 | IF( kt == nit000 .AND. lwm ) THEN |
---|
[5504] | 516 | WRITE(numout,*) |
---|
| 517 | WRITE(numout,*) 'stp_ctl : time-stepping control' |
---|
| 518 | WRITE(numout,*) '~~~~~~~' |
---|
| 519 | ! open time.step file |
---|
| 520 | CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) |
---|
| 521 | ENDIF |
---|
| 522 | ! |
---|
[10425] | 523 | IF(lwm) WRITE ( numstp, '(1x, i8)' ) kt !* save the current time step in numstp |
---|
| 524 | IF(lwm) REWIND( numstp ) ! -------------------------- |
---|
[5504] | 525 | ! |
---|
| 526 | END SUBROUTINE stp_ctl |
---|
[2574] | 527 | !!====================================================================== |
---|
| 528 | END MODULE nemogcm |
---|