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