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