[1130] | 1 | ! |
---|
| 2 | ! $Id: $ |
---|
| 3 | ! |
---|
| 4 | module phyredem |
---|
| 5 | |
---|
| 6 | implicit none |
---|
| 7 | |
---|
| 8 | contains |
---|
| 9 | |
---|
| 10 | subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq, & |
---|
| 11 | phystep,day_ini,time,airefi, & |
---|
| 12 | alb,ith,pzmea,pzstd,pzsig,pzgam,pzthe) |
---|
| 13 | ! create physics restart file and write time-independent variables |
---|
| 14 | use comsoil_h, only: inertiedat, volcapa, mlayer |
---|
[1543] | 15 | use geometry_mod, only: cell_area |
---|
[1221] | 16 | use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, & |
---|
[1130] | 17 | z0_default, albedice, emisice, emissiv, & |
---|
| 18 | iceradius, dtemisice, phisfi, z0 |
---|
[1246] | 19 | use dimradmars_mod, only: tauvis |
---|
[1130] | 20 | use iostart, only : open_restartphy, close_restartphy, & |
---|
| 21 | put_var, put_field, length |
---|
| 22 | use mod_grid_phy_lmdz, only : klon_glo |
---|
[1524] | 23 | use planete_h, only: aphelie, emin_turb, lmixmin, obliquit, & |
---|
| 24 | peri_day, periheli, year_day |
---|
| 25 | use comcstfi_h, only: g, mugaz, omeg, rad, rcp |
---|
| 26 | use time_phylmdz_mod, only: daysec |
---|
[1130] | 27 | |
---|
| 28 | implicit none |
---|
| 29 | |
---|
| 30 | character(len=*), intent(in) :: filename |
---|
| 31 | real,intent(in) :: lonfi(ngrid) |
---|
| 32 | real,intent(in) :: latfi(ngrid) |
---|
| 33 | integer,intent(in) :: nsoil |
---|
| 34 | integer,intent(in) :: ngrid |
---|
| 35 | integer,intent(in) :: nlay |
---|
| 36 | integer,intent(in) :: nq |
---|
| 37 | real,intent(in) :: phystep |
---|
| 38 | real,intent(in) :: day_ini |
---|
| 39 | real,intent(in) :: time |
---|
| 40 | real,intent(in) :: airefi(ngrid) |
---|
| 41 | real,intent(in) :: alb(ngrid) |
---|
| 42 | real,intent(in) :: ith(ngrid,nsoil) |
---|
| 43 | real,intent(in) :: pzmea(ngrid) |
---|
| 44 | real,intent(in) :: pzstd(ngrid) |
---|
| 45 | real,intent(in) :: pzsig(ngrid) |
---|
| 46 | real,intent(in) :: pzgam(ngrid) |
---|
| 47 | real,intent(in) :: pzthe(ngrid) |
---|
| 48 | |
---|
| 49 | real :: tab_cntrl(length) ! nb "length=100" defined in iostart module |
---|
| 50 | |
---|
| 51 | ! Create physics start file |
---|
| 52 | call open_restartphy(filename) |
---|
| 53 | |
---|
| 54 | ! Build tab_cntrl(:) array |
---|
| 55 | tab_cntrl(:)=0.0 |
---|
| 56 | !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 57 | ! Fill control array tab_cntrl(:) with parameters for this run |
---|
| 58 | !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 59 | ! Informations on the physics grid |
---|
| 60 | tab_cntrl(1) = float(klon_glo) ! total number of nodes on physics grid |
---|
| 61 | tab_cntrl(2) = float(nlay) ! number of atmospheric layers |
---|
| 62 | tab_cntrl(3) = day_ini + int(time) ! initial day |
---|
| 63 | tab_cntrl(4) = time -int(time) ! initial time of day |
---|
| 64 | |
---|
| 65 | ! Informations about Mars, used by dynamics and physics |
---|
| 66 | tab_cntrl(5) = rad ! radius of Mars (m) ~3397200 |
---|
| 67 | tab_cntrl(6) = omeg ! rotation rate (rad.s-1) |
---|
| 68 | tab_cntrl(7) = g ! gravity (m.s-2) ~3.72 |
---|
| 69 | tab_cntrl(8) = mugaz ! Molar mass of the atmosphere (g.mol-1) ~43.49 |
---|
| 70 | tab_cntrl(9) = rcp ! = r/cp ~0.256793 (=kappa dans dynamique) |
---|
| 71 | tab_cntrl(10) = daysec ! length of a sol (s) ~88775 |
---|
| 72 | |
---|
| 73 | tab_cntrl(11) = phystep ! time step in the physics |
---|
| 74 | tab_cntrl(12) = 0. |
---|
| 75 | tab_cntrl(13) = 0. |
---|
| 76 | |
---|
| 77 | ! Informations about Mars, only for physics |
---|
| 78 | tab_cntrl(14) = year_day ! length of year (sols) ~668.6 |
---|
| 79 | tab_cntrl(15) = periheli ! min. Sun-Mars distance (Mkm) ~206.66 |
---|
| 80 | tab_cntrl(16) = aphelie ! max. SUn-Mars distance (Mkm) ~249.22 |
---|
| 81 | tab_cntrl(17) = peri_day ! date of perihelion (sols since N. spring) |
---|
| 82 | tab_cntrl(18) = obliquit ! Obliquity of the planet (deg) ~23.98 |
---|
| 83 | |
---|
| 84 | ! Boundary layer and turbulence |
---|
| 85 | tab_cntrl(19) = z0_default ! default surface roughness (m) ~0.01 |
---|
| 86 | tab_cntrl(20) = lmixmin ! mixing length ~100 |
---|
| 87 | tab_cntrl(21) = emin_turb ! minimal energy ~1.e-8 |
---|
| 88 | |
---|
| 89 | ! Optical properties of polar caps and ground emissivity |
---|
| 90 | tab_cntrl(22) = albedice(1) ! Albedo of northern cap ~0.5 |
---|
| 91 | tab_cntrl(23) = albedice(2) ! Albedo of southern cap ~0.5 |
---|
| 92 | tab_cntrl(24) = emisice(1) ! Emissivity of northern cap ~0.95 |
---|
| 93 | tab_cntrl(25) = emisice(2) ! Emissivity of southern cap ~0.95 |
---|
| 94 | tab_cntrl(26) = emissiv ! Emissivity of martian soil ~.95 |
---|
| 95 | tab_cntrl(31) = iceradius(1) ! mean scat radius of CO2 snow (north) |
---|
| 96 | tab_cntrl(32) = iceradius(2) ! mean scat radius of CO2 snow (south) |
---|
| 97 | tab_cntrl(33) = dtemisice(1) ! time scale for snow metamorphism (north) |
---|
| 98 | tab_cntrl(34) = dtemisice(2) ! time scale for snow metamorphism (south) |
---|
| 99 | |
---|
| 100 | ! dust aerosol properties |
---|
| 101 | tab_cntrl(27) = tauvis ! mean visible optical depth |
---|
| 102 | |
---|
| 103 | ! Soil properties: |
---|
| 104 | tab_cntrl(35) = volcapa ! soil volumetric heat capacity |
---|
| 105 | |
---|
| 106 | ! Write the controle array |
---|
| 107 | call put_var("controle","Control parameters",tab_cntrl) |
---|
| 108 | |
---|
| 109 | ! Write the mid-layer depths |
---|
| 110 | call put_var("soildepth","Soil mid-layer depth",mlayer) |
---|
| 111 | |
---|
| 112 | ! Write longitudes |
---|
| 113 | call put_field("longitude","Longitudes of physics grid",lonfi) |
---|
| 114 | |
---|
| 115 | ! Write latitudes |
---|
| 116 | call put_field("latitude","Latitudes of physics grid",latfi) |
---|
| 117 | |
---|
| 118 | ! Write mesh areas |
---|
[1541] | 119 | call put_field("area","Mesh area",cell_area) |
---|
[1130] | 120 | |
---|
| 121 | ! Write surface geopotential |
---|
| 122 | call put_field("phisfi","Geopotential at the surface",phisfi) |
---|
| 123 | |
---|
| 124 | ! Write surface albedo |
---|
[1221] | 125 | call put_field("albedodat","Albedo of bare ground",alb) |
---|
[1130] | 126 | |
---|
| 127 | ! Subgrid topogaphy variables |
---|
| 128 | call put_field("ZMEA","Relief: mean relief",zmea) |
---|
| 129 | call put_field("ZSTD","Relief: standard deviation",zstd) |
---|
| 130 | call put_field("ZSIG","Relief: sigma parameter",zsig) |
---|
| 131 | call put_field("ZGAM","Relief: gamma parameter",zgam) |
---|
| 132 | call put_field("ZTHE","Relief: theta parameter",zthe) |
---|
| 133 | |
---|
| 134 | ! Soil thermal inertia |
---|
[1210] | 135 | call put_field("inertiedat","Soil thermal inertia",ith) |
---|
[1130] | 136 | |
---|
| 137 | ! Surface roughness length |
---|
| 138 | call put_field("z0","Surface roughness length",z0) |
---|
| 139 | |
---|
| 140 | ! Close file |
---|
| 141 | call close_restartphy |
---|
| 142 | |
---|
| 143 | end subroutine physdem0 |
---|
| 144 | |
---|
| 145 | subroutine physdem1(filename,nsoil,ngrid,nlay,nq, & |
---|
[1208] | 146 | phystep,time,tsurf,tsoil,co2ice,emis,q2,qsurf,& |
---|
[1711] | 147 | tauscaling,totcloudfrac) |
---|
[1130] | 148 | ! write time-dependent variable to restart file |
---|
| 149 | use iostart, only : open_restartphy, close_restartphy, & |
---|
| 150 | put_var, put_field |
---|
[1621] | 151 | use tracer_mod, only: noms ! tracer names |
---|
[1130] | 152 | implicit none |
---|
| 153 | character(len=*),intent(in) :: filename |
---|
| 154 | integer,intent(in) :: nsoil |
---|
| 155 | integer,intent(in) :: ngrid |
---|
| 156 | integer,intent(in) :: nlay |
---|
| 157 | integer,intent(in) :: nq |
---|
| 158 | real,intent(in) :: phystep |
---|
| 159 | real,intent(in) :: time |
---|
| 160 | real,intent(in) :: tsurf(ngrid) |
---|
| 161 | real,intent(in) :: tsoil(ngrid,nsoil) |
---|
| 162 | real,intent(in) :: co2ice(ngrid) |
---|
| 163 | real,intent(in) :: emis(ngrid) |
---|
| 164 | real,intent(in) :: q2(ngrid,nlay+1) |
---|
| 165 | real,intent(in) :: qsurf(ngrid,nq) |
---|
[1208] | 166 | real,intent(in) :: tauscaling(ngrid) |
---|
[1711] | 167 | real, intent(in) :: totcloudfrac(ngrid) |
---|
[1130] | 168 | |
---|
| 169 | integer :: iq |
---|
| 170 | character(len=30) :: txt ! to store some text |
---|
| 171 | ! indexes of water vapour & water ice tracers (if any): |
---|
| 172 | integer :: i_h2o_vap=0 |
---|
| 173 | integer :: i_h2o_ice=0 |
---|
| 174 | |
---|
| 175 | |
---|
| 176 | ! Open file |
---|
| 177 | call open_restartphy(filename) |
---|
| 178 | |
---|
| 179 | ! First variable to write must be "Time", in order to correctly |
---|
| 180 | ! set time counter in file |
---|
| 181 | call put_var("Time","Temps de simulation",time) |
---|
| 182 | |
---|
| 183 | ! CO2 ice layer |
---|
| 184 | call put_field("co2ice","CO2 ice cover",co2ice,time) |
---|
| 185 | |
---|
| 186 | ! Surface temperature |
---|
| 187 | call put_field("tsurf","Surface temperature",tsurf,time) |
---|
| 188 | |
---|
| 189 | ! Soil temperature |
---|
| 190 | call put_field("tsoil","Soil temperature",tsoil,time) |
---|
| 191 | |
---|
| 192 | ! Emissivity of the surface |
---|
| 193 | call put_field("emis","Surface emissivity",emis,time) |
---|
| 194 | |
---|
| 195 | ! Planetary Boundary Layer |
---|
| 196 | call put_field("q2","pbl wind variance",q2,time) |
---|
[1711] | 197 | |
---|
| 198 | ! Sub-grid cloud fraction |
---|
| 199 | call put_field("totcloudfrac","Total cloud fraction",totcloudfrac,time) |
---|
| 200 | |
---|
[1208] | 201 | ! Dust conversion factor |
---|
| 202 | ! Only to be read by newstart to convert to actual dust values |
---|
| 203 | ! Or by any user who wants to reconstruct dust, opacity from the start files. |
---|
| 204 | call put_field("tauscaling","dust conversion factor",tauscaling,time) |
---|
| 205 | |
---|
[1130] | 206 | ! Tracers on the surface |
---|
| 207 | ! preliminary stuff: look for water vapour & water ice tracers (if any) |
---|
| 208 | do iq=1,nq |
---|
[1621] | 209 | if (noms(iq).eq."h2o_vap") then |
---|
[1130] | 210 | i_h2o_vap=iq |
---|
| 211 | endif |
---|
[1621] | 212 | if (noms(iq).eq."h2o_ice") then |
---|
[1130] | 213 | i_h2o_ice=iq |
---|
| 214 | endif |
---|
| 215 | enddo |
---|
| 216 | |
---|
| 217 | if (nq.gt.0) then |
---|
| 218 | do iq=1,nq |
---|
[1621] | 219 | txt=noms(iq) |
---|
[1130] | 220 | ! Exception: there is no water vapour surface tracer |
---|
| 221 | if (txt.eq."h2o_vap") then |
---|
| 222 | write(*,*)"physdem1: skipping water vapour tracer" |
---|
| 223 | if (i_h2o_ice.eq.i_h2o_vap) then |
---|
| 224 | ! then there is no "water ice" tracer; but still |
---|
| 225 | ! there is some water ice on the surface |
---|
| 226 | write(*,*)" writing water ice instead" |
---|
| 227 | txt="h2o_ice" |
---|
| 228 | else |
---|
| 229 | ! there is a "water ice" tracer which has been / will be |
---|
| 230 | ! delt with in due time |
---|
| 231 | cycle |
---|
| 232 | endif ! of if (igcm_h2o_ice.eq.igcm_h2o_vap) |
---|
| 233 | endif ! of if (txt.eq."h2o_vap") |
---|
| 234 | call put_field(trim(txt),"tracer on surface",qsurf(:,iq),time) |
---|
| 235 | enddo |
---|
| 236 | endif |
---|
| 237 | |
---|
| 238 | ! Close file |
---|
| 239 | call close_restartphy |
---|
| 240 | |
---|
| 241 | end subroutine physdem1 |
---|
| 242 | |
---|
| 243 | end module phyredem |
---|