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