[5118] | 1 | SUBROUTINE iniacademic(vcov, ucov, teta, q, masse, ps, phis, time_0) |
---|
[524] | 2 | |
---|
[5106] | 3 | USE lmdz_filtreg, ONLY: inifilr |
---|
[5229] | 4 | USE lmdz_infotrac, ONLY: nqtot, niso, iqIsoPha, tracers, isoName, addPhase |
---|
[5118] | 5 | USE control_mod, ONLY: day_step, planet_type |
---|
[5117] | 6 | USE exner_hyb_m, ONLY: exner_hyb |
---|
| 7 | USE exner_milieu_m, ONLY: exner_milieu |
---|
[2083] | 8 | USE IOIPSL, ONLY: getin |
---|
[5117] | 9 | USE lmdz_write_field |
---|
[2597] | 10 | USE comconst_mod, ONLY: cpp, kappa, g, daysec, dtvr, pi, im, jm |
---|
[2603] | 11 | USE logic_mod, ONLY: iflag_phys, read_start |
---|
[4376] | 12 | USE comvert_mod, ONLY: ap, bp, preff, pa, presnivs, pressure_exner |
---|
[2601] | 13 | USE temps_mod, ONLY: annee_ref, day_ini, day_ref |
---|
[5118] | 14 | USE ener_mod, ONLY: etot0, ptot0, ztot0, stot0, ang0 |
---|
| 15 | USE netcdf, ONLY: nf90_nowrite, nf90_open, nf90_noerr, nf90_inq_varid, nf90_close, nf90_get_var |
---|
[5117] | 16 | USE lmdz_ran1, ONLY: ran1 |
---|
[5118] | 17 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
[5134] | 18 | USE lmdz_academic, ONLY: tetarappel, knewt_t, kfrict, knewt_g, clat4 |
---|
[5136] | 19 | USE lmdz_comgeom |
---|
[5229] | 20 | USE iso_params_mod ! tnat_* and alpha_ideal_* |
---|
[1146] | 21 | |
---|
[1472] | 22 | ! Author: Frederic Hourdin original: 15/01/93 |
---|
[1474] | 23 | ! The forcing defined here is from Held and Suarez, 1994, Bulletin |
---|
| 24 | ! of the American Meteorological Society, 75, 1825. |
---|
[524] | 25 | |
---|
[5159] | 26 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 27 | USE lmdz_paramet |
---|
[5186] | 28 | USE lmdz_check_isotopes, ONLY: check_isotopes_seq |
---|
| 29 | |
---|
[1472] | 30 | IMPLICIT NONE |
---|
[524] | 31 | |
---|
[1472] | 32 | ! Declararations: |
---|
| 33 | ! --------------- |
---|
[524] | 34 | |
---|
| 35 | |
---|
[5159] | 36 | |
---|
| 37 | |
---|
[1472] | 38 | ! Arguments: |
---|
| 39 | ! ---------- |
---|
[1146] | 40 | |
---|
[5118] | 41 | REAL, INTENT(OUT) :: time_0 |
---|
[1146] | 42 | |
---|
[2083] | 43 | ! fields |
---|
[5118] | 44 | REAL, INTENT(OUT) :: vcov(ip1jm, llm) ! meridional covariant wind |
---|
| 45 | REAL, INTENT(OUT) :: ucov(ip1jmp1, llm) ! zonal covariant wind |
---|
| 46 | REAL, INTENT(OUT) :: teta(ip1jmp1, llm) ! potential temperature (K) |
---|
| 47 | REAL, INTENT(OUT) :: q(ip1jmp1, llm, nqtot) ! advected tracers (.../kg_of_air) |
---|
| 48 | REAL, INTENT(OUT) :: ps(ip1jmp1) ! surface pressure (Pa) |
---|
| 49 | REAL, INTENT(OUT) :: masse(ip1jmp1, llm) ! air mass in grid cell (kg) |
---|
| 50 | REAL, INTENT(OUT) :: phis(ip1jmp1) ! surface geopotential |
---|
[524] | 51 | |
---|
[1472] | 52 | ! Local: |
---|
| 53 | ! ------ |
---|
[524] | 54 | |
---|
[5118] | 55 | REAL p (ip1jmp1, llmp1) ! pression aux interfac.des couches |
---|
[1472] | 56 | REAL pks(ip1jmp1) ! exner au sol |
---|
[5118] | 57 | REAL pk(ip1jmp1, llm) ! exner au milieu des couches |
---|
| 58 | REAL phi(ip1jmp1, llm) ! geopotentiel |
---|
| 59 | REAL ddsin, zsig, tetapv, w_pv ! variables auxiliaires |
---|
[5117] | 60 | REAL tetastrat ! potential temperature in the stratosphere, in K |
---|
[5118] | 61 | REAL tetajl(jjp1, llm) |
---|
| 62 | INTEGER i, j, l, lsup, ij, iq, iName, iPhase, iqParent |
---|
[524] | 63 | |
---|
[5118] | 64 | INTEGER :: nid_relief, varid, ierr |
---|
| 65 | REAL, DIMENSION(iip1, jjp1) :: relief |
---|
[4419] | 66 | |
---|
[5118] | 67 | REAL teta0, ttp, delt_y, delt_z, eps ! Constantes pour profil de T |
---|
| 68 | REAL k_f, k_c_a, k_c_s ! Constantes de rappel |
---|
[1472] | 69 | LOGICAL ok_geost ! Initialisation vent geost. ou nul |
---|
| 70 | LOGICAL ok_pv ! Polar Vortex |
---|
[5118] | 71 | REAL phi_pv, dphi_pv, gam_pv, tetanoise ! Constantes pour polar vortex |
---|
[1454] | 72 | |
---|
[5117] | 73 | REAL zz |
---|
| 74 | INTEGER idum |
---|
[524] | 75 | |
---|
[4325] | 76 | REAL zdtvr, tnat, alpha_ideal |
---|
[5223] | 77 | LOGICAL :: ltnat1 |
---|
| 78 | |
---|
| 79 | character(len=*),parameter :: modname="iniacademic" |
---|
| 80 | character(len=80) :: abort_message |
---|
[524] | 81 | |
---|
[2083] | 82 | ! Sanity check: verify that options selected by user are not incompatible |
---|
[5117] | 83 | IF ((iflag_phys==1).AND. .NOT. read_start) THEN |
---|
[5118] | 84 | WRITE(lunout, *) trim(modname), " error: if read_start is set to ", & |
---|
| 85 | " false then iflag_phys should not be 1" |
---|
| 86 | WRITE(lunout, *) "You most likely want an aquaplanet initialisation", & |
---|
| 87 | " (iflag_phys >= 100)" |
---|
| 88 | CALL abort_gcm(modname, "incompatible iflag_phys==1 and read_start==.FALSE.", 1) |
---|
[5117] | 89 | ENDIF |
---|
[5118] | 90 | |
---|
[1472] | 91 | !----------------------------------------------------------------------- |
---|
| 92 | ! 1. Initializations for Earth-like case |
---|
| 93 | ! -------------------------------------- |
---|
[5099] | 94 | |
---|
[1472] | 95 | ! initialize planet radius, rotation rate,... |
---|
[5101] | 96 | CALL conf_planete |
---|
[524] | 97 | |
---|
[5118] | 98 | time_0 = 0. |
---|
| 99 | day_ref = 1 |
---|
| 100 | annee_ref = 0 |
---|
[1403] | 101 | |
---|
[5118] | 102 | im = iim |
---|
| 103 | jm = jjm |
---|
| 104 | day_ini = 1 |
---|
| 105 | dtvr = daysec / REAL(day_step) |
---|
| 106 | zdtvr = dtvr |
---|
| 107 | etot0 = 0. |
---|
| 108 | ptot0 = 0. |
---|
| 109 | ztot0 = 0. |
---|
| 110 | stot0 = 0. |
---|
| 111 | ang0 = 0. |
---|
[524] | 112 | |
---|
[5117] | 113 | IF (llm == 1) THEN |
---|
[5118] | 114 | ! specific initializations for the shallow water case |
---|
| 115 | kappa = 1 |
---|
[5117] | 116 | ENDIF |
---|
[524] | 117 | |
---|
[1472] | 118 | CALL iniconst |
---|
| 119 | CALL inigeom |
---|
| 120 | CALL inifilr |
---|
[524] | 121 | |
---|
[4419] | 122 | |
---|
| 123 | !------------------------------------------------------------------ |
---|
[5103] | 124 | ! Initialize pressure and mass field if read_start=.FALSE. |
---|
[4419] | 125 | !------------------------------------------------------------------ |
---|
| 126 | |
---|
[3976] | 127 | IF (.NOT. read_start) THEN |
---|
[4056] | 128 | |
---|
[5118] | 129 | !------------------------------------------------------------------ |
---|
| 130 | ! Lecture eventuelle d'un fichier de relief interpollee sur la grille |
---|
| 131 | ! du modele. |
---|
| 132 | ! On suppose que le fichier relief_in.nc est stoké sur une grille |
---|
| 133 | ! iim*jjp1 |
---|
| 134 | ! Facile a créer à partir de la commande |
---|
| 135 | ! cdo remapcon,fichier_output_phys.nc Relief.nc relief_in.nc |
---|
| 136 | !------------------------------------------------------------------ |
---|
[4419] | 137 | |
---|
[5118] | 138 | relief = 0. |
---|
| 139 | ierr = nf90_open ('relief_in.nc', nf90_nowrite, nid_relief) |
---|
| 140 | IF (ierr==nf90_noerr) THEN |
---|
| 141 | ierr = nf90_inq_varid(nid_relief, 'RELIEF', varid) |
---|
| 142 | IF (ierr==nf90_noerr) THEN |
---|
| 143 | ierr = nf90_get_var(nid_relief, varid, relief(1:iim, 1:jjp1)) |
---|
| 144 | relief(iip1, :) = relief(1, :) |
---|
| 145 | else |
---|
| 146 | CALL abort_gcm ('iniacademic', 'variable RELIEF pas la', 1) |
---|
| 147 | endif |
---|
| 148 | endif |
---|
| 149 | ierr = nf90_close (nid_relief) |
---|
[4419] | 150 | |
---|
[5118] | 151 | !------------------------------------------------------------------ |
---|
| 152 | ! Initialisation du geopotentiel au sol et de la pression |
---|
| 153 | !------------------------------------------------------------------ |
---|
[4419] | 154 | |
---|
[5118] | 155 | PRINT*, 'relief=', minval(relief), maxval(relief), 'g=', g |
---|
[5158] | 156 | DO j = 1, jjp1 |
---|
| 157 | DO i = 1, iip1 |
---|
[5118] | 158 | phis((j - 1) * iip1 + i) = g * relief(i, j) |
---|
| 159 | enddo |
---|
| 160 | enddo |
---|
| 161 | PRINT*, 'phis=', minval(phis), maxval(phis), 'g=', g |
---|
[4419] | 162 | |
---|
[5118] | 163 | ! ground geopotential |
---|
| 164 | !phis(:)=0. |
---|
| 165 | ps(:) = preff |
---|
| 166 | CALL pression (ip1jmp1, ap, bp, ps, p) |
---|
[4056] | 167 | |
---|
[5118] | 168 | IF (pressure_exner) THEN |
---|
| 169 | CALL exner_hyb(ip1jmp1, ps, p, pks, pk) |
---|
| 170 | else |
---|
| 171 | CALL exner_milieu(ip1jmp1, ps, p, pks, pk) |
---|
| 172 | endif |
---|
| 173 | CALL massdair(p, masse) |
---|
[3976] | 174 | ENDIF |
---|
| 175 | |
---|
[5117] | 176 | IF (llm == 1) THEN |
---|
[5118] | 177 | ! initialize fields for the shallow water case, if required |
---|
| 178 | IF (.NOT.read_start) THEN |
---|
| 179 | phis(:) = 0. |
---|
| 180 | q(:, :, :) = 0 |
---|
| 181 | CALL sw_case_williamson91_6(vcov, ucov, teta, masse, ps) |
---|
| 182 | endif |
---|
[5117] | 183 | ENDIF |
---|
[524] | 184 | |
---|
[5116] | 185 | academic_case: if (iflag_phys >= 2) THEN |
---|
[5118] | 186 | ! initializations |
---|
[524] | 187 | |
---|
[5118] | 188 | ! 1. local parameters |
---|
| 189 | ! by convention, winter is in the southern hemisphere |
---|
| 190 | ! Geostrophic wind or no wind? |
---|
| 191 | ok_geost = .TRUE. |
---|
| 192 | CALL getin('ok_geost', ok_geost) |
---|
| 193 | ! Constants for Newtonian relaxation and friction |
---|
| 194 | k_f = 1. !friction |
---|
| 195 | CALL getin('k_j', k_f) |
---|
| 196 | k_f = 1. / (daysec * k_f) |
---|
| 197 | k_c_s = 4. !cooling surface |
---|
| 198 | CALL getin('k_c_s', k_c_s) |
---|
| 199 | k_c_s = 1. / (daysec * k_c_s) |
---|
| 200 | k_c_a = 40. !cooling free atm |
---|
| 201 | CALL getin('k_c_a', k_c_a) |
---|
| 202 | k_c_a = 1. / (daysec * k_c_a) |
---|
| 203 | ! Constants for Teta equilibrium profile |
---|
| 204 | teta0 = 315. ! mean Teta (S.H. 315K) |
---|
| 205 | CALL getin('teta0', teta0) |
---|
| 206 | ttp = 200. ! Tropopause temperature (S.H. 200K) |
---|
| 207 | CALL getin('ttp', ttp) |
---|
| 208 | eps = 0. ! Deviation to N-S symmetry(~0-20K) |
---|
| 209 | CALL getin('eps', eps) |
---|
| 210 | delt_y = 60. ! Merid Temp. Gradient (S.H. 60K) |
---|
| 211 | CALL getin('delt_y', delt_y) |
---|
| 212 | delt_z = 10. ! Vertical Gradient (S.H. 10K) |
---|
| 213 | CALL getin('delt_z', delt_z) |
---|
| 214 | ! Polar vortex |
---|
| 215 | ok_pv = .FALSE. |
---|
| 216 | CALL getin('ok_pv', ok_pv) |
---|
| 217 | phi_pv = -50. ! Latitude of edge of vortex |
---|
| 218 | CALL getin('phi_pv', phi_pv) |
---|
| 219 | phi_pv = phi_pv * pi / 180. |
---|
| 220 | dphi_pv = 5. ! Width of the edge |
---|
| 221 | CALL getin('dphi_pv', dphi_pv) |
---|
| 222 | dphi_pv = dphi_pv * pi / 180. |
---|
| 223 | gam_pv = 4. ! -dT/dz vortex (in K/km) |
---|
| 224 | CALL getin('gam_pv', gam_pv) |
---|
| 225 | tetanoise = 0.005 |
---|
| 226 | CALL getin('tetanoise', tetanoise) |
---|
[524] | 227 | |
---|
[5118] | 228 | ! 2. Initialize fields towards which to relax |
---|
| 229 | ! Friction |
---|
| 230 | knewt_g = k_c_a |
---|
| 231 | DO l = 1, llm |
---|
| 232 | zsig = presnivs(l) / preff |
---|
| 233 | knewt_t(l) = (k_c_s - k_c_a) * MAX(0., (zsig - 0.7) / 0.3) |
---|
| 234 | kfrict(l) = k_f * MAX(0., (zsig - 0.7) / 0.3) |
---|
| 235 | ENDDO |
---|
| 236 | DO j = 1, jjp1 |
---|
| 237 | clat4((j - 1) * iip1 + 1:j * iip1) = cos(rlatu(j))**4 |
---|
| 238 | ENDDO |
---|
[524] | 239 | |
---|
[5118] | 240 | ! Potential temperature |
---|
| 241 | DO l = 1, llm |
---|
| 242 | zsig = presnivs(l) / preff |
---|
| 243 | tetastrat = ttp * zsig**(-kappa) |
---|
| 244 | tetapv = tetastrat |
---|
| 245 | IF ((ok_pv).AND.(zsig<0.1)) THEN |
---|
| 246 | tetapv = tetastrat * (zsig * 10.)**(kappa * cpp * gam_pv / 1000. / g) |
---|
| 247 | ENDIF |
---|
| 248 | DO j = 1, jjp1 |
---|
| 249 | ! Troposphere |
---|
| 250 | ddsin = sin(rlatu(j)) |
---|
| 251 | tetajl(j, l) = teta0 - delt_y * ddsin * ddsin + eps * ddsin & |
---|
| 252 | - delt_z * (1. - ddsin * ddsin) * log(zsig) |
---|
| 253 | IF (planet_type=="giant") THEN |
---|
| 254 | tetajl(j, l) = teta0 + (delt_y * & |
---|
| 255 | ((sin(rlatu(j) * 3.14159 * eps + 0.0001))**2) & |
---|
| 256 | / ((rlatu(j) * 3.14159 * eps + 0.0001)**2)) & |
---|
| 257 | - delt_z * log(zsig) |
---|
| 258 | endif |
---|
| 259 | ! Profil stratospherique isotherme (+vortex) |
---|
| 260 | w_pv = (1. - tanh((rlatu(j) - phi_pv) / dphi_pv)) / 2. |
---|
| 261 | tetastrat = tetastrat * (1. - w_pv) + tetapv * w_pv |
---|
| 262 | tetajl(j, l) = MAX(tetajl(j, l), tetastrat) |
---|
| 263 | ENDDO |
---|
| 264 | ENDDO |
---|
[524] | 265 | |
---|
[5118] | 266 | ! CALL writefield('theta_eq',tetajl) |
---|
[524] | 267 | |
---|
[5158] | 268 | DO l = 1, llm |
---|
| 269 | DO j = 1, jjp1 |
---|
| 270 | DO i = 1, iip1 |
---|
[5118] | 271 | ij = (j - 1) * iip1 + i |
---|
| 272 | tetarappel(ij, l) = tetajl(j, l) |
---|
[1472] | 273 | enddo |
---|
[5118] | 274 | enddo |
---|
| 275 | enddo |
---|
[1472] | 276 | |
---|
[5118] | 277 | ! 3. Initialize fields (if necessary) |
---|
| 278 | IF (.NOT. read_start) THEN |
---|
| 279 | ! bulk initialization of temperature |
---|
| 280 | IF (iflag_phys>10000) THEN |
---|
[3976] | 281 | ! Particular case to impose a constant temperature T0=0.01*iflag_physx |
---|
[5118] | 282 | teta(:, :) = 0.01 * iflag_phys / (pk(:, :) / cpp) |
---|
| 283 | ELSE |
---|
| 284 | teta(:, :) = tetarappel(:, :) |
---|
| 285 | ENDIF |
---|
| 286 | ! geopotential |
---|
| 287 | CALL geopot(ip1jmp1, teta, pk, pks, phis, phi) |
---|
[1472] | 288 | |
---|
[5118] | 289 | DO l = 1, llm |
---|
| 290 | PRINT*, 'presnivs,play,l', presnivs(l), (pk(1, l) / cpp)**(1. / kappa) * preff |
---|
| 291 | !pks(ij) = (cpp/preff) * ps(ij) |
---|
| 292 | !pk(ij,1) = .5*pks(ij) |
---|
| 293 | ! pk = cpp * (p/preff)^kappa |
---|
| 294 | ENDDO |
---|
[3976] | 295 | |
---|
[5118] | 296 | ! winds |
---|
| 297 | IF (ok_geost) THEN |
---|
| 298 | CALL ugeostr(phi, ucov) |
---|
| 299 | else |
---|
| 300 | ucov(:, :) = 0. |
---|
| 301 | endif |
---|
| 302 | vcov(:, :) = 0. |
---|
[1472] | 303 | |
---|
[5118] | 304 | ! bulk initialization of tracers |
---|
| 305 | IF (planet_type=="earth") THEN |
---|
[5223] | 306 | ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)! Earth: first two tracers will be water |
---|
[5158] | 307 | DO iq = 1, nqtot |
---|
[5118] | 308 | q(:, :, iq) = 0. |
---|
| 309 | IF(tracers(iq)%name == addPhase('H2O', 'g')) q(:, :, iq) = 1.e-10 |
---|
| 310 | IF(tracers(iq)%name == addPhase('H2O', 'l')) q(:, :, iq) = 1.e-15 |
---|
[2270] | 311 | |
---|
[5223] | 312 | ! CRisi: init des isotopes |
---|
| 313 | ! distill de Rayleigh très simplifiée |
---|
| 314 | iName = tracers(iq)%iso_iName |
---|
| 315 | if (niso <= 0 .OR. iName <= 0) CYCLE |
---|
| 316 | iPhase = tracers(iq)%iso_iPhase |
---|
| 317 | iqParent = tracers(iq)%iqParent |
---|
| 318 | IF(tracers(iq)%iso_iZone == 0) THEN |
---|
| 319 | IF(ltnat1) THEN |
---|
| 320 | tnat = 1.0 |
---|
| 321 | alpha_ideal = 1.0 |
---|
| 322 | WRITE(lunout, *)'In '//TRIM(modname)//': !!! Beware: alpha_ideal put to 1 !!!' |
---|
| 323 | ELSE |
---|
[5229] | 324 | SELECT CASE(isoName(iName)) |
---|
| 325 | CASE('H216O'); tnat = tnat_H216O; alpha_ideal = alpha_ideal_H216O |
---|
| 326 | CASE('H217O'); tnat = tnat_H217O; alpha_ideal = alpha_ideal_H217O |
---|
| 327 | CASE('H218O'); tnat = tnat_H218O; alpha_ideal = alpha_ideal_H218O |
---|
| 328 | CASE('HDO'); tnat = tnat_HDO; alpha_ideal = alpha_ideal_HDO |
---|
| 329 | CASE('HTO'); tnat = tnat_HTO; alpha_ideal = alpha_ideal_HTO |
---|
| 330 | CASE DEFAULT |
---|
| 331 | CALL abort_gcm(TRIM(modname),'unknown isotope "'//TRIM(isoName(iName))//'" ; check tracer.def file',1) |
---|
| 332 | END SELECT |
---|
[5223] | 333 | END IF |
---|
| 334 | q(:,:,iq) = q(:,:,iqParent)*tnat*(q(:,:,iqParent)/30.e-3)**(alpha_ideal-1.) |
---|
| 335 | ELSE !IF(tracers(iq)%iso_iZone == 0) THEN |
---|
| 336 | IF(tracers(iq)%iso_iZone == 1) THEN |
---|
| 337 | ! correction le 14 mai 2024 pour que tous les traceurs soient de la couleur 1. |
---|
| 338 | ! Sinon, on va avoir des porblèmes de conservation de masse de traceurs. |
---|
| 339 | q(:,:,iq) = q(:,:,iqIsoPha(iName,iPhase)) |
---|
| 340 | else !IF(tracers(iq)%iso_iZone == 1) THEN |
---|
| 341 | q(:,:,iq) = 0. |
---|
| 342 | endif !IF(tracers(iq)%iso_iZone == 1) THEN |
---|
| 343 | END IF !IF(tracers(iq)%iso_iZone == 0) THEN |
---|
| 344 | enddo |
---|
| 345 | else |
---|
| 346 | q(:,:,:)=0 |
---|
| 347 | endif ! of if (planet_type=="earth") |
---|
[1472] | 348 | |
---|
[5186] | 349 | CALL check_isotopes_seq(q, ip1jmp1, 'iniacademic_loc') |
---|
[2270] | 350 | |
---|
[5118] | 351 | ! add random perturbation to temperature |
---|
| 352 | idum = -1 |
---|
| 353 | zz = ran1(idum) |
---|
| 354 | idum = 0 |
---|
[5158] | 355 | DO l = 1, llm |
---|
| 356 | DO ij = iip2, ip1jm |
---|
[5118] | 357 | teta(ij, l) = teta(ij, l) * (1. + tetanoise * ran1(idum)) |
---|
[1472] | 358 | enddo |
---|
[5118] | 359 | enddo |
---|
[1472] | 360 | |
---|
[5118] | 361 | ! maintain periodicity in longitude |
---|
[5158] | 362 | DO l = 1, llm |
---|
| 363 | DO ij = 1, ip1jmp1, iip1 |
---|
[5118] | 364 | teta(ij + iim, l) = teta(ij, l) |
---|
[1472] | 365 | enddo |
---|
[5118] | 366 | enddo |
---|
[1472] | 367 | |
---|
[5118] | 368 | ENDIF ! of IF (.NOT. read_start) |
---|
[5117] | 369 | ENDIF academic_case |
---|
[1472] | 370 | |
---|
| 371 | END SUBROUTINE iniacademic |
---|