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