[524] | 1 | ! |
---|
[1403] | 2 | ! $Id: iniacademic.F90 4368 2022-12-05 23:01:16Z abarral $ |
---|
[524] | 3 | ! |
---|
[1472] | 4 | SUBROUTINE iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0) |
---|
[524] | 5 | |
---|
[2083] | 6 | USE filtreg_mod, ONLY: inifilr |
---|
[4368] | 7 | USE infotrac, ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName |
---|
[1472] | 8 | USE control_mod, ONLY: day_step,planet_type |
---|
[4368] | 9 | use exner_hyb_m, only: exner_hyb |
---|
| 10 | use exner_milieu_m, only: exner_milieu |
---|
[1454] | 11 | #ifdef CPP_IOIPSL |
---|
[2083] | 12 | USE IOIPSL, ONLY: getin |
---|
[1454] | 13 | #else |
---|
[1472] | 14 | ! if not using IOIPSL, we still need to use (a local version of) getin |
---|
[2083] | 15 | USE ioipsl_getincom, ONLY: getin |
---|
[1454] | 16 | #endif |
---|
[1472] | 17 | USE Write_Field |
---|
[2597] | 18 | USE comconst_mod, ONLY: cpp, kappa, g, daysec, dtvr, pi, im, jm |
---|
[2603] | 19 | USE logic_mod, ONLY: iflag_phys, read_start |
---|
[2600] | 20 | USE comvert_mod, ONLY: ap, bp, preff, presnivs, pressure_exner |
---|
[2601] | 21 | USE temps_mod, ONLY: annee_ref, day_ini, day_ref |
---|
[2622] | 22 | USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 |
---|
[4368] | 23 | USE readTracFiles_mod, ONLY: addPhase |
---|
[1146] | 24 | |
---|
[1472] | 25 | ! Author: Frederic Hourdin original: 15/01/93 |
---|
[1474] | 26 | ! The forcing defined here is from Held and Suarez, 1994, Bulletin |
---|
| 27 | ! of the American Meteorological Society, 75, 1825. |
---|
[524] | 28 | |
---|
[1472] | 29 | IMPLICIT NONE |
---|
[524] | 30 | |
---|
[1472] | 31 | ! Declararations: |
---|
| 32 | ! --------------- |
---|
[524] | 33 | |
---|
[1472] | 34 | include "dimensions.h" |
---|
| 35 | include "paramet.h" |
---|
| 36 | include "comgeom.h" |
---|
| 37 | include "academic.h" |
---|
| 38 | include "iniprint.h" |
---|
[524] | 39 | |
---|
[1472] | 40 | ! Arguments: |
---|
| 41 | ! ---------- |
---|
[1146] | 42 | |
---|
[2083] | 43 | REAL,INTENT(OUT) :: time_0 |
---|
[1146] | 44 | |
---|
[2083] | 45 | ! fields |
---|
| 46 | REAL,INTENT(OUT) :: vcov(ip1jm,llm) ! meridional covariant wind |
---|
| 47 | REAL,INTENT(OUT) :: ucov(ip1jmp1,llm) ! zonal covariant wind |
---|
| 48 | REAL,INTENT(OUT) :: teta(ip1jmp1,llm) ! potential temperature (K) |
---|
| 49 | REAL,INTENT(OUT) :: q(ip1jmp1,llm,nqtot) ! advected tracers (.../kg_of_air) |
---|
| 50 | REAL,INTENT(OUT) :: ps(ip1jmp1) ! surface pressure (Pa) |
---|
| 51 | REAL,INTENT(OUT) :: masse(ip1jmp1,llm) ! air mass in grid cell (kg) |
---|
| 52 | REAL,INTENT(OUT) :: phis(ip1jmp1) ! surface geopotential |
---|
[524] | 53 | |
---|
[1472] | 54 | ! Local: |
---|
| 55 | ! ------ |
---|
[524] | 56 | |
---|
[1472] | 57 | REAL p (ip1jmp1,llmp1 ) ! pression aux interfac.des couches |
---|
| 58 | REAL pks(ip1jmp1) ! exner au sol |
---|
| 59 | REAL pk(ip1jmp1,llm) ! exner au milieu des couches |
---|
| 60 | REAL phi(ip1jmp1,llm) ! geopotentiel |
---|
[1474] | 61 | REAL ddsin,zsig,tetapv,w_pv ! variables auxiliaires |
---|
| 62 | real tetastrat ! potential temperature in the stratosphere, in K |
---|
[1472] | 63 | real tetajl(jjp1,llm) |
---|
[4368] | 64 | INTEGER i,j,l,lsup,ij, iq, iName, iPhase, iqParent |
---|
[524] | 65 | |
---|
[1472] | 66 | REAL teta0,ttp,delt_y,delt_z,eps ! Constantes pour profil de T |
---|
| 67 | REAL k_f,k_c_a,k_c_s ! Constantes de rappel |
---|
| 68 | LOGICAL ok_geost ! Initialisation vent geost. ou nul |
---|
| 69 | LOGICAL ok_pv ! Polar Vortex |
---|
[4013] | 70 | REAL phi_pv,dphi_pv,gam_pv,tetanoise ! Constantes pour polar vortex |
---|
[1454] | 71 | |
---|
[1472] | 72 | real zz,ran1 |
---|
| 73 | integer idum |
---|
[524] | 74 | |
---|
[4368] | 75 | REAL zdtvr, tnat, alpha_ideal |
---|
[1520] | 76 | |
---|
| 77 | character(len=*),parameter :: modname="iniacademic" |
---|
| 78 | character(len=80) :: abort_message |
---|
[524] | 79 | |
---|
[2083] | 80 | ! Sanity check: verify that options selected by user are not incompatible |
---|
[2087] | 81 | if ((iflag_phys==1).and. .not. read_start) then |
---|
[2083] | 82 | write(lunout,*) trim(modname)," error: if read_start is set to ", & |
---|
| 83 | " false then iflag_phys should not be 1" |
---|
| 84 | write(lunout,*) "You most likely want an aquaplanet initialisation", & |
---|
| 85 | " (iflag_phys >= 100)" |
---|
| 86 | call abort_gcm(modname,"incompatible iflag_phys==1 and read_start==.false.",1) |
---|
| 87 | endif |
---|
| 88 | |
---|
[1472] | 89 | !----------------------------------------------------------------------- |
---|
| 90 | ! 1. Initializations for Earth-like case |
---|
| 91 | ! -------------------------------------- |
---|
| 92 | ! |
---|
| 93 | ! initialize planet radius, rotation rate,... |
---|
| 94 | call conf_planete |
---|
[524] | 95 | |
---|
[1472] | 96 | time_0=0. |
---|
| 97 | day_ref=1 |
---|
| 98 | annee_ref=0 |
---|
[1403] | 99 | |
---|
[1472] | 100 | im = iim |
---|
| 101 | jm = jjm |
---|
| 102 | day_ini = 1 |
---|
| 103 | dtvr = daysec/REAL(day_step) |
---|
| 104 | zdtvr=dtvr |
---|
| 105 | etot0 = 0. |
---|
| 106 | ptot0 = 0. |
---|
| 107 | ztot0 = 0. |
---|
| 108 | stot0 = 0. |
---|
| 109 | ang0 = 0. |
---|
[524] | 110 | |
---|
[1472] | 111 | if (llm == 1) then |
---|
| 112 | ! specific initializations for the shallow water case |
---|
| 113 | kappa=1 |
---|
| 114 | endif |
---|
[524] | 115 | |
---|
[1472] | 116 | CALL iniconst |
---|
| 117 | CALL inigeom |
---|
| 118 | CALL inifilr |
---|
[524] | 119 | |
---|
[4013] | 120 | ! Initialize pressure and mass field if read_start=.false. |
---|
| 121 | IF (.NOT. read_start) THEN |
---|
| 122 | ! surface pressure |
---|
| 123 | if (iflag_phys>2) then |
---|
| 124 | ! specific value for CMIP5 aqua/terra planets |
---|
| 125 | ! "Specify the initial dry mass to be equivalent to |
---|
| 126 | ! a global mean surface pressure (101325 minus 245) Pa." |
---|
| 127 | ps(:)=101080. |
---|
| 128 | else |
---|
| 129 | ! use reference surface pressure |
---|
| 130 | ps(:)=preff |
---|
| 131 | endif |
---|
[4368] | 132 | |
---|
[4013] | 133 | ! ground geopotential |
---|
| 134 | phis(:)=0. |
---|
| 135 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
[4368] | 136 | |
---|
[4013] | 137 | if (pressure_exner) then |
---|
| 138 | CALL exner_hyb( ip1jmp1, ps, p, pks, pk) |
---|
| 139 | else |
---|
| 140 | call exner_milieu(ip1jmp1,ps,p,pks,pk) |
---|
| 141 | endif |
---|
| 142 | CALL massdair(p,masse) |
---|
| 143 | ENDIF |
---|
| 144 | |
---|
[1472] | 145 | if (llm == 1) then |
---|
| 146 | ! initialize fields for the shallow water case, if required |
---|
| 147 | if (.not.read_start) then |
---|
| 148 | phis(:)=0. |
---|
| 149 | q(:,:,:)=0 |
---|
| 150 | CALL sw_case_williamson91_6(vcov,ucov,teta,masse,ps) |
---|
| 151 | endif |
---|
| 152 | endif |
---|
[524] | 153 | |
---|
[1529] | 154 | academic_case: if (iflag_phys >= 2) then |
---|
[1472] | 155 | ! initializations |
---|
[524] | 156 | |
---|
[1472] | 157 | ! 1. local parameters |
---|
| 158 | ! by convention, winter is in the southern hemisphere |
---|
| 159 | ! Geostrophic wind or no wind? |
---|
| 160 | ok_geost=.TRUE. |
---|
| 161 | CALL getin('ok_geost',ok_geost) |
---|
| 162 | ! Constants for Newtonian relaxation and friction |
---|
| 163 | k_f=1. !friction |
---|
| 164 | CALL getin('k_j',k_f) |
---|
| 165 | k_f=1./(daysec*k_f) |
---|
| 166 | k_c_s=4. !cooling surface |
---|
| 167 | CALL getin('k_c_s',k_c_s) |
---|
| 168 | k_c_s=1./(daysec*k_c_s) |
---|
| 169 | k_c_a=40. !cooling free atm |
---|
| 170 | CALL getin('k_c_a',k_c_a) |
---|
| 171 | k_c_a=1./(daysec*k_c_a) |
---|
| 172 | ! Constants for Teta equilibrium profile |
---|
| 173 | teta0=315. ! mean Teta (S.H. 315K) |
---|
| 174 | CALL getin('teta0',teta0) |
---|
| 175 | ttp=200. ! Tropopause temperature (S.H. 200K) |
---|
| 176 | CALL getin('ttp',ttp) |
---|
| 177 | eps=0. ! Deviation to N-S symmetry(~0-20K) |
---|
| 178 | CALL getin('eps',eps) |
---|
| 179 | delt_y=60. ! Merid Temp. Gradient (S.H. 60K) |
---|
| 180 | CALL getin('delt_y',delt_y) |
---|
| 181 | delt_z=10. ! Vertical Gradient (S.H. 10K) |
---|
| 182 | CALL getin('delt_z',delt_z) |
---|
| 183 | ! Polar vortex |
---|
| 184 | ok_pv=.false. |
---|
| 185 | CALL getin('ok_pv',ok_pv) |
---|
| 186 | phi_pv=-50. ! Latitude of edge of vortex |
---|
| 187 | CALL getin('phi_pv',phi_pv) |
---|
| 188 | phi_pv=phi_pv*pi/180. |
---|
| 189 | dphi_pv=5. ! Width of the edge |
---|
| 190 | CALL getin('dphi_pv',dphi_pv) |
---|
| 191 | dphi_pv=dphi_pv*pi/180. |
---|
| 192 | gam_pv=4. ! -dT/dz vortex (in K/km) |
---|
| 193 | CALL getin('gam_pv',gam_pv) |
---|
[4013] | 194 | tetanoise=0.005 |
---|
| 195 | CALL getin('tetanoise',tetanoise) |
---|
[524] | 196 | |
---|
[1472] | 197 | ! 2. Initialize fields towards which to relax |
---|
| 198 | ! Friction |
---|
| 199 | knewt_g=k_c_a |
---|
| 200 | DO l=1,llm |
---|
| 201 | zsig=presnivs(l)/preff |
---|
| 202 | knewt_t(l)=(k_c_s-k_c_a)*MAX(0.,(zsig-0.7)/0.3) |
---|
| 203 | kfrict(l)=k_f*MAX(0.,(zsig-0.7)/0.3) |
---|
| 204 | ENDDO |
---|
| 205 | DO j=1,jjp1 |
---|
| 206 | clat4((j-1)*iip1+1:j*iip1)=cos(rlatu(j))**4 |
---|
| 207 | ENDDO |
---|
[524] | 208 | |
---|
[1472] | 209 | ! Potential temperature |
---|
| 210 | DO l=1,llm |
---|
| 211 | zsig=presnivs(l)/preff |
---|
| 212 | tetastrat=ttp*zsig**(-kappa) |
---|
| 213 | tetapv=tetastrat |
---|
| 214 | IF ((ok_pv).AND.(zsig.LT.0.1)) THEN |
---|
| 215 | tetapv=tetastrat*(zsig*10.)**(kappa*cpp*gam_pv/1000./g) |
---|
| 216 | ENDIF |
---|
| 217 | DO j=1,jjp1 |
---|
| 218 | ! Troposphere |
---|
| 219 | ddsin=sin(rlatu(j)) |
---|
| 220 | tetajl(j,l)=teta0-delt_y*ddsin*ddsin+eps*ddsin & |
---|
| 221 | -delt_z*(1.-ddsin*ddsin)*log(zsig) |
---|
[1505] | 222 | if (planet_type=="giant") then |
---|
| 223 | tetajl(j,l)=teta0+(delt_y* & |
---|
| 224 | ((sin(rlatu(j)*3.14159*eps+0.0001))**2) & |
---|
| 225 | / ((rlatu(j)*3.14159*eps+0.0001)**2)) & |
---|
| 226 | -delt_z*log(zsig) |
---|
| 227 | endif |
---|
[1472] | 228 | ! Profil stratospherique isotherme (+vortex) |
---|
| 229 | w_pv=(1.-tanh((rlatu(j)-phi_pv)/dphi_pv))/2. |
---|
| 230 | tetastrat=tetastrat*(1.-w_pv)+tetapv*w_pv |
---|
| 231 | tetajl(j,l)=MAX(tetajl(j,l),tetastrat) |
---|
| 232 | ENDDO |
---|
| 233 | ENDDO |
---|
[524] | 234 | |
---|
[1472] | 235 | ! CALL writefield('theta_eq',tetajl) |
---|
[524] | 236 | |
---|
[1472] | 237 | do l=1,llm |
---|
| 238 | do j=1,jjp1 |
---|
| 239 | do i=1,iip1 |
---|
| 240 | ij=(j-1)*iip1+i |
---|
| 241 | tetarappel(ij,l)=tetajl(j,l) |
---|
| 242 | enddo |
---|
| 243 | enddo |
---|
| 244 | enddo |
---|
| 245 | |
---|
| 246 | ! 3. Initialize fields (if necessary) |
---|
| 247 | IF (.NOT. read_start) THEN |
---|
[4013] | 248 | ! bulk initialization of temperature |
---|
| 249 | IF (iflag_phys>10000) THEN |
---|
| 250 | ! Particular case to impose a constant temperature T0=0.01*iflag_physx |
---|
| 251 | teta(:,:)= 0.01*iflag_phys/(pk(:,:)/cpp) |
---|
| 252 | ELSE |
---|
| 253 | teta(:,:)=tetarappel(:,:) |
---|
| 254 | ENDIF |
---|
[1472] | 255 | ! geopotential |
---|
| 256 | CALL geopot(ip1jmp1,teta,pk,pks,phis,phi) |
---|
| 257 | |
---|
[4013] | 258 | DO l=1,llm |
---|
| 259 | print*,'presnivs,play,l',presnivs(l),(pk(1,l)/cpp)**(1./kappa)*preff |
---|
| 260 | !pks(ij) = (cpp/preff) * ps(ij) |
---|
| 261 | !pk(ij,1) = .5*pks(ij) |
---|
| 262 | ! pk = cpp * (p/preff)^kappa |
---|
| 263 | ENDDO |
---|
| 264 | |
---|
[1472] | 265 | ! winds |
---|
| 266 | if (ok_geost) then |
---|
| 267 | call ugeostr(phi,ucov) |
---|
| 268 | else |
---|
| 269 | ucov(:,:)=0. |
---|
| 270 | endif |
---|
| 271 | vcov(:,:)=0. |
---|
| 272 | |
---|
| 273 | ! bulk initialization of tracers |
---|
| 274 | if (planet_type=="earth") then |
---|
| 275 | ! Earth: first two tracers will be water |
---|
[4368] | 276 | do iq=1,nqtot |
---|
| 277 | q(:,:,iq)=0. |
---|
| 278 | IF(tracers(iq)%name == addPhase('H2O', 'g')) q(:,:,iq)=1.e-10 |
---|
| 279 | IF(tracers(iq)%name == addPhase('H2O', 'l')) q(:,:,iq)=1.e-15 |
---|
[2270] | 280 | |
---|
| 281 | ! CRisi: init des isotopes |
---|
| 282 | ! distill de Rayleigh très simplifiée |
---|
[4368] | 283 | iName = tracers(iq)%iso_iName |
---|
| 284 | if (niso <= 0 .OR. iName <= 0) CYCLE |
---|
| 285 | iPhase = tracers(iq)%iso_iPhase |
---|
| 286 | iqParent = tracers(iq)%iqParent |
---|
| 287 | IF(tracers(iq)%iso_iZone == 0) THEN |
---|
| 288 | IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) & |
---|
| 289 | CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1) |
---|
| 290 | q(:,:,iq) = q(:,:,iqParent)*tnat*(q(:,:,iqParent)/30.e-3)**(alpha_ideal-1.) |
---|
| 291 | ELSE |
---|
| 292 | q(:,:,iq) = q(:,:,iqIsoPha(iName,iPhase)) |
---|
| 293 | END IF |
---|
[1472] | 294 | enddo |
---|
| 295 | else |
---|
| 296 | q(:,:,:)=0 |
---|
| 297 | endif ! of if (planet_type=="earth") |
---|
| 298 | |
---|
[4368] | 299 | call check_isotopes_seq(q,1,ip1jmp1,'iniacademic_loc') |
---|
[2270] | 300 | |
---|
[1472] | 301 | ! add random perturbation to temperature |
---|
| 302 | idum = -1 |
---|
| 303 | zz = ran1(idum) |
---|
| 304 | idum = 0 |
---|
| 305 | do l=1,llm |
---|
| 306 | do ij=iip2,ip1jm |
---|
[4013] | 307 | teta(ij,l)=teta(ij,l)*(1.+tetanoise*ran1(idum)) |
---|
[1472] | 308 | enddo |
---|
| 309 | enddo |
---|
| 310 | |
---|
| 311 | ! maintain periodicity in longitude |
---|
| 312 | do l=1,llm |
---|
| 313 | do ij=1,ip1jmp1,iip1 |
---|
| 314 | teta(ij+iim,l)=teta(ij,l) |
---|
| 315 | enddo |
---|
| 316 | enddo |
---|
| 317 | |
---|
| 318 | ENDIF ! of IF (.NOT. read_start) |
---|
| 319 | endif academic_case |
---|
| 320 | |
---|
| 321 | END SUBROUTINE iniacademic |
---|