[1130] | 1 | module phyredem |
---|
| 2 | |
---|
| 3 | implicit none |
---|
| 4 | |
---|
[3142] | 5 | !======================================================================= |
---|
[1130] | 6 | contains |
---|
[3142] | 7 | !======================================================================= |
---|
[1130] | 8 | |
---|
| 9 | subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq, & |
---|
| 10 | phystep,day_ini,time,airefi, & |
---|
[2896] | 11 | alb,ith,def_slope, & |
---|
| 12 | subslope_dist) |
---|
[3142] | 13 | |
---|
[1130] | 14 | ! create physics restart file and write time-independent variables |
---|
| 15 | use comsoil_h, only: inertiedat, volcapa, mlayer |
---|
[1543] | 16 | use geometry_mod, only: cell_area |
---|
[1221] | 17 | use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, & |
---|
[1130] | 18 | z0_default, albedice, emisice, emissiv, & |
---|
[1974] | 19 | iceradius, dtemisice, phisfi, z0, & |
---|
[2884] | 20 | hmons,summit,base,watercaptag |
---|
[1246] | 21 | use dimradmars_mod, only: tauvis |
---|
[1130] | 22 | use iostart, only : open_restartphy, close_restartphy, & |
---|
| 23 | put_var, put_field, length |
---|
| 24 | use mod_grid_phy_lmdz, only : klon_glo |
---|
[1524] | 25 | use planete_h, only: aphelie, emin_turb, lmixmin, obliquit, & |
---|
| 26 | peri_day, periheli, year_day |
---|
| 27 | use comcstfi_h, only: g, mugaz, omeg, rad, rcp |
---|
| 28 | use time_phylmdz_mod, only: daysec |
---|
[2896] | 29 | use comslope_mod, ONLY: nslope |
---|
[3142] | 30 | USE paleoclimate_mod, ONLY: paleoclimate, h2o_ice_depth, lag_co2_ice |
---|
| 31 | |
---|
[1130] | 32 | implicit none |
---|
| 33 | |
---|
| 34 | character(len=*), intent(in) :: filename |
---|
| 35 | real,intent(in) :: lonfi(ngrid) |
---|
| 36 | real,intent(in) :: latfi(ngrid) |
---|
| 37 | integer,intent(in) :: nsoil |
---|
| 38 | integer,intent(in) :: ngrid |
---|
| 39 | integer,intent(in) :: nlay |
---|
| 40 | integer,intent(in) :: nq |
---|
| 41 | real,intent(in) :: phystep |
---|
| 42 | real,intent(in) :: day_ini |
---|
| 43 | real,intent(in) :: time |
---|
| 44 | real,intent(in) :: airefi(ngrid) |
---|
| 45 | real,intent(in) :: alb(ngrid) |
---|
[2942] | 46 | real,intent(in) :: ith(ngrid,nsoil) ! thermal inertia for present day |
---|
[2896] | 47 | real, intent(in) :: def_slope(nslope+1) !boundaries for bining of the slopes |
---|
| 48 | real, intent(in) :: subslope_dist(ngrid,nslope) !undermesh statistics |
---|
[1974] | 49 | |
---|
[1130] | 50 | real :: tab_cntrl(length) ! nb "length=100" defined in iostart module |
---|
[2884] | 51 | integer :: ig |
---|
| 52 | real :: watercaptag_tmp(ngrid) |
---|
[2994] | 53 | |
---|
[1130] | 54 | ! Create physics start file |
---|
| 55 | call open_restartphy(filename) |
---|
| 56 | |
---|
| 57 | ! Build tab_cntrl(:) array |
---|
| 58 | tab_cntrl(:)=0.0 |
---|
| 59 | !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 60 | ! Fill control array tab_cntrl(:) with parameters for this run |
---|
| 61 | !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 62 | ! Informations on the physics grid |
---|
| 63 | tab_cntrl(1) = float(klon_glo) ! total number of nodes on physics grid |
---|
| 64 | tab_cntrl(2) = float(nlay) ! number of atmospheric layers |
---|
| 65 | tab_cntrl(3) = day_ini + int(time) ! initial day |
---|
| 66 | tab_cntrl(4) = time -int(time) ! initial time of day |
---|
| 67 | |
---|
| 68 | ! Informations about Mars, used by dynamics and physics |
---|
| 69 | tab_cntrl(5) = rad ! radius of Mars (m) ~3397200 |
---|
| 70 | tab_cntrl(6) = omeg ! rotation rate (rad.s-1) |
---|
| 71 | tab_cntrl(7) = g ! gravity (m.s-2) ~3.72 |
---|
| 72 | tab_cntrl(8) = mugaz ! Molar mass of the atmosphere (g.mol-1) ~43.49 |
---|
| 73 | tab_cntrl(9) = rcp ! = r/cp ~0.256793 (=kappa dans dynamique) |
---|
| 74 | tab_cntrl(10) = daysec ! length of a sol (s) ~88775 |
---|
| 75 | |
---|
| 76 | tab_cntrl(11) = phystep ! time step in the physics |
---|
| 77 | tab_cntrl(12) = 0. |
---|
| 78 | tab_cntrl(13) = 0. |
---|
| 79 | |
---|
| 80 | ! Informations about Mars, only for physics |
---|
| 81 | tab_cntrl(14) = year_day ! length of year (sols) ~668.6 |
---|
| 82 | tab_cntrl(15) = periheli ! min. Sun-Mars distance (Mkm) ~206.66 |
---|
| 83 | tab_cntrl(16) = aphelie ! max. SUn-Mars distance (Mkm) ~249.22 |
---|
| 84 | tab_cntrl(17) = peri_day ! date of perihelion (sols since N. spring) |
---|
| 85 | tab_cntrl(18) = obliquit ! Obliquity of the planet (deg) ~23.98 |
---|
| 86 | |
---|
| 87 | ! Boundary layer and turbulence |
---|
| 88 | tab_cntrl(19) = z0_default ! default surface roughness (m) ~0.01 |
---|
| 89 | tab_cntrl(20) = lmixmin ! mixing length ~100 |
---|
| 90 | tab_cntrl(21) = emin_turb ! minimal energy ~1.e-8 |
---|
| 91 | |
---|
| 92 | ! Optical properties of polar caps and ground emissivity |
---|
| 93 | tab_cntrl(22) = albedice(1) ! Albedo of northern cap ~0.5 |
---|
| 94 | tab_cntrl(23) = albedice(2) ! Albedo of southern cap ~0.5 |
---|
| 95 | tab_cntrl(24) = emisice(1) ! Emissivity of northern cap ~0.95 |
---|
| 96 | tab_cntrl(25) = emisice(2) ! Emissivity of southern cap ~0.95 |
---|
| 97 | tab_cntrl(26) = emissiv ! Emissivity of martian soil ~.95 |
---|
| 98 | tab_cntrl(31) = iceradius(1) ! mean scat radius of CO2 snow (north) |
---|
| 99 | tab_cntrl(32) = iceradius(2) ! mean scat radius of CO2 snow (south) |
---|
| 100 | tab_cntrl(33) = dtemisice(1) ! time scale for snow metamorphism (north) |
---|
| 101 | tab_cntrl(34) = dtemisice(2) ! time scale for snow metamorphism (south) |
---|
| 102 | |
---|
| 103 | ! dust aerosol properties |
---|
| 104 | tab_cntrl(27) = tauvis ! mean visible optical depth |
---|
| 105 | |
---|
| 106 | ! Soil properties: |
---|
| 107 | tab_cntrl(35) = volcapa ! soil volumetric heat capacity |
---|
| 108 | |
---|
| 109 | ! Write the controle array |
---|
| 110 | call put_var("controle","Control parameters",tab_cntrl) |
---|
| 111 | |
---|
| 112 | ! Write the mid-layer depths |
---|
| 113 | call put_var("soildepth","Soil mid-layer depth",mlayer) |
---|
| 114 | |
---|
| 115 | ! Write longitudes |
---|
| 116 | call put_field("longitude","Longitudes of physics grid",lonfi) |
---|
| 117 | |
---|
| 118 | ! Write latitudes |
---|
| 119 | call put_field("latitude","Latitudes of physics grid",latfi) |
---|
| 120 | |
---|
| 121 | ! Write mesh areas |
---|
[1541] | 122 | call put_field("area","Mesh area",cell_area) |
---|
[1130] | 123 | |
---|
| 124 | ! Write surface geopotential |
---|
| 125 | call put_field("phisfi","Geopotential at the surface",phisfi) |
---|
| 126 | |
---|
| 127 | ! Write surface albedo |
---|
[1221] | 128 | call put_field("albedodat","Albedo of bare ground",alb) |
---|
[1130] | 129 | |
---|
| 130 | ! Subgrid topogaphy variables |
---|
| 131 | call put_field("ZMEA","Relief: mean relief",zmea) |
---|
| 132 | call put_field("ZSTD","Relief: standard deviation",zstd) |
---|
| 133 | call put_field("ZSIG","Relief: sigma parameter",zsig) |
---|
| 134 | call put_field("ZGAM","Relief: gamma parameter",zgam) |
---|
| 135 | call put_field("ZTHE","Relief: theta parameter",zthe) |
---|
[2079] | 136 | call put_field("hmons","Relief: hmons parameter (summit - base)",hmons) |
---|
| 137 | call put_field("summit","Relief: altitude from the aeroid of the summit of the highest subgrid topography",summit) |
---|
| 138 | call put_field("base","Relief: altitude from the aeroid of the base of the highest subgrid topography",base) |
---|
[1974] | 139 | |
---|
[1130] | 140 | ! Soil thermal inertia |
---|
[2942] | 141 | call put_field("inertiedat","Soil thermal inertia - present day",ith) |
---|
[1130] | 142 | |
---|
| 143 | ! Surface roughness length |
---|
| 144 | call put_field("z0","Surface roughness length",z0) |
---|
[2884] | 145 | |
---|
[3142] | 146 | ! Water cap |
---|
| 147 | watercaptag_tmp = 0 |
---|
| 148 | where (watercaptag) watercaptag_tmp = 1 |
---|
[2884] | 149 | call put_field("watercaptag","Infinite water reservoir",watercaptag_tmp) |
---|
| 150 | |
---|
[2896] | 151 | ! Sub grid scale slope parametrization |
---|
| 152 | call put_var("def_slope","slope criterium stages",def_slope) |
---|
| 153 | call put_field("subslope_dist","under mesh slope distribution",subslope_dist) |
---|
| 154 | |
---|
[2994] | 155 | ! Paleoclimate outputs |
---|
[3142] | 156 | if (paleoclimate) then |
---|
[3098] | 157 | call put_field("h2o_ice_depth","Depth to the fisrt H2O ice",h2o_ice_depth) |
---|
[2994] | 158 | call put_field("lag_co2_ice","Depth of the CO2 lags",lag_co2_ice) |
---|
| 159 | endif |
---|
[3142] | 160 | |
---|
[1130] | 161 | ! Close file |
---|
| 162 | call close_restartphy |
---|
| 163 | |
---|
| 164 | end subroutine physdem0 |
---|
| 165 | |
---|
[3142] | 166 | !======================================================================= |
---|
| 167 | |
---|
[3113] | 168 | subroutine physdem1(filename,nsoil,ngrid,nlay,nq,nqsoil, & |
---|
[2942] | 169 | phystep,time,tsurf,tsoil,inertiesoil, & |
---|
[3113] | 170 | albedo,emis,q2,qsurf,qsoil,& |
---|
[1944] | 171 | tauscaling,totcloudfrac,wstar, & |
---|
[3130] | 172 | watercap,perennial_co2ice) |
---|
[1130] | 173 | ! write time-dependent variable to restart file |
---|
| 174 | use iostart, only : open_restartphy, close_restartphy, & |
---|
| 175 | put_var, put_field |
---|
[1621] | 176 | use tracer_mod, only: noms ! tracer names |
---|
[2220] | 177 | use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd |
---|
[2265] | 178 | use compute_dtau_mod, only: dtau |
---|
[2417] | 179 | use dust_rad_adjust_mod, only: dust_rad_adjust_prev,dust_rad_adjust_next |
---|
| 180 | use dust_param_mod, only: dustscaling_mode |
---|
[3113] | 181 | use comsoil_h,only: flux_geo,adsorption_soil,igcm_h2o_vap_soil, & |
---|
| 182 | igcm_h2o_ice_soil,igcm_h2o_vap_ads |
---|
[2999] | 183 | use comslope_mod, only: nslope |
---|
| 184 | use paleoclimate_mod, only: paleoclimate |
---|
[1130] | 185 | implicit none |
---|
[1922] | 186 | |
---|
| 187 | include "callkeys.h" |
---|
| 188 | |
---|
[1130] | 189 | character(len=*),intent(in) :: filename |
---|
| 190 | integer,intent(in) :: nsoil |
---|
| 191 | integer,intent(in) :: ngrid |
---|
| 192 | integer,intent(in) :: nlay |
---|
| 193 | integer,intent(in) :: nq |
---|
[3113] | 194 | integer,intent(in) :: nqsoil |
---|
[1130] | 195 | real,intent(in) :: phystep |
---|
| 196 | real,intent(in) :: time |
---|
[2913] | 197 | real,intent(in) :: tsurf(ngrid,nslope) |
---|
| 198 | real,intent(in) :: tsoil(ngrid,nsoil,nslope) |
---|
[2942] | 199 | real,intent(in) :: inertiesoil(ngrid,nsoil,nslope) |
---|
[2913] | 200 | real,intent(in) :: albedo(ngrid,2,nslope) |
---|
| 201 | real,intent(in) :: emis(ngrid,nslope) |
---|
[1130] | 202 | real,intent(in) :: q2(ngrid,nlay+1) |
---|
[2913] | 203 | real,intent(in) :: qsurf(ngrid,nq,nslope) |
---|
[3113] | 204 | real,intent(in) :: qsoil(ngrid,nsoil,nqsoil,nslope) |
---|
[1208] | 205 | real,intent(in) :: tauscaling(ngrid) |
---|
[1922] | 206 | real,intent(in) :: totcloudfrac(ngrid) |
---|
[1944] | 207 | real,intent(in) :: wstar(ngrid) |
---|
[2913] | 208 | real,intent(in) :: watercap(ngrid,nslope) |
---|
[3130] | 209 | real,intent(in) :: perennial_co2ice(ngrid,nslope) |
---|
[2999] | 210 | |
---|
[1130] | 211 | integer :: iq |
---|
| 212 | character(len=30) :: txt ! to store some text |
---|
| 213 | ! indexes of water vapour & water ice tracers (if any): |
---|
| 214 | integer :: i_h2o_vap=0 |
---|
| 215 | integer :: i_h2o_ice=0 |
---|
[2312] | 216 | integer :: i_hdo_vap=0 |
---|
| 217 | integer :: i_hdo_ice=0 |
---|
[1130] | 218 | |
---|
| 219 | |
---|
| 220 | ! Open file |
---|
| 221 | call open_restartphy(filename) |
---|
| 222 | |
---|
| 223 | ! First variable to write must be "Time", in order to correctly |
---|
| 224 | ! set time counter in file |
---|
| 225 | call put_var("Time","Temps de simulation",time) |
---|
[2260] | 226 | |
---|
| 227 | ! Water ice layer |
---|
| 228 | call put_field("watercap","H2O ice cover",watercap,time) |
---|
[2999] | 229 | |
---|
[3130] | 230 | ! Perennial CO2 ice layer |
---|
[3142] | 231 | if (paleoclimate) call put_field("perennial_co2ice","CO2 ice cover",perennial_co2ice,time) |
---|
[3051] | 232 | |
---|
[1130] | 233 | ! Surface temperature |
---|
| 234 | call put_field("tsurf","Surface temperature",tsurf,time) |
---|
[2942] | 235 | |
---|
| 236 | ! Soil temperature |
---|
| 237 | call put_field("inertiesoil","Soil thermal inertia",inertiesoil,time) |
---|
[1130] | 238 | |
---|
| 239 | ! Soil temperature |
---|
| 240 | call put_field("tsoil","Soil temperature",tsoil,time) |
---|
| 241 | |
---|
[1944] | 242 | ! Albedo of the surface |
---|
[2913] | 243 | call put_field("albedo","Surface albedo",albedo(:,1,:),time) |
---|
[1944] | 244 | |
---|
[1130] | 245 | ! Emissivity of the surface |
---|
| 246 | call put_field("emis","Surface emissivity",emis,time) |
---|
| 247 | |
---|
| 248 | ! Planetary Boundary Layer |
---|
| 249 | call put_field("q2","pbl wind variance",q2,time) |
---|
[1711] | 250 | |
---|
| 251 | ! Sub-grid cloud fraction |
---|
| 252 | call put_field("totcloudfrac","Total cloud fraction",totcloudfrac,time) |
---|
| 253 | |
---|
[1208] | 254 | ! Dust conversion factor |
---|
| 255 | ! Only to be read by newstart to convert to actual dust values |
---|
| 256 | ! Or by any user who wants to reconstruct dust, opacity from the start files. |
---|
| 257 | call put_field("tauscaling","dust conversion factor",tauscaling,time) |
---|
| 258 | |
---|
[2417] | 259 | ! Radiative scaling coefficients |
---|
| 260 | if (dustscaling_mode==2) then |
---|
| 261 | call put_field("dust_rad_adjust_prev", & |
---|
| 262 | "radiative dust adjustement factor prev. sol", & |
---|
| 263 | dust_rad_adjust_prev,time) |
---|
| 264 | call put_field("dust_rad_adjust_next", & |
---|
| 265 | "radiative dust adjustement factor next sol", & |
---|
| 266 | dust_rad_adjust_next,time) |
---|
| 267 | endif |
---|
| 268 | |
---|
[2265] | 269 | if (dustinjection.gt.0) then |
---|
| 270 | call put_field("dtau","dust opacity difference between GCM and scenario",& |
---|
| 271 | dtau,time) |
---|
| 272 | endif |
---|
| 273 | |
---|
[1944] | 274 | if (calltherm) then |
---|
| 275 | call put_field("wstar","Max vertical velocity in thermals",wstar,time) |
---|
| 276 | endif |
---|
| 277 | |
---|
[1130] | 278 | ! Tracers on the surface |
---|
| 279 | ! preliminary stuff: look for water vapour & water ice tracers (if any) |
---|
| 280 | do iq=1,nq |
---|
[1621] | 281 | if (noms(iq).eq."h2o_vap") then |
---|
[1130] | 282 | i_h2o_vap=iq |
---|
| 283 | endif |
---|
[1621] | 284 | if (noms(iq).eq."h2o_ice") then |
---|
[1130] | 285 | i_h2o_ice=iq |
---|
| 286 | endif |
---|
[2312] | 287 | |
---|
| 288 | ! look for HDO vapour & HDO ice tracers (if any) |
---|
| 289 | if (noms(iq).eq."hdo_vap") then |
---|
| 290 | i_hdo_vap=iq |
---|
| 291 | endif |
---|
| 292 | if (noms(iq).eq."hdo_ice") then |
---|
| 293 | i_hdo_ice=iq |
---|
| 294 | endif |
---|
[1130] | 295 | enddo |
---|
[2312] | 296 | |
---|
[1130] | 297 | |
---|
| 298 | if (nq.gt.0) then |
---|
| 299 | do iq=1,nq |
---|
[1621] | 300 | txt=noms(iq) |
---|
[1130] | 301 | ! Exception: there is no water vapour surface tracer |
---|
| 302 | if (txt.eq."h2o_vap") then |
---|
| 303 | write(*,*)"physdem1: skipping water vapour tracer" |
---|
| 304 | if (i_h2o_ice.eq.i_h2o_vap) then |
---|
| 305 | ! then there is no "water ice" tracer; but still |
---|
| 306 | ! there is some water ice on the surface |
---|
| 307 | write(*,*)" writing water ice instead" |
---|
| 308 | txt="h2o_ice" |
---|
| 309 | else |
---|
| 310 | ! there is a "water ice" tracer which has been / will be |
---|
| 311 | ! delt with in due time |
---|
| 312 | cycle |
---|
| 313 | endif ! of if (igcm_h2o_ice.eq.igcm_h2o_vap) |
---|
| 314 | endif ! of if (txt.eq."h2o_vap") |
---|
[2312] | 315 | |
---|
| 316 | if (txt.eq."hdo_vap") then |
---|
| 317 | write(*,*)"physdem1: skipping HDO vapour tracer" |
---|
| 318 | if (i_hdo_ice.eq.i_hdo_vap) then |
---|
| 319 | ! then there is no "water ice" tracer; but still |
---|
| 320 | ! there is some water ice on the surface |
---|
| 321 | write(*,*)" writing HDO ice instead" |
---|
| 322 | txt="hdo_ice" |
---|
| 323 | else |
---|
| 324 | ! there is a "water ice" tracer which has been / will be |
---|
| 325 | ! delt with in due time |
---|
| 326 | cycle |
---|
| 327 | endif ! of if (igcm_hdo_ice.eq.igcm_hdo_vap) |
---|
| 328 | endif ! of if (txt.eq."hdo_vap") |
---|
| 329 | |
---|
[2826] | 330 | ! co2_ice has been added to qsurf(:,igcm_co2) in co2condens4micro |
---|
[2494] | 331 | if (txt.eq."co2_ice") then |
---|
| 332 | write(*,*)"physdem1: skipping co2_ice tracer" |
---|
| 333 | cycle |
---|
| 334 | end if |
---|
| 335 | |
---|
[2913] | 336 | call put_field(trim(txt),"tracer on surface",qsurf(:,iq,:),time) |
---|
[1130] | 337 | enddo |
---|
| 338 | endif |
---|
[2562] | 339 | |
---|
[2220] | 340 | ! Non-orographic gavity waves |
---|
| 341 | if (calllott_nonoro) then |
---|
| 342 | call put_field("du_nonoro_gwd","Zonal wind tendency due to GW",du_nonoro_gwd,time) |
---|
| 343 | call put_field("dv_nonoro_gwd","Meridional wind tendency due to GW",dv_nonoro_gwd,time) |
---|
| 344 | endif |
---|
[2494] | 345 | |
---|
[2887] | 346 | ! Geothermal Flux |
---|
| 347 | call put_field('flux_geo','Geothermal flux',flux_geo,time) |
---|
[3113] | 348 | |
---|
| 349 | ! Adsorption |
---|
| 350 | if (adsorption_soil) then |
---|
| 351 | call put_field("h2o_vap_soil","subsurface water vapour", & |
---|
| 352 | qsoil(:,:,igcm_h2o_vap_soil,:), time) |
---|
| 353 | call put_field("h2o_ice_soil","subsurface water ice", & |
---|
| 354 | qsoil(:,:,igcm_h2o_ice_soil,:), time) |
---|
| 355 | call put_field("h2o_vap_ads", "adsorbed water", & |
---|
| 356 | qsoil(:,:,igcm_h2o_vap_ads,:), time) |
---|
| 357 | endif |
---|
| 358 | |
---|
[1130] | 359 | ! Close file |
---|
| 360 | call close_restartphy |
---|
| 361 | |
---|
| 362 | end subroutine physdem1 |
---|
| 363 | |
---|
| 364 | end module phyredem |
---|