| 1 | C====================================================================== |
|---|
| 2 | PROGRAM newstart |
|---|
| 3 | c======================================================================= |
|---|
| 4 | c |
|---|
| 5 | c |
|---|
| 6 | c Auteur: Christophe Hourdin/Francois Forget/Yann Wanherdrick |
|---|
| 7 | c ------ |
|---|
| 8 | c Derniere modif : 12/03 |
|---|
| 9 | c |
|---|
| 10 | c |
|---|
| 11 | c Objet: Create or modify the initial state for the LMD Mars GCM |
|---|
| 12 | c ----- (fichiers NetCDF start et startfi) |
|---|
| 13 | c |
|---|
| 14 | c |
|---|
| 15 | c======================================================================= |
|---|
| 16 | |
|---|
| 17 | use ioipsl_getincom, only: getin |
|---|
| 18 | use infotrac, only: infotrac_init, nqtot, tname |
|---|
| 19 | use tracer_mod, only: noms, mmol, |
|---|
| 20 | & igcm_dust_number, igcm_dust_mass, |
|---|
| 21 | & igcm_ccn_number, igcm_ccn_mass, |
|---|
| 22 | & igcm_h2o_vap, igcm_h2o_ice, igcm_co2, |
|---|
| 23 | & igcm_n2, igcm_ar, igcm_o2, igcm_co |
|---|
| 24 | use surfdat_h, only: phisfi, z0, zmea, zstd, zsig, zgam, zthe, |
|---|
| 25 | & albedodat, z0_default, qsurf, tsurf, |
|---|
| 26 | & co2ice, emis |
|---|
| 27 | use comsoil_h, only: inertiedat, layer, mlayer, nsoilmx, tsoil |
|---|
| 28 | use control_mod, only: day_step, iphysiq, anneeref, planet_type |
|---|
| 29 | use phyredem, only: physdem0, physdem1 |
|---|
| 30 | use iostart, only: open_startphy |
|---|
| 31 | use comgeomphy, only: initcomgeomphy |
|---|
| 32 | ! use planete_h |
|---|
| 33 | use dimradmars_mod, only: tauscaling |
|---|
| 34 | use turb_mod, only: q2 |
|---|
| 35 | use comgeomfi_h, only: ini_fillgeom |
|---|
| 36 | use filtreg_mod, only: inifilr |
|---|
| 37 | USE comvert_mod, ONLY: ap,bp,pa,preff |
|---|
| 38 | USE comconst_mod, ONLY: lllm,daysec,dtphys,dtvr, |
|---|
| 39 | . cpp,kappa,rad,omeg,g,r,pi |
|---|
| 40 | USE serre_mod, ONLY: alphax |
|---|
| 41 | USE temps_mod, ONLY: day_ini,hour_ini |
|---|
| 42 | USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 |
|---|
| 43 | |
|---|
| 44 | implicit none |
|---|
| 45 | |
|---|
| 46 | #include "dimensions.h" |
|---|
| 47 | integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) |
|---|
| 48 | #include "paramet.h" |
|---|
| 49 | #include "comgeom2.h" |
|---|
| 50 | #include "comdissnew.h" |
|---|
| 51 | #include "clesph0.h" |
|---|
| 52 | #include "netcdf.inc" |
|---|
| 53 | c======================================================================= |
|---|
| 54 | c Declarations |
|---|
| 55 | c======================================================================= |
|---|
| 56 | |
|---|
| 57 | c Variables dimension du fichier "start_archive" |
|---|
| 58 | c------------------------------------ |
|---|
| 59 | CHARACTER relief*3 |
|---|
| 60 | |
|---|
| 61 | c et autres: |
|---|
| 62 | c---------- |
|---|
| 63 | |
|---|
| 64 | c Variables pour les lectures NetCDF des fichiers "start_archive" |
|---|
| 65 | c-------------------------------------------------- |
|---|
| 66 | INTEGER nid_dyn, nid_fi,nid,nvarid |
|---|
| 67 | INTEGER tab0 |
|---|
| 68 | |
|---|
| 69 | REAL date |
|---|
| 70 | REAL p_rad,p_omeg,p_g,p_mugaz,p_daysec |
|---|
| 71 | |
|---|
| 72 | c Variable histoire |
|---|
| 73 | c------------------ |
|---|
| 74 | REAL vcov(iip1,jjm,llm),ucov(iip1,jjp1,llm) ! vents covariants |
|---|
| 75 | REAL phis(iip1,jjp1) |
|---|
| 76 | REAL,ALLOCATABLE :: q(:,:,:,:) ! champs advectes |
|---|
| 77 | |
|---|
| 78 | c autre variables dynamique nouvelle grille |
|---|
| 79 | c------------------------------------------ |
|---|
| 80 | REAL pks(iip1,jjp1) |
|---|
| 81 | REAL w(iip1,jjp1,llm+1) |
|---|
| 82 | REAL pbaru(ip1jmp1,llm),pbarv(ip1jm,llm) |
|---|
| 83 | ! REAL dv(ip1jm,llm),du(ip1jmp1,llm) |
|---|
| 84 | ! REAL dh(ip1jmp1,llm),dp(ip1jmp1) |
|---|
| 85 | REAL phi(iip1,jjp1,llm) |
|---|
| 86 | |
|---|
| 87 | integer klatdat,klongdat |
|---|
| 88 | PARAMETER (klatdat=180,klongdat=360) |
|---|
| 89 | |
|---|
| 90 | c Physique sur grille scalaire |
|---|
| 91 | c---------------------------- |
|---|
| 92 | real zmeaS(iip1,jjp1),zstdS(iip1,jjp1) |
|---|
| 93 | real zsigS(iip1,jjp1),zgamS(iip1,jjp1),ztheS(iip1,jjp1) |
|---|
| 94 | real z0S(iip1,jjp1) |
|---|
| 95 | |
|---|
| 96 | c variable physique |
|---|
| 97 | c------------------ |
|---|
| 98 | REAL tauscadyn(iip1,jjp1) ! dust conversion factor on the dynamics grid |
|---|
| 99 | real alb(iip1,jjp1),albfi(ngridmx) ! albedos |
|---|
| 100 | real ith(iip1,jjp1,nsoilmx),ithfi(ngridmx,nsoilmx) ! thermal inertia (3D) |
|---|
| 101 | real surfith(iip1,jjp1),surfithfi(ngridmx) ! surface thermal inertia (2D) |
|---|
| 102 | REAL latfi(ngridmx),lonfi(ngridmx),airefi(ngridmx) |
|---|
| 103 | |
|---|
| 104 | INTEGER i,j,l,isoil,ig,idum |
|---|
| 105 | real mugaz ! molar mass of the atmosphere |
|---|
| 106 | |
|---|
| 107 | integer ierr !, nbetat |
|---|
| 108 | |
|---|
| 109 | c Variables on the new grid along scalar points |
|---|
| 110 | c------------------------------------------------------ |
|---|
| 111 | ! REAL p(iip1,jjp1) |
|---|
| 112 | REAL t(iip1,jjp1,llm) |
|---|
| 113 | real phisold_newgrid(iip1,jjp1) |
|---|
| 114 | REAL :: teta(iip1, jjp1, llm) |
|---|
| 115 | REAL :: pk(iip1,jjp1,llm) |
|---|
| 116 | REAL :: pkf(iip1,jjp1,llm) |
|---|
| 117 | REAL :: ps(iip1, jjp1) |
|---|
| 118 | REAL :: masse(iip1,jjp1,llm) |
|---|
| 119 | REAL :: xpn,xps,xppn(iim),xpps(iim) |
|---|
| 120 | REAL :: p3d(iip1, jjp1, llm+1) |
|---|
| 121 | REAL :: beta(iip1,jjp1,llm) |
|---|
| 122 | ! REAL dteta(ip1jmp1,llm) |
|---|
| 123 | |
|---|
| 124 | c Variable de l'ancienne grille |
|---|
| 125 | c------------------------------ |
|---|
| 126 | real time |
|---|
| 127 | real tab_cntrl(100) |
|---|
| 128 | real tab_cntrl_bis(100) |
|---|
| 129 | |
|---|
| 130 | c variables diverses |
|---|
| 131 | c------------------- |
|---|
| 132 | real choix_1 ! ==0 : read start_archive file ; ==1: read start files |
|---|
| 133 | character*80 fichnom |
|---|
| 134 | integer Lmodif,iq |
|---|
| 135 | integer flagthermo, flagh2o |
|---|
| 136 | character modif*20 |
|---|
| 137 | real tsud,albsud,alb_bb,ith_bb,Tiso |
|---|
| 138 | real ptoto,pcap,patm,airetot,ptotn,patmn |
|---|
| 139 | ! real ssum |
|---|
| 140 | character*1 yes |
|---|
| 141 | logical :: flagiso=.false. , flagps0=.false. |
|---|
| 142 | real val, val2, val3 ! to store temporary variables |
|---|
| 143 | real :: iceith=2000 ! thermal inertia of subterranean ice |
|---|
| 144 | real :: iceithN,iceithS ! values of thermal inertias in N & S hemispheres |
|---|
| 145 | integer iref,jref |
|---|
| 146 | |
|---|
| 147 | INTEGER :: itau |
|---|
| 148 | |
|---|
| 149 | INTEGER :: numvanle |
|---|
| 150 | character(len=50) :: txt ! to store some text |
|---|
| 151 | integer :: count |
|---|
| 152 | real :: profile(llm+1) ! to store an atmospheric profile + surface value |
|---|
| 153 | |
|---|
| 154 | ! MONS data: |
|---|
| 155 | real :: MONS_Hdn(iip1,jjp1) ! Hdn: %WEH=Mass fraction of H2O |
|---|
| 156 | real :: MONS_d21(iip1,jjp1) ! ice table "depth" (in kg/m2) |
|---|
| 157 | ! coefficient to apply to convert d21 to 'true' depth (m) |
|---|
| 158 | real :: MONS_coeff |
|---|
| 159 | real :: MONS_coeffS ! coeff for southern hemisphere |
|---|
| 160 | real :: MONS_coeffN ! coeff for northern hemisphere |
|---|
| 161 | ! real,parameter :: icedepthmin=1.e-3 ! Ice begins at most at that depth |
|---|
| 162 | ! Reference position for composition |
|---|
| 163 | real :: latref,lonref,dlatmin,dlonmin |
|---|
| 164 | ! Variable used to change composition |
|---|
| 165 | real :: Svmr,Smmr,Smmr_old,Smmr_new,Sn |
|---|
| 166 | real :: Mair_old,Mair_new,vmr_old,vmr_new |
|---|
| 167 | real,allocatable :: coefvmr(:) ! Correction coefficient when changing composition |
|---|
| 168 | integer :: iloc(1), iqmax |
|---|
| 169 | ! sub-grid cloud fraction |
|---|
| 170 | real,allocatable :: totcloudfrac(ngridmx) |
|---|
| 171 | |
|---|
| 172 | c sortie visu pour les champs dynamiques |
|---|
| 173 | c--------------------------------------- |
|---|
| 174 | ! INTEGER :: visuid |
|---|
| 175 | ! real :: time_step,t_ops,t_wrt |
|---|
| 176 | ! CHARACTER*80 :: visu_file |
|---|
| 177 | |
|---|
| 178 | cpp = 744.499 ! for Mars, instead of 1004.70885 (Earth) |
|---|
| 179 | preff = 610. ! for Mars, instead of 101325. (Earth) |
|---|
| 180 | pa= 20 ! for Mars, instead of 500 (Earth) |
|---|
| 181 | planet_type="mars" |
|---|
| 182 | |
|---|
| 183 | ! initialize "serial/parallel" related stuff |
|---|
| 184 | CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) |
|---|
| 185 | call initcomgeomphy |
|---|
| 186 | |
|---|
| 187 | ! Load tracer number and names: |
|---|
| 188 | ! call iniadvtrac(nqtot,numvanle) |
|---|
| 189 | call infotrac_init |
|---|
| 190 | ! allocate arrays |
|---|
| 191 | allocate(q(iip1,jjp1,llm,nqtot)) |
|---|
| 192 | allocate(coefvmr(nqtot)) |
|---|
| 193 | |
|---|
| 194 | c======================================================================= |
|---|
| 195 | c Choice of the start file(s) to use |
|---|
| 196 | c======================================================================= |
|---|
| 197 | |
|---|
| 198 | write(*,*) 'From which kind of files do you want to create new', |
|---|
| 199 | . 'start and startfi files' |
|---|
| 200 | write(*,*) ' 0 - from a file start_archive' |
|---|
| 201 | write(*,*) ' 1 - from files start and startfi' |
|---|
| 202 | |
|---|
| 203 | c----------------------------------------------------------------------- |
|---|
| 204 | c Open file(s) to modify (start or start_archive) |
|---|
| 205 | c----------------------------------------------------------------------- |
|---|
| 206 | |
|---|
| 207 | DO |
|---|
| 208 | read(*,*,iostat=ierr) choix_1 |
|---|
| 209 | if ((choix_1 /= 0).OR.(choix_1 /=1)) EXIT |
|---|
| 210 | ENDDO |
|---|
| 211 | |
|---|
| 212 | c Open start_archive |
|---|
| 213 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 214 | if (choix_1.eq.0) then |
|---|
| 215 | |
|---|
| 216 | write(*,*) 'Creating start files from:' |
|---|
| 217 | write(*,*) './start_archive.nc' |
|---|
| 218 | write(*,*) |
|---|
| 219 | fichnom = 'start_archive.nc' |
|---|
| 220 | ierr = NF_OPEN (fichnom, NF_NOWRITE,nid) |
|---|
| 221 | IF (ierr.NE.NF_NOERR) THEN |
|---|
| 222 | write(6,*)' Problem opening file:',fichnom |
|---|
| 223 | write(6,*)' ierr = ', ierr |
|---|
| 224 | CALL ABORT |
|---|
| 225 | ENDIF |
|---|
| 226 | tab0 = 50 |
|---|
| 227 | Lmodif = 1 |
|---|
| 228 | |
|---|
| 229 | c OR open start and startfi files |
|---|
| 230 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 231 | else |
|---|
| 232 | write(*,*) 'Creating start files from:' |
|---|
| 233 | write(*,*) './start.nc and ./startfi.nc' |
|---|
| 234 | write(*,*) |
|---|
| 235 | fichnom = 'start.nc' |
|---|
| 236 | ierr = NF_OPEN (fichnom, NF_NOWRITE,nid_dyn) |
|---|
| 237 | IF (ierr.NE.NF_NOERR) THEN |
|---|
| 238 | write(6,*)' Problem opening file:',fichnom |
|---|
| 239 | write(6,*)' ierr = ', ierr |
|---|
| 240 | CALL ABORT |
|---|
| 241 | ENDIF |
|---|
| 242 | |
|---|
| 243 | fichnom = 'startfi.nc' |
|---|
| 244 | ierr = NF_OPEN (fichnom, NF_NOWRITE,nid_fi) |
|---|
| 245 | IF (ierr.NE.NF_NOERR) THEN |
|---|
| 246 | write(6,*)' Problem opening file:',fichnom |
|---|
| 247 | write(6,*)' ierr = ', ierr |
|---|
| 248 | CALL ABORT |
|---|
| 249 | ENDIF |
|---|
| 250 | |
|---|
| 251 | tab0 = 0 |
|---|
| 252 | Lmodif = 0 |
|---|
| 253 | |
|---|
| 254 | endif |
|---|
| 255 | |
|---|
| 256 | c----------------------------------------------------------------------- |
|---|
| 257 | c Lecture du tableau des parametres du run (pour la dynamique) |
|---|
| 258 | c----------------------------------------------------------------------- |
|---|
| 259 | |
|---|
| 260 | if (choix_1.eq.0) then |
|---|
| 261 | |
|---|
| 262 | write(*,*) 'reading tab_cntrl START_ARCHIVE' |
|---|
| 263 | c |
|---|
| 264 | ierr = NF_INQ_VARID (nid, "controle", nvarid) |
|---|
| 265 | #ifdef NC_DOUBLE |
|---|
| 266 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) |
|---|
| 267 | #else |
|---|
| 268 | ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) |
|---|
| 269 | #endif |
|---|
| 270 | c |
|---|
| 271 | else if (choix_1.eq.1) then |
|---|
| 272 | |
|---|
| 273 | write(*,*) 'reading tab_cntrl START' |
|---|
| 274 | c |
|---|
| 275 | ierr = NF_INQ_VARID (nid_dyn, "controle", nvarid) |
|---|
| 276 | #ifdef NC_DOUBLE |
|---|
| 277 | ierr = NF_GET_VAR_DOUBLE(nid_dyn, nvarid, tab_cntrl) |
|---|
| 278 | #else |
|---|
| 279 | ierr = NF_GET_VAR_REAL(nid_dyn, nvarid, tab_cntrl) |
|---|
| 280 | #endif |
|---|
| 281 | c |
|---|
| 282 | write(*,*) 'reading tab_cntrl STARTFI' |
|---|
| 283 | c |
|---|
| 284 | ierr = NF_INQ_VARID (nid_fi, "controle", nvarid) |
|---|
| 285 | #ifdef NC_DOUBLE |
|---|
| 286 | ierr = NF_GET_VAR_DOUBLE(nid_fi, nvarid, tab_cntrl_bis) |
|---|
| 287 | #else |
|---|
| 288 | ierr = NF_GET_VAR_REAL(nid_fi, nvarid, tab_cntrl_bis) |
|---|
| 289 | #endif |
|---|
| 290 | c |
|---|
| 291 | do i=1,50 |
|---|
| 292 | tab_cntrl(i+50)=tab_cntrl_bis(i) |
|---|
| 293 | enddo |
|---|
| 294 | write(*,*) 'printing tab_cntrl', tab_cntrl |
|---|
| 295 | do i=1,100 |
|---|
| 296 | write(*,*) i,tab_cntrl(i) |
|---|
| 297 | enddo |
|---|
| 298 | |
|---|
| 299 | endif |
|---|
| 300 | c----------------------------------------------------------------------- |
|---|
| 301 | c Initialisation des constantes dynamique |
|---|
| 302 | c----------------------------------------------------------------------- |
|---|
| 303 | |
|---|
| 304 | kappa = tab_cntrl(9) |
|---|
| 305 | etot0 = tab_cntrl(12) |
|---|
| 306 | ptot0 = tab_cntrl(13) |
|---|
| 307 | ztot0 = tab_cntrl(14) |
|---|
| 308 | stot0 = tab_cntrl(15) |
|---|
| 309 | ang0 = tab_cntrl(16) |
|---|
| 310 | write(*,*) "Newstart: kappa,etot0,ptot0,ztot0,stot0,ang0" |
|---|
| 311 | write(*,*) kappa,etot0,ptot0,ztot0,stot0,ang0 |
|---|
| 312 | |
|---|
| 313 | c----------------------------------------------------------------------- |
|---|
| 314 | c Lecture du tab_cntrl et initialisation des constantes physiques |
|---|
| 315 | c - pour start: Lmodif = 0 => pas de modifications possibles |
|---|
| 316 | c (modif dans le tabfi de readfi + loin) |
|---|
| 317 | c - pour start_archive: Lmodif = 1 => modifications possibles |
|---|
| 318 | c----------------------------------------------------------------------- |
|---|
| 319 | if (choix_1.eq.0) then |
|---|
| 320 | ! tabfi requires that input file be first opened by open_startphy(fichnom) |
|---|
| 321 | fichnom = 'start_archive.nc' |
|---|
| 322 | call open_startphy(fichnom) |
|---|
| 323 | call tabfi (nid,Lmodif,tab0,day_ini,lllm,p_rad, |
|---|
| 324 | . p_omeg,p_g,p_mugaz,p_daysec,time) |
|---|
| 325 | else if (choix_1.eq.1) then |
|---|
| 326 | fichnom = 'startfi.nc' |
|---|
| 327 | call open_startphy(fichnom) |
|---|
| 328 | call tabfi (nid_fi,Lmodif,tab0,day_ini,lllm,p_rad, |
|---|
| 329 | . p_omeg,p_g,p_mugaz,p_daysec,time) |
|---|
| 330 | endif |
|---|
| 331 | |
|---|
| 332 | rad = p_rad |
|---|
| 333 | omeg = p_omeg |
|---|
| 334 | g = p_g |
|---|
| 335 | mugaz = p_mugaz |
|---|
| 336 | daysec = p_daysec |
|---|
| 337 | ! write(*,*) 'aire',aire |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | c======================================================================= |
|---|
| 341 | c INITIALISATIONS DIVERSES |
|---|
| 342 | c======================================================================= |
|---|
| 343 | |
|---|
| 344 | day_step=180 !?! Note: day_step is a common in "control.h" |
|---|
| 345 | CALL defrun_new( 99, .TRUE. ) |
|---|
| 346 | CALL iniconst |
|---|
| 347 | CALL inigeom |
|---|
| 348 | idum=-1 |
|---|
| 349 | idum=0 |
|---|
| 350 | |
|---|
| 351 | c Initialisation coordonnees /aires |
|---|
| 352 | c ------------------------------- |
|---|
| 353 | ! Note: rlatu(:) and rlonv(:) are commons defined in "comgeom.h" |
|---|
| 354 | ! rlatu() and rlonv() are given in radians |
|---|
| 355 | latfi(1)=rlatu(1) |
|---|
| 356 | lonfi(1)=0. |
|---|
| 357 | DO j=2,jjm |
|---|
| 358 | DO i=1,iim |
|---|
| 359 | latfi((j-2)*iim+1+i)=rlatu(j) |
|---|
| 360 | lonfi((j-2)*iim+1+i)=rlonv(i) |
|---|
| 361 | ENDDO |
|---|
| 362 | ENDDO |
|---|
| 363 | latfi(ngridmx)=rlatu(jjp1) |
|---|
| 364 | lonfi(ngridmx)=0. |
|---|
| 365 | |
|---|
| 366 | ! build airefi(), mesh area on physics grid |
|---|
| 367 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi) |
|---|
| 368 | ! Poles are single points on physics grid |
|---|
| 369 | airefi(1)=sum(aire(1:iim,1)) |
|---|
| 370 | airefi(ngridmx)=sum(aire(1:iim,jjm+1)) |
|---|
| 371 | |
|---|
| 372 | ! also initialize various physics flags/settings which might be needed |
|---|
| 373 | ! (for instance initracer needs to know about some flags, and/or |
|---|
| 374 | ! 'datafile' path may be changed by user) |
|---|
| 375 | call phys_state_var_init(ngridmx,llm,nqtot, |
|---|
| 376 | . daysec,dtphys,rad,g,r,cpp) |
|---|
| 377 | call ini_fillgeom(ngridmx,latfi,lonfi,airefi) |
|---|
| 378 | call conf_phys(ngridmx,llm,nqtot) |
|---|
| 379 | |
|---|
| 380 | c======================================================================= |
|---|
| 381 | c lecture topographie, albedo, inertie thermique, relief sous-maille |
|---|
| 382 | c======================================================================= |
|---|
| 383 | |
|---|
| 384 | if (choix_1.ne.1) then ! pour ne pas avoir besoin du fichier |
|---|
| 385 | ! surface.dat dans le cas des start |
|---|
| 386 | |
|---|
| 387 | c do while((relief(1:3).ne.'mol').AND.(relief(1:3).ne.'pla')) |
|---|
| 388 | c write(*,*) |
|---|
| 389 | c write(*,*) 'choix du relief (mola,pla)' |
|---|
| 390 | c write(*,*) '(Topographie MGS MOLA, plat)' |
|---|
| 391 | c read(*,fmt='(a3)') relief |
|---|
| 392 | relief="mola" |
|---|
| 393 | c enddo |
|---|
| 394 | |
|---|
| 395 | CALL datareadnc(relief,phis,alb,surfith,z0S, |
|---|
| 396 | & zmeaS,zstdS,zsigS,zgamS,ztheS) |
|---|
| 397 | |
|---|
| 398 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi) |
|---|
| 399 | ! CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,ith,ithfi) |
|---|
| 400 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,surfith,surfithfi) |
|---|
| 401 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) |
|---|
| 402 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,z0S,z0) |
|---|
| 403 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zmeaS,zmea) |
|---|
| 404 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zstdS,zstd) |
|---|
| 405 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zsigS,zsig) |
|---|
| 406 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zgamS,zgam) |
|---|
| 407 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,ztheS,zthe) |
|---|
| 408 | |
|---|
| 409 | endif ! of if (choix_1.ne.1) |
|---|
| 410 | |
|---|
| 411 | |
|---|
| 412 | c======================================================================= |
|---|
| 413 | c Lecture des fichiers (start ou start_archive) |
|---|
| 414 | c======================================================================= |
|---|
| 415 | |
|---|
| 416 | if (choix_1.eq.0) then |
|---|
| 417 | |
|---|
| 418 | write(*,*) 'Reading file START_ARCHIVE' |
|---|
| 419 | CALL lect_start_archive(ngridmx,llm,nqtot, |
|---|
| 420 | & date,tsurf,tsoil,emis,q2, |
|---|
| 421 | & t,ucov,vcov,ps,co2ice,teta,phisold_newgrid,q,qsurf, |
|---|
| 422 | & tauscaling,totcloudfrac,surfith,nid) |
|---|
| 423 | write(*,*) "OK, read start_archive file" |
|---|
| 424 | ! copy soil thermal inertia |
|---|
| 425 | ithfi(:,:)=inertiedat(:,:) |
|---|
| 426 | |
|---|
| 427 | ierr= NF_CLOSE(nid) |
|---|
| 428 | |
|---|
| 429 | else if (choix_1.eq.1) then ! c'est l'appel a tabfi de phyeta0 qui |
|---|
| 430 | ! permet de changer les valeurs du |
|---|
| 431 | ! tab_cntrl Lmodif=1 |
|---|
| 432 | tab0=0 |
|---|
| 433 | Lmodif=1 ! Lmodif set to 1 to allow modifications in phyeta0 |
|---|
| 434 | write(*,*) 'Reading file START' |
|---|
| 435 | fichnom = 'start.nc' |
|---|
| 436 | CALL dynetat0(fichnom,vcov,ucov,teta,q,masse, |
|---|
| 437 | . ps,phis,time) |
|---|
| 438 | |
|---|
| 439 | write(*,*) 'Reading file STARTFI' |
|---|
| 440 | fichnom = 'startfi.nc' |
|---|
| 441 | CALL phyetat0 (fichnom,tab0,Lmodif,nsoilmx,ngridmx,llm,nqtot, |
|---|
| 442 | . day_ini,time, |
|---|
| 443 | . tsurf,tsoil,emis,q2,qsurf,co2ice,tauscaling, |
|---|
| 444 | . totcloudfrac) |
|---|
| 445 | |
|---|
| 446 | ! copy albedo and soil thermal inertia |
|---|
| 447 | do i=1,ngridmx |
|---|
| 448 | albfi(i) = albedodat(i) |
|---|
| 449 | do j=1,nsoilmx |
|---|
| 450 | ithfi(i,j) = inertiedat(i,j) |
|---|
| 451 | enddo |
|---|
| 452 | ! build a surfithfi(:) using 1st layer of ithfi(:), which might |
|---|
| 453 | ! be neede later on if reinitializing soil thermal inertia |
|---|
| 454 | surfithfi(i)=ithfi(i,1) |
|---|
| 455 | enddo |
|---|
| 456 | |
|---|
| 457 | else |
|---|
| 458 | CALL exit(1) |
|---|
| 459 | endif |
|---|
| 460 | |
|---|
| 461 | dtvr = daysec/REAL(day_step) |
|---|
| 462 | dtphys = dtvr * REAL(iphysiq) |
|---|
| 463 | |
|---|
| 464 | c======================================================================= |
|---|
| 465 | c |
|---|
| 466 | c======================================================================= |
|---|
| 467 | ! If tracer names follow 'old' convention (q01, q02, ...) then |
|---|
| 468 | ! rename them |
|---|
| 469 | count=0 |
|---|
| 470 | do iq=1,nqtot |
|---|
| 471 | txt=" " |
|---|
| 472 | write(txt,'(a1,i2.2)') 'q',iq |
|---|
| 473 | if (txt.eq.tname(iq)) then |
|---|
| 474 | count=count+1 |
|---|
| 475 | endif |
|---|
| 476 | enddo ! of do iq=1,nqtot |
|---|
| 477 | |
|---|
| 478 | ! initialize tracer names noms(:) and indexes (igcm_co2, igcm_h2o_vap, ...) |
|---|
| 479 | call initracer(ngridmx,nqtot,qsurf) |
|---|
| 480 | |
|---|
| 481 | if (count.eq.nqtot) then |
|---|
| 482 | write(*,*) 'Newstart: updating tracer names' |
|---|
| 483 | ! copy noms(:) to tname(:) to have matching tracer names in physics |
|---|
| 484 | ! and dynamics |
|---|
| 485 | tname(1:nqtot)=noms(1:nqtot) |
|---|
| 486 | endif |
|---|
| 487 | |
|---|
| 488 | c======================================================================= |
|---|
| 489 | c |
|---|
| 490 | c======================================================================= |
|---|
| 491 | |
|---|
| 492 | do ! infinite loop on list of changes |
|---|
| 493 | |
|---|
| 494 | write(*,*) |
|---|
| 495 | write(*,*) |
|---|
| 496 | write(*,*) 'List of possible changes :' |
|---|
| 497 | write(*,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~' |
|---|
| 498 | write(*,*) |
|---|
| 499 | write(*,*) 'flat : no topography ("aquaplanet")' |
|---|
| 500 | write(*,*) 'bilball : uniform albedo and thermal inertia' |
|---|
| 501 | write(*,*) 'z0 : set a uniform surface roughness length' |
|---|
| 502 | write(*,*) 'coldspole : cold subsurface and high albedo at |
|---|
| 503 | $ S.Pole' |
|---|
| 504 | write(*,*) 'qname : change tracer name' |
|---|
| 505 | write(*,*) 'q=0 : ALL tracer =zero' |
|---|
| 506 | write(*,*) 'q=x : give a specific uniform value to one |
|---|
| 507 | $ tracer' |
|---|
| 508 | write(*,*) 'q=profile : specify a profile for a tracer' |
|---|
| 509 | write(*,*) 'freedust : rescale dust to a true value' |
|---|
| 510 | write(*,*) 'ini_q : tracers initialization for chemistry |
|---|
| 511 | $ and water vapour' |
|---|
| 512 | write(*,*) 'ini_q-h2o : tracers initialization for chemistry |
|---|
| 513 | $ only' |
|---|
| 514 | write(*,*) 'composition : change atm main composition: CO2,N2,Ar, |
|---|
| 515 | $ O2,CO' |
|---|
| 516 | write(*,*) 'ini_h2osurf : reinitialize surface water ice ' |
|---|
| 517 | write(*,*) 'noglacier : Remove tropical H2O ice if |lat|<45' |
|---|
| 518 | write(*,*) 'watercapn : H20 ice on permanent N polar cap ' |
|---|
| 519 | write(*,*) 'watercaps : H20 ice on permanent S polar cap ' |
|---|
| 520 | write(*,*) 'wetstart : start with a wet atmosphere' |
|---|
| 521 | write(*,*) 'isotherm : Isothermal Temperatures, wind set to |
|---|
| 522 | $ zero' |
|---|
| 523 | write(*,*) 'co2ice=0 : remove CO2 polar cap' |
|---|
| 524 | write(*,*) 'ptot : change total pressure' |
|---|
| 525 | write(*,*) 'therm_ini_s : set soil thermal inertia to reference |
|---|
| 526 | $ surface values' |
|---|
| 527 | write(*,*) 'subsoilice_n : put deep underground ice layer in |
|---|
| 528 | $ northern hemisphere' |
|---|
| 529 | write(*,*) 'subsoilice_s : put deep underground ice layer in |
|---|
| 530 | $ southern hemisphere' |
|---|
| 531 | write(*,*) 'mons_ice : put underground ice layer according |
|---|
| 532 | $ to MONS derived data' |
|---|
| 533 | |
|---|
| 534 | write(*,*) |
|---|
| 535 | write(*,*) 'Change to perform ?' |
|---|
| 536 | write(*,*) ' (enter keyword or return to end)' |
|---|
| 537 | write(*,*) |
|---|
| 538 | |
|---|
| 539 | read(*,fmt='(a20)') modif |
|---|
| 540 | if (modif(1:1) .eq. ' ') exit ! exit loop on changes |
|---|
| 541 | |
|---|
| 542 | write(*,*) |
|---|
| 543 | write(*,*) trim(modif) , ' : ' |
|---|
| 544 | |
|---|
| 545 | c 'flat : no topography ("aquaplanet")' |
|---|
| 546 | c ------------------------------------- |
|---|
| 547 | if (trim(modif) .eq. 'flat') then |
|---|
| 548 | c set topo to zero |
|---|
| 549 | phis(:,:)=0 |
|---|
| 550 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi) |
|---|
| 551 | write(*,*) 'topography set to zero.' |
|---|
| 552 | write(*,*) 'WARNING : the subgrid topography parameters', |
|---|
| 553 | & ' were not set to zero ! => set calllott to F' |
|---|
| 554 | |
|---|
| 555 | c Choice for surface pressure |
|---|
| 556 | yes=' ' |
|---|
| 557 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
|---|
| 558 | write(*,*) 'Do you wish to choose homogeneous surface', |
|---|
| 559 | & 'pressure (y) or let newstart interpolate ', |
|---|
| 560 | & ' the previous field (n)?' |
|---|
| 561 | read(*,fmt='(a)') yes |
|---|
| 562 | end do |
|---|
| 563 | if (yes.eq.'y') then |
|---|
| 564 | flagps0=.true. |
|---|
| 565 | write(*,*) 'New value for ps (Pa) ?' |
|---|
| 566 | 201 read(*,*,iostat=ierr) patm |
|---|
| 567 | if(ierr.ne.0) goto 201 |
|---|
| 568 | write(*,*) |
|---|
| 569 | write(*,*) ' new ps everywhere (Pa) = ', patm |
|---|
| 570 | write(*,*) |
|---|
| 571 | do j=1,jjp1 |
|---|
| 572 | do i=1,iip1 |
|---|
| 573 | ps(i,j)=patm |
|---|
| 574 | enddo |
|---|
| 575 | enddo |
|---|
| 576 | end if |
|---|
| 577 | |
|---|
| 578 | c bilball : albedo, inertie thermique uniforme |
|---|
| 579 | c -------------------------------------------- |
|---|
| 580 | else if (trim(modif) .eq. 'bilball') then |
|---|
| 581 | write(*,*) 'constante albedo and iner.therm:' |
|---|
| 582 | write(*,*) 'New value for albedo (ex: 0.25) ?' |
|---|
| 583 | 101 read(*,*,iostat=ierr) alb_bb |
|---|
| 584 | if(ierr.ne.0) goto 101 |
|---|
| 585 | write(*,*) |
|---|
| 586 | write(*,*) ' uniform albedo (new value):',alb_bb |
|---|
| 587 | write(*,*) |
|---|
| 588 | |
|---|
| 589 | write(*,*) 'New value for thermal inertia (eg: 247) ?' |
|---|
| 590 | 102 read(*,*,iostat=ierr) ith_bb |
|---|
| 591 | if(ierr.ne.0) goto 102 |
|---|
| 592 | write(*,*) 'uniform thermal inertia (new value):',ith_bb |
|---|
| 593 | DO j=1,jjp1 |
|---|
| 594 | DO i=1,iip1 |
|---|
| 595 | alb(i,j) = alb_bb ! albedo |
|---|
| 596 | do isoil=1,nsoilmx |
|---|
| 597 | ith(i,j,isoil) = ith_bb ! thermal inertia |
|---|
| 598 | enddo |
|---|
| 599 | END DO |
|---|
| 600 | END DO |
|---|
| 601 | ! CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,ith,ithfi) |
|---|
| 602 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
|---|
| 603 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) |
|---|
| 604 | |
|---|
| 605 | ! also reset surface roughness length to default value |
|---|
| 606 | write(*,*) 'surface roughness length set to:',z0_default,' m' |
|---|
| 607 | z0(:)=z0_default |
|---|
| 608 | |
|---|
| 609 | ! z0 : set surface roughness length to a constant value |
|---|
| 610 | ! ----------------------------------------------------- |
|---|
| 611 | else if (trim(modif) .eq. 'z0') then |
|---|
| 612 | write(*,*) 'set a uniform surface roughness length' |
|---|
| 613 | write(*,*) ' value for z0_default (ex: ',z0_default,')?' |
|---|
| 614 | ierr=1 |
|---|
| 615 | do while (ierr.ne.0) |
|---|
| 616 | read(*,*,iostat=ierr) z0_default |
|---|
| 617 | enddo |
|---|
| 618 | z0(:)=z0_default |
|---|
| 619 | |
|---|
| 620 | c coldspole : sous-sol de la calotte sud toujours froid |
|---|
| 621 | c ----------------------------------------------------- |
|---|
| 622 | else if (trim(modif) .eq. 'coldspole') then |
|---|
| 623 | write(*,*)'new value for the subsurface temperature', |
|---|
| 624 | & ' beneath the permanent southern polar cap ? (eg: 141 K)' |
|---|
| 625 | 103 read(*,*,iostat=ierr) tsud |
|---|
| 626 | if(ierr.ne.0) goto 103 |
|---|
| 627 | write(*,*) |
|---|
| 628 | write(*,*) ' new value of the subsurface temperature:',tsud |
|---|
| 629 | c nouvelle temperature sous la calotte permanente |
|---|
| 630 | do l=2,nsoilmx |
|---|
| 631 | tsoil(ngridmx,l) = tsud |
|---|
| 632 | end do |
|---|
| 633 | |
|---|
| 634 | |
|---|
| 635 | write(*,*)'new value for the albedo', |
|---|
| 636 | & 'of the permanent southern polar cap ? (eg: 0.75)' |
|---|
| 637 | 104 read(*,*,iostat=ierr) albsud |
|---|
| 638 | if(ierr.ne.0) goto 104 |
|---|
| 639 | write(*,*) |
|---|
| 640 | |
|---|
| 641 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 642 | c Option 1: only the albedo of the pole is modified : |
|---|
| 643 | albfi(ngridmx)=albsud |
|---|
| 644 | write(*,*) 'ig=',ngridmx,' albedo perennial cap ', |
|---|
| 645 | & albfi(ngridmx) |
|---|
| 646 | |
|---|
| 647 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 648 | c Option 2 A haute resolution : coordonnee de la vrai calotte ~ |
|---|
| 649 | c DO j=1,jjp1 |
|---|
| 650 | c DO i=1,iip1 |
|---|
| 651 | c ig=1+(j-2)*iim +i |
|---|
| 652 | c if(j.eq.1) ig=1 |
|---|
| 653 | c if(j.eq.jjp1) ig=ngridmx |
|---|
| 654 | c if ((rlatu(j)*180./pi.lt.-84.).and. |
|---|
| 655 | c & (rlatu(j)*180./pi.gt.-91.).and. |
|---|
| 656 | c & (rlonv(i)*180./pi.gt.-91.).and. |
|---|
| 657 | c & (rlonv(i)*180./pi.lt.0.)) then |
|---|
| 658 | cc albedo de la calotte permanente fixe a albsud |
|---|
| 659 | c alb(i,j)=albsud |
|---|
| 660 | c write(*,*) 'lat=',rlatu(j)*180./pi, |
|---|
| 661 | c & ' lon=',rlonv(i)*180./pi |
|---|
| 662 | cc fin de la condition sur les limites de la calotte permanente |
|---|
| 663 | c end if |
|---|
| 664 | c ENDDO |
|---|
| 665 | c ENDDO |
|---|
| 666 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 667 | |
|---|
| 668 | c CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) |
|---|
| 669 | |
|---|
| 670 | |
|---|
| 671 | c ptot : Modification of the total pressure: ice + current atmosphere |
|---|
| 672 | c ------------------------------------------------------------------- |
|---|
| 673 | else if (trim(modif) .eq. 'ptot') then |
|---|
| 674 | |
|---|
| 675 | c calcul de la pression totale glace + atm actuelle |
|---|
| 676 | patm=0. |
|---|
| 677 | airetot=0. |
|---|
| 678 | pcap=0. |
|---|
| 679 | DO j=1,jjp1 |
|---|
| 680 | DO i=1,iim |
|---|
| 681 | ig=1+(j-2)*iim +i |
|---|
| 682 | if(j.eq.1) ig=1 |
|---|
| 683 | if(j.eq.jjp1) ig=ngridmx |
|---|
| 684 | patm = patm + ps(i,j)*aire(i,j) |
|---|
| 685 | airetot= airetot + aire(i,j) |
|---|
| 686 | pcap = pcap + aire(i,j)*co2ice(ig)*g |
|---|
| 687 | ENDDO |
|---|
| 688 | ENDDO |
|---|
| 689 | ptoto = pcap + patm |
|---|
| 690 | |
|---|
| 691 | print*,'Current total pressure at surface (co2 ice + atm) ', |
|---|
| 692 | & ptoto/airetot |
|---|
| 693 | |
|---|
| 694 | print*,'new value?' |
|---|
| 695 | read(*,*) ptotn |
|---|
| 696 | ptotn=ptotn*airetot |
|---|
| 697 | patmn=ptotn-pcap |
|---|
| 698 | print*,'ptoto,patm,ptotn,patmn' |
|---|
| 699 | print*,ptoto,patm,ptotn,patmn |
|---|
| 700 | print*,'Mult. factor for pressure (atm only)', patmn/patm |
|---|
| 701 | do j=1,jjp1 |
|---|
| 702 | do i=1,iip1 |
|---|
| 703 | ps(i,j)=ps(i,j)*patmn/patm |
|---|
| 704 | enddo |
|---|
| 705 | enddo |
|---|
| 706 | |
|---|
| 707 | c Correction pour la conservation des traceurs |
|---|
| 708 | yes=' ' |
|---|
| 709 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
|---|
| 710 | write(*,*) 'Do you wish to conserve tracer total mass (y)', |
|---|
| 711 | & ' or tracer mixing ratio (n) ?' |
|---|
| 712 | read(*,fmt='(a)') yes |
|---|
| 713 | end do |
|---|
| 714 | |
|---|
| 715 | if (yes.eq.'y') then |
|---|
| 716 | write(*,*) 'OK : conservation of tracer total mass' |
|---|
| 717 | DO iq =1, nqtot |
|---|
| 718 | DO l=1,llm |
|---|
| 719 | DO j=1,jjp1 |
|---|
| 720 | DO i=1,iip1 |
|---|
| 721 | q(i,j,l,iq)=q(i,j,l,iq)*patm/patmn |
|---|
| 722 | ENDDO |
|---|
| 723 | ENDDO |
|---|
| 724 | ENDDO |
|---|
| 725 | ENDDO |
|---|
| 726 | else |
|---|
| 727 | write(*,*) 'OK : conservation of tracer mixing ratio' |
|---|
| 728 | end if |
|---|
| 729 | |
|---|
| 730 | c qname : change tracer name |
|---|
| 731 | c -------------------------- |
|---|
| 732 | else if (trim(modif).eq.'qname') then |
|---|
| 733 | yes='y' |
|---|
| 734 | do while (yes.eq.'y') |
|---|
| 735 | write(*,*) 'Which tracer name do you want to change ?' |
|---|
| 736 | do iq=1,nqtot |
|---|
| 737 | write(*,'(i3,a3,a20)')iq,' : ',trim(tname(iq)) |
|---|
| 738 | enddo |
|---|
| 739 | write(*,'(a35,i3)') |
|---|
| 740 | & '(enter tracer number; between 1 and ',nqtot |
|---|
| 741 | write(*,*)' or any other value to quit this option)' |
|---|
| 742 | read(*,*) iq |
|---|
| 743 | if ((iq.ge.1).and.(iq.le.nqtot)) then |
|---|
| 744 | write(*,*)'Change tracer name ',trim(tname(iq)),' to ?' |
|---|
| 745 | read(*,*) txt |
|---|
| 746 | tname(iq)=txt |
|---|
| 747 | write(*,*)'Do you want to change another tracer name (y/n)?' |
|---|
| 748 | read(*,'(a)') yes |
|---|
| 749 | else |
|---|
| 750 | ! inapropiate value of iq; quit this option |
|---|
| 751 | yes='n' |
|---|
| 752 | endif ! of if ((iq.ge.1).and.(iq.le.nqtot)) |
|---|
| 753 | enddo ! of do while (yes.ne.'y') |
|---|
| 754 | |
|---|
| 755 | c q=0 : set tracers to zero |
|---|
| 756 | c ------------------------- |
|---|
| 757 | else if (trim(modif) .eq. 'q=0') then |
|---|
| 758 | c mise a 0 des q (traceurs) |
|---|
| 759 | write(*,*) 'Tracers set to 0 (1.E-30 in fact)' |
|---|
| 760 | DO iq =1, nqtot |
|---|
| 761 | DO l=1,llm |
|---|
| 762 | DO j=1,jjp1 |
|---|
| 763 | DO i=1,iip1 |
|---|
| 764 | q(i,j,l,iq)=1.e-30 |
|---|
| 765 | ENDDO |
|---|
| 766 | ENDDO |
|---|
| 767 | ENDDO |
|---|
| 768 | ENDDO |
|---|
| 769 | |
|---|
| 770 | c set surface tracers to zero |
|---|
| 771 | DO iq =1, nqtot |
|---|
| 772 | DO ig=1,ngridmx |
|---|
| 773 | qsurf(ig,iq)=0. |
|---|
| 774 | ENDDO |
|---|
| 775 | ENDDO |
|---|
| 776 | |
|---|
| 777 | c q=x : initialise tracer manually |
|---|
| 778 | c -------------------------------- |
|---|
| 779 | else if (trim(modif) .eq. 'q=x') then |
|---|
| 780 | write(*,*) 'Which tracer do you want to modify ?' |
|---|
| 781 | do iq=1,nqtot |
|---|
| 782 | write(*,*)iq,' : ',trim(tname(iq)) |
|---|
| 783 | enddo |
|---|
| 784 | write(*,*) '(choose between 1 and ',nqtot,')' |
|---|
| 785 | read(*,*) iq |
|---|
| 786 | if ((iq.lt.1).or.(iq.gt.nqtot)) then |
|---|
| 787 | ! wrong value for iq, go back to menu |
|---|
| 788 | write(*,*) "wrong input value:",iq |
|---|
| 789 | cycle |
|---|
| 790 | endif |
|---|
| 791 | write(*,*)'mixing ratio of tracer ',trim(tname(iq)), |
|---|
| 792 | & ' ? (kg/kg)' |
|---|
| 793 | read(*,*) val |
|---|
| 794 | DO l=1,llm |
|---|
| 795 | DO j=1,jjp1 |
|---|
| 796 | DO i=1,iip1 |
|---|
| 797 | q(i,j,l,iq)=val |
|---|
| 798 | ENDDO |
|---|
| 799 | ENDDO |
|---|
| 800 | ENDDO |
|---|
| 801 | write(*,*) 'SURFACE value of tracer ',trim(tname(iq)), |
|---|
| 802 | & ' ? (kg/m2)' |
|---|
| 803 | read(*,*) val |
|---|
| 804 | DO ig=1,ngridmx |
|---|
| 805 | qsurf(ig,iq)=val |
|---|
| 806 | ENDDO |
|---|
| 807 | |
|---|
| 808 | c q=profile : initialize tracer with a given profile |
|---|
| 809 | c -------------------------------------------------- |
|---|
| 810 | else if (trim(modif) .eq. 'q=profile') then |
|---|
| 811 | write(*,*) 'Tracer profile will be sought in ASCII file' |
|---|
| 812 | write(*,*) "'profile_tracer' where 'tracer' is tracer name" |
|---|
| 813 | write(*,*) "(one value per line in file; starting with" |
|---|
| 814 | write(*,*) "surface value, the 1st atmospheric layer" |
|---|
| 815 | write(*,*) "followed by 2nd, etc. up to top of atmosphere)" |
|---|
| 816 | write(*,*) 'Which tracer do you want to set?' |
|---|
| 817 | do iq=1,nqtot |
|---|
| 818 | write(*,*)iq,' : ',trim(tname(iq)) |
|---|
| 819 | enddo |
|---|
| 820 | write(*,*) '(choose between 1 and ',nqtot,')' |
|---|
| 821 | read(*,*) iq |
|---|
| 822 | if ((iq.lt.1).or.(iq.gt.nqtot)) then |
|---|
| 823 | ! wrong value for iq, go back to menu |
|---|
| 824 | write(*,*) "wrong input value:",iq |
|---|
| 825 | cycle |
|---|
| 826 | endif |
|---|
| 827 | ! look for input file 'profile_tracer' |
|---|
| 828 | txt="profile_"//trim(tname(iq)) |
|---|
| 829 | open(41,file=trim(txt),status='old',form='formatted', |
|---|
| 830 | & iostat=ierr) |
|---|
| 831 | if (ierr.eq.0) then |
|---|
| 832 | ! OK, found file 'profile_...', load the profile |
|---|
| 833 | do l=1,llm+1 |
|---|
| 834 | read(41,*,iostat=ierr) profile(l) |
|---|
| 835 | if (ierr.ne.0) then ! something went wrong |
|---|
| 836 | exit ! quit loop |
|---|
| 837 | endif |
|---|
| 838 | enddo |
|---|
| 839 | if (ierr.eq.0) then |
|---|
| 840 | ! initialize tracer values |
|---|
| 841 | qsurf(:,iq)=profile(1) |
|---|
| 842 | do l=1,llm |
|---|
| 843 | q(:,:,l,iq)=profile(l+1) |
|---|
| 844 | enddo |
|---|
| 845 | write(*,*)'OK, tracer ',trim(tname(iq)), |
|---|
| 846 | & ' initialized ','using values from file ',trim(txt) |
|---|
| 847 | else |
|---|
| 848 | write(*,*)'problem reading file ',trim(txt),' !' |
|---|
| 849 | write(*,*)'No modifications to tracer ',trim(tname(iq)) |
|---|
| 850 | endif |
|---|
| 851 | else |
|---|
| 852 | write(*,*)'Could not find file ',trim(txt),' !' |
|---|
| 853 | write(*,*)'No modifications to tracer ',trim(tname(iq)) |
|---|
| 854 | endif |
|---|
| 855 | |
|---|
| 856 | c convert dust from virtual to true values |
|---|
| 857 | c -------------------------------------------------- |
|---|
| 858 | else if (trim(modif) .eq. 'freedust') then |
|---|
| 859 | if (minval(tauscaling) .lt. 0) then |
|---|
| 860 | write(*,*) 'WARNING conversion factor negative' |
|---|
| 861 | write(*,*) 'This is probably because it was not present |
|---|
| 862 | &in the file' |
|---|
| 863 | write(*,*) 'A constant conversion is used instead.' |
|---|
| 864 | tauscaling(:) = 1.e-3 |
|---|
| 865 | endif |
|---|
| 866 | CALL gr_fi_dyn(1,ngridmx,iip1,jjp1,tauscaling,tauscadyn) |
|---|
| 867 | do l=1,llm |
|---|
| 868 | do j=1,jjp1 |
|---|
| 869 | do i=1,iip1 |
|---|
| 870 | if (igcm_dust_number .ne. 0) |
|---|
| 871 | & q(i,j,l,igcm_dust_number) = |
|---|
| 872 | & q(i,j,l,igcm_dust_number) * tauscadyn(i,j) |
|---|
| 873 | if (igcm_dust_mass .ne. 0) |
|---|
| 874 | & q(i,j,l,igcm_dust_mass) = |
|---|
| 875 | & q(i,j,l,igcm_dust_mass) * tauscadyn(i,j) |
|---|
| 876 | if (igcm_ccn_number .ne. 0) |
|---|
| 877 | & q(i,j,l,igcm_ccn_number) = |
|---|
| 878 | & q(i,j,l,igcm_ccn_number) * tauscadyn(i,j) |
|---|
| 879 | if (igcm_ccn_mass .ne. 0) |
|---|
| 880 | & q(i,j,l,igcm_ccn_mass) = |
|---|
| 881 | & q(i,j,l,igcm_ccn_mass) * tauscadyn(i,j) |
|---|
| 882 | end do |
|---|
| 883 | end do |
|---|
| 884 | end do |
|---|
| 885 | |
|---|
| 886 | tauscaling(:) = 1. |
|---|
| 887 | |
|---|
| 888 | ! We want to have the very same value at lon -180 and lon 180 |
|---|
| 889 | do l = 1,llm |
|---|
| 890 | do j = 1,jjp1 |
|---|
| 891 | do iq = 1,nqtot |
|---|
| 892 | q(iip1,j,l,iq) = q(1,j,l,iq) |
|---|
| 893 | end do |
|---|
| 894 | end do |
|---|
| 895 | end do |
|---|
| 896 | |
|---|
| 897 | write(*,*) 'done rescaling to true vale' |
|---|
| 898 | |
|---|
| 899 | c ini_q : Initialize tracers for chemistry |
|---|
| 900 | c ----------------------------------------------- |
|---|
| 901 | else if (trim(modif) .eq. 'ini_q') then |
|---|
| 902 | flagh2o = 1 |
|---|
| 903 | flagthermo = 0 |
|---|
| 904 | yes=' ' |
|---|
| 905 | c For more than 32 layers, possible to initiate thermosphere only |
|---|
| 906 | if (llm.gt.32) then |
|---|
| 907 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
|---|
| 908 | write(*,*)'', |
|---|
| 909 | & 'initialisation for thermosphere only? (y/n)' |
|---|
| 910 | read(*,fmt='(a)') yes |
|---|
| 911 | if (yes.eq.'y') then |
|---|
| 912 | flagthermo=1 |
|---|
| 913 | else |
|---|
| 914 | flagthermo=0 |
|---|
| 915 | endif |
|---|
| 916 | enddo |
|---|
| 917 | endif |
|---|
| 918 | |
|---|
| 919 | call inichim_newstart(ngridmx, nqtot, q, qsurf, ps, |
|---|
| 920 | & flagh2o, flagthermo) |
|---|
| 921 | |
|---|
| 922 | ! We want to have the very same value at lon -180 and lon 180 |
|---|
| 923 | do l = 1,llm |
|---|
| 924 | do j = 1,jjp1 |
|---|
| 925 | do iq = 1,nqtot |
|---|
| 926 | q(iip1,j,l,iq) = q(1,j,l,iq) |
|---|
| 927 | end do |
|---|
| 928 | end do |
|---|
| 929 | end do |
|---|
| 930 | |
|---|
| 931 | write(*,*) 'inichim_newstart: chemical species and |
|---|
| 932 | $ water vapour initialised' |
|---|
| 933 | |
|---|
| 934 | c ini_q-h2o : as above except for the water vapour tracer |
|---|
| 935 | c ------------------------------------------------------ |
|---|
| 936 | else if (trim(modif) .eq. 'ini_q-h2o') then |
|---|
| 937 | flagh2o = 0 |
|---|
| 938 | flagthermo = 0 |
|---|
| 939 | yes=' ' |
|---|
| 940 | ! for more than 32 layers, possible to initiate thermosphere only |
|---|
| 941 | if(llm.gt.32) then |
|---|
| 942 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
|---|
| 943 | write(*,*)'', |
|---|
| 944 | & 'initialisation for thermosphere only? (y/n)' |
|---|
| 945 | read(*,fmt='(a)') yes |
|---|
| 946 | if (yes.eq.'y') then |
|---|
| 947 | flagthermo=1 |
|---|
| 948 | else |
|---|
| 949 | flagthermo=0 |
|---|
| 950 | endif |
|---|
| 951 | enddo |
|---|
| 952 | endif |
|---|
| 953 | |
|---|
| 954 | call inichim_newstart(ngridmx, nqtot, q, qsurf, ps, |
|---|
| 955 | & flagh2o, flagthermo) |
|---|
| 956 | |
|---|
| 957 | ! We want to have the very same value at lon -180 and lon 180 |
|---|
| 958 | do l = 1,llm |
|---|
| 959 | do j = 1,jjp1 |
|---|
| 960 | do iq = 1,nqtot |
|---|
| 961 | q(iip1,j,l,iq) = q(1,j,l,iq) |
|---|
| 962 | end do |
|---|
| 963 | end do |
|---|
| 964 | end do |
|---|
| 965 | |
|---|
| 966 | write(*,*) 'inichim_newstart: chemical species initialised |
|---|
| 967 | $ (except water vapour)' |
|---|
| 968 | |
|---|
| 969 | c composition : change main composition: CO2,N2,Ar,O2,CO (FF 03/2014) |
|---|
| 970 | c -------------------------------------------------------- |
|---|
| 971 | else if (trim(modif) .eq. 'composition') then |
|---|
| 972 | write(*,*) "Lat (degN) lon (degE) of the reference site ?" |
|---|
| 973 | write(*,*) "e.g. MSL : -4.5 137. " |
|---|
| 974 | 301 read(*,*,iostat=ierr) latref, lonref |
|---|
| 975 | if(ierr.ne.0) goto 301 |
|---|
| 976 | |
|---|
| 977 | |
|---|
| 978 | ! Select GCM point close to reference site |
|---|
| 979 | dlonmin =90. |
|---|
| 980 | DO i=1,iip1-1 |
|---|
| 981 | if (abs(rlonv(i)*180./pi -lonref).lt.dlonmin)then |
|---|
| 982 | iref=i |
|---|
| 983 | dlonmin=abs(rlonv(i)*180./pi -lonref) |
|---|
| 984 | end if |
|---|
| 985 | ENDDO |
|---|
| 986 | dlatmin =45. |
|---|
| 987 | DO j=1,jjp1 |
|---|
| 988 | if (abs(rlatu(j)*180./pi -latref).lt.dlatmin)then |
|---|
| 989 | jref=j |
|---|
| 990 | dlatmin=abs(rlatu(j)*180./pi -latref) |
|---|
| 991 | end if |
|---|
| 992 | ENDDO |
|---|
| 993 | write(*,*) "In GCM : lat= " , rlatu(jref)*180./pi |
|---|
| 994 | write(*,*) "In GCM : lon= " , rlonv(iref)*180./pi |
|---|
| 995 | write(*,*) |
|---|
| 996 | |
|---|
| 997 | ! Compute air molar mass at reference site |
|---|
| 998 | Smmr=0 |
|---|
| 999 | Sn = 0 |
|---|
| 1000 | do iq=1,nqtot |
|---|
| 1001 | if ((iq.eq.igcm_co2).or.(iq.eq.igcm_n2) |
|---|
| 1002 | & .or. (iq.eq.igcm_ar).or.(iq.eq.igcm_o2) |
|---|
| 1003 | & .or. (iq.eq.igcm_co)) then |
|---|
| 1004 | Smmr=Smmr+q(iref,jref,1,iq) |
|---|
| 1005 | Sn=Sn+q(iref,jref,1,iq)/mmol(iq) |
|---|
| 1006 | end if |
|---|
| 1007 | end do |
|---|
| 1008 | write(*,*) "At reference site : " |
|---|
| 1009 | write(*,*) "Sum of mass mix. ratio (should be about 1)=",Smmr |
|---|
| 1010 | Mair_old =Smmr/Sn |
|---|
| 1011 | write(*,*) |
|---|
| 1012 | & "Air molar mass (g/mol) at reference site= ",Mair_old |
|---|
| 1013 | |
|---|
| 1014 | ! Ask for new volume mixing ratio at reference site |
|---|
| 1015 | Svmr =0. |
|---|
| 1016 | Sn =0. |
|---|
| 1017 | do iq=1,nqtot |
|---|
| 1018 | coefvmr(iq) = 1. |
|---|
| 1019 | if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar) |
|---|
| 1020 | & .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then |
|---|
| 1021 | |
|---|
| 1022 | vmr_old=q(iref,jref,1,iq)*Mair_old/mmol(iq) |
|---|
| 1023 | write(*,*) "Previous vmr("//trim(tname(iq))//")= ", vmr_old |
|---|
| 1024 | |
|---|
| 1025 | if (iq.eq.igcm_n2) then |
|---|
| 1026 | write(*,*) "New vmr(n2)? (MSL: 2.03e-02 at Ls~184)" |
|---|
| 1027 | endif |
|---|
| 1028 | if (iq.eq.igcm_ar) then |
|---|
| 1029 | write(*,*) "New vmr(ar)? (MSL: 2.07e-02 at Ls~184)" |
|---|
| 1030 | endif |
|---|
| 1031 | if (iq.eq.igcm_o2) then |
|---|
| 1032 | write(*,*) "New vmr(o2)? (MSL: 1.73e-03 at Ls~184)" |
|---|
| 1033 | endif |
|---|
| 1034 | if (iq.eq.igcm_co) then |
|---|
| 1035 | write(*,*) "New vmr(co)? (MSL: 7.49e-04 at Ls~184)" |
|---|
| 1036 | endif |
|---|
| 1037 | 302 read(*,*,iostat=ierr) vmr_new |
|---|
| 1038 | if(ierr.ne.0) goto 302 |
|---|
| 1039 | write(*,*) "New vmr("//trim(tname(iq))//")= ",vmr_new |
|---|
| 1040 | write(*,*) |
|---|
| 1041 | coefvmr(iq) = vmr_new/vmr_old |
|---|
| 1042 | Svmr=Svmr+vmr_new |
|---|
| 1043 | Sn=Sn+vmr_new*mmol(iq) |
|---|
| 1044 | end if |
|---|
| 1045 | enddo ! of do iq=1,nqtot |
|---|
| 1046 | ! Estimation of new Air molar mass at reference site (assuming vmr_co2 = 1-Svmr) |
|---|
| 1047 | Mair_new = Sn + (1-Svmr)*mmol(igcm_co2) |
|---|
| 1048 | write(*,*) |
|---|
| 1049 | & "NEW Air molar mass (g/mol) at reference site= ",Mair_new |
|---|
| 1050 | |
|---|
| 1051 | ! Compute mass mixing ratio changes |
|---|
| 1052 | do iq=1,nqtot |
|---|
| 1053 | if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar) |
|---|
| 1054 | & .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then |
|---|
| 1055 | write(*,*) "Everywhere mmr("//trim(tname(iq))// |
|---|
| 1056 | & ") is multiplied by ",coefvmr(iq)*Mair_old/Mair_new |
|---|
| 1057 | end if |
|---|
| 1058 | end do |
|---|
| 1059 | |
|---|
| 1060 | ! Recompute mass mixing ratios everywhere, and adjust mmr of most abundant species |
|---|
| 1061 | ! to keep sum of mmr constant. |
|---|
| 1062 | do l=1,llm |
|---|
| 1063 | do j=1,jjp1 |
|---|
| 1064 | do i=1,iip1 |
|---|
| 1065 | Smmr_old = 0. |
|---|
| 1066 | Smmr_new = 0. |
|---|
| 1067 | do iq=1,nqtot |
|---|
| 1068 | if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar) |
|---|
| 1069 | & .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then |
|---|
| 1070 | Smmr_old = Smmr_old + q(i,j,l,iq) ! sum of old mmr |
|---|
| 1071 | q(i,j,l,iq)=q(i,j,l,iq)*coefvmr(iq)*Mair_old/Mair_new |
|---|
| 1072 | Smmr_new = Smmr_new + q(i,j,l,iq) ! sum of new mmr |
|---|
| 1073 | end if |
|---|
| 1074 | enddo |
|---|
| 1075 | iloc = maxloc(q(i,j,l,:)) |
|---|
| 1076 | iqmax = iloc(1) |
|---|
| 1077 | q(i,j,l,iqmax) = q(i,j,l,iqmax) + Smmr_old - Smmr_new |
|---|
| 1078 | enddo |
|---|
| 1079 | enddo |
|---|
| 1080 | enddo |
|---|
| 1081 | |
|---|
| 1082 | write(*,*) |
|---|
| 1083 | & "The most abundant species is modified everywhere to keep "// |
|---|
| 1084 | & "sum of mmr constant" |
|---|
| 1085 | write(*,*) 'At reference site vmr(CO2)=', |
|---|
| 1086 | & q(iref,jref,1,igcm_co2)*Mair_new/mmol(igcm_co2) |
|---|
| 1087 | write(*,*) "Compared to MSL observation: vmr(CO2)= 0.957 "// |
|---|
| 1088 | & "at Ls=184" |
|---|
| 1089 | |
|---|
| 1090 | c wetstart : wet atmosphere with a north to south gradient |
|---|
| 1091 | c -------------------------------------------------------- |
|---|
| 1092 | else if (trim(modif) .eq. 'wetstart') then |
|---|
| 1093 | ! check that there is indeed a water vapor tracer |
|---|
| 1094 | if (igcm_h2o_vap.eq.0) then |
|---|
| 1095 | write(*,*) "No water vapour tracer! Can't use this option" |
|---|
| 1096 | stop |
|---|
| 1097 | endif |
|---|
| 1098 | DO l=1,llm |
|---|
| 1099 | DO j=1,jjp1 |
|---|
| 1100 | DO i=1,iip1-1 |
|---|
| 1101 | q(i,j,l,igcm_h2o_vap)=150.e-6 * (rlatu(j)+pi/2.) / pi |
|---|
| 1102 | ENDDO |
|---|
| 1103 | ! We want to have the very same value at lon -180 and lon 180 |
|---|
| 1104 | q(iip1,j,l,igcm_h2o_vap) = q(1,j,l,igcm_h2o_vap) |
|---|
| 1105 | ENDDO |
|---|
| 1106 | ENDDO |
|---|
| 1107 | |
|---|
| 1108 | write(*,*) 'Water mass mixing ratio at north pole=' |
|---|
| 1109 | * ,q(1,1,1,igcm_h2o_vap) |
|---|
| 1110 | write(*,*) '---------------------------south pole=' |
|---|
| 1111 | * ,q(1,jjp1,1,igcm_h2o_vap) |
|---|
| 1112 | |
|---|
| 1113 | c ini_h2osurf : reinitialize surface water ice |
|---|
| 1114 | c -------------------------------------------------- |
|---|
| 1115 | else if (trim(modif) .eq. 'ini_h2osurf') then |
|---|
| 1116 | write(*,*)'max surface ice left?(e.g. 0.2 kg/m2=200microns)' |
|---|
| 1117 | 207 read(*,*,iostat=ierr) val |
|---|
| 1118 | if(ierr.ne.0) goto 207 |
|---|
| 1119 | write(*,*)'also set negative values of surf ice to 0' |
|---|
| 1120 | do ig=1,ngridmx |
|---|
| 1121 | qsurf(ig,igcm_h2o_ice)=min(val,qsurf(ig,igcm_h2o_ice)) |
|---|
| 1122 | qsurf(ig,igcm_h2o_ice)=max(0.,qsurf(ig,igcm_h2o_ice)) |
|---|
| 1123 | end do |
|---|
| 1124 | |
|---|
| 1125 | c noglacier : remove tropical water ice (to initialize high res sim) |
|---|
| 1126 | c -------------------------------------------------- |
|---|
| 1127 | else if (trim(modif) .eq. 'noglacier') then |
|---|
| 1128 | do ig=1,ngridmx |
|---|
| 1129 | j=(ig-2)/iim +2 |
|---|
| 1130 | if(ig.eq.1) j=1 |
|---|
| 1131 | write(*,*) 'OK: remove surface ice for |lat|<45' |
|---|
| 1132 | if (abs(rlatu(j)*180./pi).lt.45.) then |
|---|
| 1133 | qsurf(ig,igcm_h2o_ice)=0. |
|---|
| 1134 | end if |
|---|
| 1135 | end do |
|---|
| 1136 | |
|---|
| 1137 | |
|---|
| 1138 | c watercapn : H20 ice on permanent northern cap |
|---|
| 1139 | c -------------------------------------------------- |
|---|
| 1140 | else if (trim(modif) .eq. 'watercapn') then |
|---|
| 1141 | do ig=1,ngridmx |
|---|
| 1142 | j=(ig-2)/iim +2 |
|---|
| 1143 | if(ig.eq.1) j=1 |
|---|
| 1144 | if (rlatu(j)*180./pi.gt.80.) then |
|---|
| 1145 | qsurf(ig,igcm_h2o_ice)=1.e5 |
|---|
| 1146 | write(*,*) 'ig=',ig,' H2O ice mass (kg/m2)= ', |
|---|
| 1147 | & qsurf(ig,igcm_h2o_ice) |
|---|
| 1148 | write(*,*)' ==> Ice mesh South boundary (deg)= ', |
|---|
| 1149 | & rlatv(j)*180./pi |
|---|
| 1150 | end if |
|---|
| 1151 | enddo |
|---|
| 1152 | |
|---|
| 1153 | c watercaps : H20 ice on permanent southern cap |
|---|
| 1154 | c ------------------------------------------------- |
|---|
| 1155 | else if (trim(modif) .eq. 'watercaps') then |
|---|
| 1156 | do ig=1,ngridmx |
|---|
| 1157 | j=(ig-2)/iim +2 |
|---|
| 1158 | if(ig.eq.1) j=1 |
|---|
| 1159 | if (rlatu(j)*180./pi.lt.-80.) then |
|---|
| 1160 | qsurf(ig,igcm_h2o_ice)=1.e5 |
|---|
| 1161 | write(*,*) 'ig=',ig,' H2O ice mass (kg/m2)= ', |
|---|
| 1162 | & qsurf(ig,igcm_h2o_ice) |
|---|
| 1163 | write(*,*)' ==> Ice mesh North boundary (deg)= ', |
|---|
| 1164 | & rlatv(j-1)*180./pi |
|---|
| 1165 | end if |
|---|
| 1166 | enddo |
|---|
| 1167 | |
|---|
| 1168 | c isotherm : Isothermal temperatures and no winds |
|---|
| 1169 | c ------------------------------------------------ |
|---|
| 1170 | else if (trim(modif) .eq. 'isotherm') then |
|---|
| 1171 | |
|---|
| 1172 | write(*,*)'Isothermal temperature of the atmosphere, |
|---|
| 1173 | & surface and subsurface' |
|---|
| 1174 | write(*,*) 'Value of this temperature ? :' |
|---|
| 1175 | 203 read(*,*,iostat=ierr) Tiso |
|---|
| 1176 | if(ierr.ne.0) goto 203 |
|---|
| 1177 | |
|---|
| 1178 | do ig=1, ngridmx |
|---|
| 1179 | tsurf(ig) = Tiso |
|---|
| 1180 | end do |
|---|
| 1181 | do l=2,nsoilmx |
|---|
| 1182 | do ig=1, ngridmx |
|---|
| 1183 | tsoil(ig,l) = Tiso |
|---|
| 1184 | end do |
|---|
| 1185 | end do |
|---|
| 1186 | flagiso=.true. |
|---|
| 1187 | call initial0(llm*ip1jmp1,ucov) |
|---|
| 1188 | call initial0(llm*ip1jm,vcov) |
|---|
| 1189 | call initial0(ngridmx*(llm+1),q2) |
|---|
| 1190 | |
|---|
| 1191 | c co2ice=0 : remove CO2 polar ice caps' |
|---|
| 1192 | c ------------------------------------------------ |
|---|
| 1193 | else if (trim(modif) .eq. 'co2ice=0') then |
|---|
| 1194 | do ig=1,ngridmx |
|---|
| 1195 | co2ice(ig)=0 |
|---|
| 1196 | emis(ig)=emis(ngridmx/2) |
|---|
| 1197 | end do |
|---|
| 1198 | |
|---|
| 1199 | ! therm_ini_s: (re)-set soil thermal inertia to reference surface values |
|---|
| 1200 | ! ---------------------------------------------------------------------- |
|---|
| 1201 | |
|---|
| 1202 | else if (trim(modif).eq.'therm_ini_s') then |
|---|
| 1203 | ! write(*,*)"surfithfi(1):",surfithfi(1) |
|---|
| 1204 | do isoil=1,nsoilmx |
|---|
| 1205 | inertiedat(1:ngridmx,isoil)=surfithfi(1:ngridmx) |
|---|
| 1206 | enddo |
|---|
| 1207 | write(*,*)'OK: Soil thermal inertia has been reset to referenc |
|---|
| 1208 | &e surface values' |
|---|
| 1209 | ! write(*,*)"inertiedat(1,1):",inertiedat(1,1) |
|---|
| 1210 | ithfi(:,:)=inertiedat(:,:) |
|---|
| 1211 | ! recast ithfi() onto ith() |
|---|
| 1212 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
|---|
| 1213 | ! Check: |
|---|
| 1214 | ! do i=1,iip1 |
|---|
| 1215 | ! do j=1,jjp1 |
|---|
| 1216 | ! do isoil=1,nsoilmx |
|---|
| 1217 | ! write(77,*) i,j,isoil," ",ith(i,j,isoil) |
|---|
| 1218 | ! enddo |
|---|
| 1219 | ! enddo |
|---|
| 1220 | ! enddo |
|---|
| 1221 | |
|---|
| 1222 | ! subsoilice_n: Put deep ice layer in northern hemisphere soil |
|---|
| 1223 | ! ------------------------------------------------------------ |
|---|
| 1224 | |
|---|
| 1225 | else if (trim(modif).eq.'subsoilice_n') then |
|---|
| 1226 | |
|---|
| 1227 | write(*,*)'From which latitude (in deg.), up to the north pole, |
|---|
| 1228 | &should we put subterranean ice?' |
|---|
| 1229 | ierr=1 |
|---|
| 1230 | do while (ierr.ne.0) |
|---|
| 1231 | read(*,*,iostat=ierr) val |
|---|
| 1232 | if (ierr.eq.0) then ! got a value |
|---|
| 1233 | ! do a sanity check |
|---|
| 1234 | if((val.lt.0.).or.(val.gt.90)) then |
|---|
| 1235 | write(*,*)'Latitude should be between 0 and 90 deg. !!!' |
|---|
| 1236 | ierr=1 |
|---|
| 1237 | else ! find corresponding jref (nearest latitude) |
|---|
| 1238 | ! note: rlatu(:) contains decreasing values of latitude |
|---|
| 1239 | ! starting from PI/2 to -PI/2 |
|---|
| 1240 | do j=1,jjp1 |
|---|
| 1241 | if ((rlatu(j)*180./pi.ge.val).and. |
|---|
| 1242 | & (rlatu(j+1)*180./pi.le.val)) then |
|---|
| 1243 | ! find which grid point is nearest to val: |
|---|
| 1244 | if (abs(rlatu(j)*180./pi-val).le. |
|---|
| 1245 | & abs((rlatu(j+1)*180./pi-val))) then |
|---|
| 1246 | jref=j |
|---|
| 1247 | else |
|---|
| 1248 | jref=j+1 |
|---|
| 1249 | endif |
|---|
| 1250 | |
|---|
| 1251 | write(*,*)'Will use nearest grid latitude which is:', |
|---|
| 1252 | & rlatu(jref)*180./pi |
|---|
| 1253 | endif |
|---|
| 1254 | enddo ! of do j=1,jjp1 |
|---|
| 1255 | endif ! of if((val.lt.0.).or.(val.gt.90)) |
|---|
| 1256 | endif !of if (ierr.eq.0) |
|---|
| 1257 | enddo ! of do while |
|---|
| 1258 | |
|---|
| 1259 | ! Build layers() (as in soil_settings.F) |
|---|
| 1260 | val2=sqrt(mlayer(0)*mlayer(1)) |
|---|
| 1261 | val3=mlayer(1)/mlayer(0) |
|---|
| 1262 | do isoil=1,nsoilmx |
|---|
| 1263 | layer(isoil)=val2*(val3**(isoil-1)) |
|---|
| 1264 | enddo |
|---|
| 1265 | |
|---|
| 1266 | write(*,*)'At which depth (in m.) does the ice layer begin?' |
|---|
| 1267 | write(*,*)'(currently, the deepest soil layer extends down to:' |
|---|
| 1268 | & ,layer(nsoilmx),')' |
|---|
| 1269 | ierr=1 |
|---|
| 1270 | do while (ierr.ne.0) |
|---|
| 1271 | read(*,*,iostat=ierr) val2 |
|---|
| 1272 | ! write(*,*)'val2:',val2,'ierr=',ierr |
|---|
| 1273 | if (ierr.eq.0) then ! got a value, but do a sanity check |
|---|
| 1274 | if(val2.gt.layer(nsoilmx)) then |
|---|
| 1275 | write(*,*)'Depth should be less than ',layer(nsoilmx) |
|---|
| 1276 | ierr=1 |
|---|
| 1277 | endif |
|---|
| 1278 | if(val2.lt.layer(1)) then |
|---|
| 1279 | write(*,*)'Depth should be more than ',layer(1) |
|---|
| 1280 | ierr=1 |
|---|
| 1281 | endif |
|---|
| 1282 | endif |
|---|
| 1283 | enddo ! of do while |
|---|
| 1284 | |
|---|
| 1285 | ! find the reference index iref the depth corresponds to |
|---|
| 1286 | ! if (val2.lt.layer(1)) then |
|---|
| 1287 | ! iref=1 |
|---|
| 1288 | ! else |
|---|
| 1289 | do isoil=1,nsoilmx-1 |
|---|
| 1290 | if((val2.gt.layer(isoil)).and.(val2.lt.layer(isoil+1))) |
|---|
| 1291 | & then |
|---|
| 1292 | iref=isoil |
|---|
| 1293 | exit |
|---|
| 1294 | endif |
|---|
| 1295 | enddo |
|---|
| 1296 | ! endif |
|---|
| 1297 | |
|---|
| 1298 | ! write(*,*)'iref:',iref,' jref:',jref |
|---|
| 1299 | ! write(*,*)'layer',layer |
|---|
| 1300 | ! write(*,*)'mlayer',mlayer |
|---|
| 1301 | |
|---|
| 1302 | ! thermal inertia of the ice: |
|---|
| 1303 | ierr=1 |
|---|
| 1304 | do while (ierr.ne.0) |
|---|
| 1305 | write(*,*)'What is the value of subterranean ice thermal inert |
|---|
| 1306 | &ia? (e.g.: 2000)' |
|---|
| 1307 | read(*,*,iostat=ierr)iceith |
|---|
| 1308 | enddo ! of do while |
|---|
| 1309 | |
|---|
| 1310 | ! recast ithfi() onto ith() |
|---|
| 1311 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
|---|
| 1312 | |
|---|
| 1313 | do j=1,jref |
|---|
| 1314 | ! write(*,*)'j:',j,'rlatu(j)*180./pi:',rlatu(j)*180./pi |
|---|
| 1315 | do i=1,iip1 ! loop on longitudes |
|---|
| 1316 | ! Build "equivalent" thermal inertia for the mixed layer |
|---|
| 1317 | ith(i,j,iref+1)=sqrt((layer(iref+1)-layer(iref))/ |
|---|
| 1318 | & (((val2-layer(iref))/(ith(i,j,iref)**2))+ |
|---|
| 1319 | & ((layer(iref+1)-val2)/(iceith)**2))) |
|---|
| 1320 | ! Set thermal inertia of lower layers |
|---|
| 1321 | do isoil=iref+2,nsoilmx |
|---|
| 1322 | ith(i,j,isoil)=iceith ! ice |
|---|
| 1323 | enddo |
|---|
| 1324 | enddo ! of do i=1,iip1 |
|---|
| 1325 | enddo ! of do j=1,jjp1 |
|---|
| 1326 | |
|---|
| 1327 | |
|---|
| 1328 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
|---|
| 1329 | |
|---|
| 1330 | ! do i=1,nsoilmx |
|---|
| 1331 | ! write(*,*)'i:',i,'ithfi(1,i):',ithfi(1,i) |
|---|
| 1332 | ! enddo |
|---|
| 1333 | |
|---|
| 1334 | |
|---|
| 1335 | ! subsoilice_s: Put deep ice layer in southern hemisphere soil |
|---|
| 1336 | ! ------------------------------------------------------------ |
|---|
| 1337 | |
|---|
| 1338 | else if (trim(modif).eq.'subsoilice_s') then |
|---|
| 1339 | |
|---|
| 1340 | write(*,*)'From which latitude (in deg.), down to the south pol |
|---|
| 1341 | &e, should we put subterranean ice?' |
|---|
| 1342 | ierr=1 |
|---|
| 1343 | do while (ierr.ne.0) |
|---|
| 1344 | read(*,*,iostat=ierr) val |
|---|
| 1345 | if (ierr.eq.0) then ! got a value |
|---|
| 1346 | ! do a sanity check |
|---|
| 1347 | if((val.gt.0.).or.(val.lt.-90)) then |
|---|
| 1348 | write(*,*)'Latitude should be between 0 and -90 deg. !!!' |
|---|
| 1349 | ierr=1 |
|---|
| 1350 | else ! find corresponding jref (nearest latitude) |
|---|
| 1351 | ! note: rlatu(:) contains decreasing values of latitude |
|---|
| 1352 | ! starting from PI/2 to -PI/2 |
|---|
| 1353 | do j=1,jjp1 |
|---|
| 1354 | if ((rlatu(j)*180./pi.ge.val).and. |
|---|
| 1355 | & (rlatu(j+1)*180./pi.le.val)) then |
|---|
| 1356 | ! find which grid point is nearest to val: |
|---|
| 1357 | if (abs(rlatu(j)*180./pi-val).le. |
|---|
| 1358 | & abs((rlatu(j+1)*180./pi-val))) then |
|---|
| 1359 | jref=j |
|---|
| 1360 | else |
|---|
| 1361 | jref=j+1 |
|---|
| 1362 | endif |
|---|
| 1363 | |
|---|
| 1364 | write(*,*)'Will use nearest grid latitude which is:', |
|---|
| 1365 | & rlatu(jref)*180./pi |
|---|
| 1366 | endif |
|---|
| 1367 | enddo ! of do j=1,jjp1 |
|---|
| 1368 | endif ! of if((val.lt.0.).or.(val.gt.90)) |
|---|
| 1369 | endif !of if (ierr.eq.0) |
|---|
| 1370 | enddo ! of do while |
|---|
| 1371 | |
|---|
| 1372 | ! Build layers() (as in soil_settings.F) |
|---|
| 1373 | val2=sqrt(mlayer(0)*mlayer(1)) |
|---|
| 1374 | val3=mlayer(1)/mlayer(0) |
|---|
| 1375 | do isoil=1,nsoilmx |
|---|
| 1376 | layer(isoil)=val2*(val3**(isoil-1)) |
|---|
| 1377 | enddo |
|---|
| 1378 | |
|---|
| 1379 | write(*,*)'At which depth (in m.) does the ice layer begin?' |
|---|
| 1380 | write(*,*)'(currently, the deepest soil layer extends down to:' |
|---|
| 1381 | & ,layer(nsoilmx),')' |
|---|
| 1382 | ierr=1 |
|---|
| 1383 | do while (ierr.ne.0) |
|---|
| 1384 | read(*,*,iostat=ierr) val2 |
|---|
| 1385 | ! write(*,*)'val2:',val2,'ierr=',ierr |
|---|
| 1386 | if (ierr.eq.0) then ! got a value, but do a sanity check |
|---|
| 1387 | if(val2.gt.layer(nsoilmx)) then |
|---|
| 1388 | write(*,*)'Depth should be less than ',layer(nsoilmx) |
|---|
| 1389 | ierr=1 |
|---|
| 1390 | endif |
|---|
| 1391 | if(val2.lt.layer(1)) then |
|---|
| 1392 | write(*,*)'Depth should be more than ',layer(1) |
|---|
| 1393 | ierr=1 |
|---|
| 1394 | endif |
|---|
| 1395 | endif |
|---|
| 1396 | enddo ! of do while |
|---|
| 1397 | |
|---|
| 1398 | ! find the reference index iref the depth corresponds to |
|---|
| 1399 | do isoil=1,nsoilmx-1 |
|---|
| 1400 | if((val2.gt.layer(isoil)).and.(val2.lt.layer(isoil+1))) |
|---|
| 1401 | & then |
|---|
| 1402 | iref=isoil |
|---|
| 1403 | exit |
|---|
| 1404 | endif |
|---|
| 1405 | enddo |
|---|
| 1406 | |
|---|
| 1407 | ! write(*,*)'iref:',iref,' jref:',jref |
|---|
| 1408 | |
|---|
| 1409 | ! thermal inertia of the ice: |
|---|
| 1410 | ierr=1 |
|---|
| 1411 | do while (ierr.ne.0) |
|---|
| 1412 | write(*,*)'What is the value of subterranean ice thermal inert |
|---|
| 1413 | &ia? (e.g.: 2000)' |
|---|
| 1414 | read(*,*,iostat=ierr)iceith |
|---|
| 1415 | enddo ! of do while |
|---|
| 1416 | |
|---|
| 1417 | ! recast ithfi() onto ith() |
|---|
| 1418 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
|---|
| 1419 | |
|---|
| 1420 | do j=jref,jjp1 |
|---|
| 1421 | ! write(*,*)'j:',j,'rlatu(j)*180./pi:',rlatu(j)*180./pi |
|---|
| 1422 | do i=1,iip1 ! loop on longitudes |
|---|
| 1423 | ! Build "equivalent" thermal inertia for the mixed layer |
|---|
| 1424 | ith(i,j,iref+1)=sqrt((layer(iref+1)-layer(iref))/ |
|---|
| 1425 | & (((val2-layer(iref))/(ith(i,j,iref)**2))+ |
|---|
| 1426 | & ((layer(iref+1)-val2)/(iceith)**2))) |
|---|
| 1427 | ! Set thermal inertia of lower layers |
|---|
| 1428 | do isoil=iref+2,nsoilmx |
|---|
| 1429 | ith(i,j,isoil)=iceith ! ice |
|---|
| 1430 | enddo |
|---|
| 1431 | enddo ! of do i=1,iip1 |
|---|
| 1432 | enddo ! of do j=jref,jjp1 |
|---|
| 1433 | |
|---|
| 1434 | |
|---|
| 1435 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
|---|
| 1436 | |
|---|
| 1437 | c 'mons_ice' : use MONS data to build subsurface ice table |
|---|
| 1438 | c -------------------------------------------------------- |
|---|
| 1439 | else if (trim(modif).eq.'mons_ice') then |
|---|
| 1440 | |
|---|
| 1441 | ! 1. Load MONS data |
|---|
| 1442 | call load_MONS_data(MONS_Hdn,MONS_d21) |
|---|
| 1443 | |
|---|
| 1444 | ! 2. Get parameters from user |
|---|
| 1445 | ierr=1 |
|---|
| 1446 | do while (ierr.ne.0) |
|---|
| 1447 | write(*,*) "Coefficient to apply to MONS 'depth' in Northern", |
|---|
| 1448 | & " Hemisphere?" |
|---|
| 1449 | write(*,*) " (should be somewhere between 3.2e-4 and 1.3e-3)" |
|---|
| 1450 | read(*,*,iostat=ierr) MONS_coeffN |
|---|
| 1451 | enddo |
|---|
| 1452 | ierr=1 |
|---|
| 1453 | do while (ierr.ne.0) |
|---|
| 1454 | write(*,*) "Coefficient to apply to MONS 'depth' in Southern", |
|---|
| 1455 | & " Hemisphere?" |
|---|
| 1456 | write(*,*) " (should be somewhere between 3.2e-4 and 1.3e-3)" |
|---|
| 1457 | read(*,*,iostat=ierr) MONS_coeffS |
|---|
| 1458 | enddo |
|---|
| 1459 | ierr=1 |
|---|
| 1460 | do while (ierr.ne.0) |
|---|
| 1461 | write(*,*) "Value of subterranean ice thermal inertia ", |
|---|
| 1462 | & " in Northern hemisphere?" |
|---|
| 1463 | write(*,*) " (e.g.: 2000, or perhaps 2290)" |
|---|
| 1464 | ! read(*,*,iostat=ierr) iceith |
|---|
| 1465 | read(*,*,iostat=ierr) iceithN |
|---|
| 1466 | enddo |
|---|
| 1467 | ierr=1 |
|---|
| 1468 | do while (ierr.ne.0) |
|---|
| 1469 | write(*,*) "Value of subterranean ice thermal inertia ", |
|---|
| 1470 | & " in Southern hemisphere?" |
|---|
| 1471 | write(*,*) " (e.g.: 2000, or perhaps 2290)" |
|---|
| 1472 | ! read(*,*,iostat=ierr) iceith |
|---|
| 1473 | read(*,*,iostat=ierr) iceithS |
|---|
| 1474 | enddo |
|---|
| 1475 | |
|---|
| 1476 | ! 3. Build subterranean thermal inertia |
|---|
| 1477 | |
|---|
| 1478 | ! initialise subsurface inertia with reference surface values |
|---|
| 1479 | do isoil=1,nsoilmx |
|---|
| 1480 | ithfi(1:ngridmx,isoil)=surfithfi(1:ngridmx) |
|---|
| 1481 | enddo |
|---|
| 1482 | ! recast ithfi() onto ith() |
|---|
| 1483 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
|---|
| 1484 | |
|---|
| 1485 | do i=1,iip1 ! loop on longitudes |
|---|
| 1486 | do j=1,jjp1 ! loop on latitudes |
|---|
| 1487 | ! set MONS_coeff |
|---|
| 1488 | if (rlatu(j).ge.0) then ! northern hemisphere |
|---|
| 1489 | ! N.B: rlatu(:) contains decreasing values of latitude |
|---|
| 1490 | ! starting from PI/2 to -PI/2 |
|---|
| 1491 | MONS_coeff=MONS_coeffN |
|---|
| 1492 | iceith=iceithN |
|---|
| 1493 | else ! southern hemisphere |
|---|
| 1494 | MONS_coeff=MONS_coeffS |
|---|
| 1495 | iceith=iceithS |
|---|
| 1496 | endif |
|---|
| 1497 | ! check if we should put subterranean ice |
|---|
| 1498 | if (MONS_Hdn(i,j).ge.14.0) then ! no ice if Hdn<14% |
|---|
| 1499 | ! compute depth at which ice lies: |
|---|
| 1500 | val=MONS_d21(i,j)*MONS_coeff |
|---|
| 1501 | ! compute val2= the diurnal skin depth of surface inertia |
|---|
| 1502 | ! assuming a volumetric heat cap. of C=1.e6 J.m-3.K-1 |
|---|
| 1503 | val2=ith(i,j,1)*1.e-6*sqrt(88775./3.14159) |
|---|
| 1504 | if (val.lt.val2) then |
|---|
| 1505 | ! ice must be below the (surface inertia) diurnal skin depth |
|---|
| 1506 | val=val2 |
|---|
| 1507 | endif |
|---|
| 1508 | if (val.lt.layer(nsoilmx)) then ! subterranean ice |
|---|
| 1509 | ! find the reference index iref that depth corresponds to |
|---|
| 1510 | iref=0 |
|---|
| 1511 | do isoil=1,nsoilmx-1 |
|---|
| 1512 | if ((val.ge.layer(isoil)).and.(val.lt.layer(isoil+1))) |
|---|
| 1513 | & then |
|---|
| 1514 | iref=isoil |
|---|
| 1515 | exit |
|---|
| 1516 | endif |
|---|
| 1517 | enddo |
|---|
| 1518 | ! Build "equivalent" thermal inertia for the mixed layer |
|---|
| 1519 | ith(i,j,iref+1)=sqrt((layer(iref+1)-layer(iref))/ |
|---|
| 1520 | & (((val-layer(iref))/(ith(i,j,iref+1)**2))+ |
|---|
| 1521 | & ((layer(iref+1)-val)/(iceith)**2))) |
|---|
| 1522 | ! Set thermal inertia of lower layers |
|---|
| 1523 | do isoil=iref+2,nsoilmx |
|---|
| 1524 | ith(i,j,isoil)=iceith |
|---|
| 1525 | enddo |
|---|
| 1526 | endif ! of if (val.lt.layer(nsoilmx)) |
|---|
| 1527 | endif ! of if (MONS_Hdn(i,j).lt.14.0) |
|---|
| 1528 | enddo ! do j=1,jjp1 |
|---|
| 1529 | enddo ! do i=1,iip1 |
|---|
| 1530 | |
|---|
| 1531 | ! Check: |
|---|
| 1532 | ! do i=1,iip1 |
|---|
| 1533 | ! do j=1,jjp1 |
|---|
| 1534 | ! do isoil=1,nsoilmx |
|---|
| 1535 | ! write(77,*) i,j,isoil," ",ith(i,j,isoil) |
|---|
| 1536 | ! enddo |
|---|
| 1537 | ! enddo |
|---|
| 1538 | ! enddo |
|---|
| 1539 | |
|---|
| 1540 | ! recast ith() into ithfi() |
|---|
| 1541 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
|---|
| 1542 | |
|---|
| 1543 | else |
|---|
| 1544 | write(*,*) ' Unknown (misspelled?) option!!!' |
|---|
| 1545 | end if ! of if (trim(modif) .eq. '...') elseif ... |
|---|
| 1546 | |
|---|
| 1547 | enddo ! of do ! infinite loop on liste of changes |
|---|
| 1548 | |
|---|
| 1549 | 999 continue |
|---|
| 1550 | |
|---|
| 1551 | |
|---|
| 1552 | c======================================================================= |
|---|
| 1553 | c Correct pressure on the new grid (menu 0) |
|---|
| 1554 | c======================================================================= |
|---|
| 1555 | |
|---|
| 1556 | if (choix_1.eq.0) then |
|---|
| 1557 | r = 1000.*8.31/mugaz |
|---|
| 1558 | |
|---|
| 1559 | do j=1,jjp1 |
|---|
| 1560 | do i=1,iip1 |
|---|
| 1561 | ps(i,j) = ps(i,j) * |
|---|
| 1562 | . exp((phisold_newgrid(i,j)-phis(i,j)) / |
|---|
| 1563 | . (t(i,j,1) * r)) |
|---|
| 1564 | end do |
|---|
| 1565 | end do |
|---|
| 1566 | |
|---|
| 1567 | c periodicity of surface ps in longitude |
|---|
| 1568 | do j=1,jjp1 |
|---|
| 1569 | ps(1,j) = ps(iip1,j) |
|---|
| 1570 | end do |
|---|
| 1571 | end if |
|---|
| 1572 | |
|---|
| 1573 | c======================================================================= |
|---|
| 1574 | c======================================================================= |
|---|
| 1575 | |
|---|
| 1576 | c======================================================================= |
|---|
| 1577 | c Initialisation de la physique / ecriture de newstartfi : |
|---|
| 1578 | c======================================================================= |
|---|
| 1579 | |
|---|
| 1580 | |
|---|
| 1581 | CALL inifilr |
|---|
| 1582 | CALL pression(ip1jmp1, ap, bp, ps, p3d) |
|---|
| 1583 | |
|---|
| 1584 | c----------------------------------------------------------------------- |
|---|
| 1585 | c Initialisation pks: |
|---|
| 1586 | c----------------------------------------------------------------------- |
|---|
| 1587 | |
|---|
| 1588 | CALL exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf) |
|---|
| 1589 | ! Calcul de la temperature potentielle teta |
|---|
| 1590 | |
|---|
| 1591 | if (flagiso) then |
|---|
| 1592 | DO l=1,llm |
|---|
| 1593 | DO j=1,jjp1 |
|---|
| 1594 | DO i=1,iim |
|---|
| 1595 | teta(i,j,l) = Tiso * cpp/pk(i,j,l) |
|---|
| 1596 | ENDDO |
|---|
| 1597 | teta (iip1,j,l)= teta (1,j,l) |
|---|
| 1598 | ENDDO |
|---|
| 1599 | ENDDO |
|---|
| 1600 | else if (choix_1.eq.0) then |
|---|
| 1601 | DO l=1,llm |
|---|
| 1602 | DO j=1,jjp1 |
|---|
| 1603 | DO i=1,iim |
|---|
| 1604 | teta(i,j,l) = t(i,j,l) * cpp/pk(i,j,l) |
|---|
| 1605 | ENDDO |
|---|
| 1606 | teta (iip1,j,l)= teta (1,j,l) |
|---|
| 1607 | ENDDO |
|---|
| 1608 | ENDDO |
|---|
| 1609 | endif |
|---|
| 1610 | |
|---|
| 1611 | C Calcul intermediaire |
|---|
| 1612 | c |
|---|
| 1613 | if (choix_1.eq.0) then |
|---|
| 1614 | CALL massdair( p3d, masse ) |
|---|
| 1615 | c |
|---|
| 1616 | print *,' ALPHAX ',alphax |
|---|
| 1617 | |
|---|
| 1618 | DO l = 1, llm |
|---|
| 1619 | DO i = 1, iim |
|---|
| 1620 | xppn(i) = aire( i, 1 ) * masse( i , 1 , l ) |
|---|
| 1621 | xpps(i) = aire( i,jjp1 ) * masse( i , jjp1 , l ) |
|---|
| 1622 | ENDDO |
|---|
| 1623 | xpn = SUM(xppn)/apoln |
|---|
| 1624 | xps = SUM(xpps)/apols |
|---|
| 1625 | DO i = 1, iip1 |
|---|
| 1626 | masse( i , 1 , l ) = xpn |
|---|
| 1627 | masse( i , jjp1 , l ) = xps |
|---|
| 1628 | ENDDO |
|---|
| 1629 | ENDDO |
|---|
| 1630 | endif |
|---|
| 1631 | phis(iip1,:) = phis(1,:) |
|---|
| 1632 | |
|---|
| 1633 | c CALL inidissip ( lstardis, nitergdiv, nitergrot, niterh, |
|---|
| 1634 | c * tetagdiv, tetagrot , tetatemp ) |
|---|
| 1635 | itau=0 |
|---|
| 1636 | if (choix_1.eq.0) then |
|---|
| 1637 | day_ini=int(date) |
|---|
| 1638 | hour_ini=date-int(date) |
|---|
| 1639 | endif |
|---|
| 1640 | c |
|---|
| 1641 | CALL geopot ( ip1jmp1, teta , pk , pks, phis , phi ) |
|---|
| 1642 | |
|---|
| 1643 | CALL caldyn0( itau,ucov,vcov,teta,ps,masse,pk,phis , |
|---|
| 1644 | * phi,w, pbaru,pbarv,day_ini+time ) |
|---|
| 1645 | c CALL caldyn |
|---|
| 1646 | c $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , |
|---|
| 1647 | c $ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, day_ini ) |
|---|
| 1648 | |
|---|
| 1649 | CALL dynredem0("restart.nc",day_ini,phis) |
|---|
| 1650 | CALL dynredem1("restart.nc",hour_ini,vcov,ucov,teta,q, |
|---|
| 1651 | . masse,ps) |
|---|
| 1652 | C |
|---|
| 1653 | C Ecriture etat initial physique |
|---|
| 1654 | C |
|---|
| 1655 | |
|---|
| 1656 | call physdem0("restartfi.nc",lonfi,latfi,nsoilmx,ngridmx,llm, |
|---|
| 1657 | . nqtot,dtphys,real(day_ini),0.0, |
|---|
| 1658 | . airefi,albfi,ithfi,zmea,zstd,zsig,zgam,zthe) |
|---|
| 1659 | call physdem1("restartfi.nc",nsoilmx,ngridmx,llm,nqtot, |
|---|
| 1660 | . dtphys,hour_ini, |
|---|
| 1661 | . tsurf,tsoil,co2ice,emis,q2,qsurf,tauscaling, |
|---|
| 1662 | . totcloudfrac) |
|---|
| 1663 | |
|---|
| 1664 | c======================================================================= |
|---|
| 1665 | c Formats |
|---|
| 1666 | c======================================================================= |
|---|
| 1667 | |
|---|
| 1668 | 1 FORMAT(//10x,'la valeur de im =',i4,2x,'lue sur le fichier de dema |
|---|
| 1669 | *rrage est differente de la valeur parametree iim =',i4//) |
|---|
| 1670 | 2 FORMAT(//10x,'la valeur de jm =',i4,2x,'lue sur le fichier de dema |
|---|
| 1671 | *rrage est differente de la valeur parametree jjm =',i4//) |
|---|
| 1672 | 3 FORMAT(//10x,'la valeur de lllm =',i4,2x,'lue sur le fichier demar |
|---|
| 1673 | *rage est differente de la valeur parametree llm =',i4//) |
|---|
| 1674 | |
|---|
| 1675 | write(*,*) "newstart: All is well that ends well." |
|---|
| 1676 | |
|---|
| 1677 | end |
|---|
| 1678 | |
|---|
| 1679 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 1680 | subroutine load_MONS_data(MONS_Hdn,MONS_d21) |
|---|
| 1681 | |
|---|
| 1682 | use datafile_mod, only:datadir |
|---|
| 1683 | |
|---|
| 1684 | implicit none |
|---|
| 1685 | ! routine to load Benedicte Diez MONS dataset, fill in date in southern |
|---|
| 1686 | ! polar region, and interpolate the result onto the GCM grid |
|---|
| 1687 | include"dimensions.h" |
|---|
| 1688 | include"paramet.h" |
|---|
| 1689 | include"comgeom.h" |
|---|
| 1690 | ! arguments: |
|---|
| 1691 | real,intent(out) :: MONS_Hdn(iip1,jjp1) ! Hdn: %WEH=Mass fraction of H2O |
|---|
| 1692 | real,intent(out) :: MONS_d21(iip1,jjp1) ! ice table "depth" (in kg/m2) |
|---|
| 1693 | ! N.B MONS datasets should be of dimension (iip1,jjp1) |
|---|
| 1694 | ! local variables: |
|---|
| 1695 | character(len=88) :: filename="results_MONS_lat_lon_H_depth.txt" |
|---|
| 1696 | character(len=88) :: txt ! to store some text |
|---|
| 1697 | integer :: ierr,i,j |
|---|
| 1698 | integer,parameter :: nblon=180 ! number of longitudes of MONS datasets |
|---|
| 1699 | integer,parameter :: nblat=90 ! number of latitudes of MONS datasets |
|---|
| 1700 | real :: pi |
|---|
| 1701 | real :: longitudes(nblon) ! MONS dataset longitudes |
|---|
| 1702 | real :: latitudes(nblat) ! MONS dataset latitudes |
|---|
| 1703 | ! MONS dataset: mass fraction of H2O where H is assumed to be in H2O |
|---|
| 1704 | real :: Hdn(nblon,nblat) |
|---|
| 1705 | real :: d21(nblon,nblat)! MONS dataset "depth" (g/cm2) |
|---|
| 1706 | |
|---|
| 1707 | ! Extended MONS dataset (for interp_horiz) |
|---|
| 1708 | real :: Hdnx(nblon+1,nblat) |
|---|
| 1709 | real :: d21x(nblon+1,nblat) |
|---|
| 1710 | real :: lon_bound(nblon+1) ! longitude boundaries |
|---|
| 1711 | real :: lat_bound(nblat-1) ! latitude boundaries |
|---|
| 1712 | |
|---|
| 1713 | ! 1. Initializations: |
|---|
| 1714 | |
|---|
| 1715 | write(*,*) "Loading MONS data" |
|---|
| 1716 | |
|---|
| 1717 | ! Open MONS datafile: |
|---|
| 1718 | open(42,file=trim(datadir)//"/"//trim(filename), |
|---|
| 1719 | & status="old",iostat=ierr) |
|---|
| 1720 | if (ierr/=0) then |
|---|
| 1721 | write(*,*) "Error in load_MONS_data:" |
|---|
| 1722 | write(*,*) "Failed opening file ", |
|---|
| 1723 | & trim(datadir)//"/"//trim(filename) |
|---|
| 1724 | write(*,*)'1) You can change this directory address in ', |
|---|
| 1725 | & 'callfis.def with' |
|---|
| 1726 | write(*,*)' datadir=/path/to/datafiles' |
|---|
| 1727 | write(*,*)'2) If necessary ',trim(filename), |
|---|
| 1728 | & ' (and other datafiles)' |
|---|
| 1729 | write(*,*)' can be obtained online at:' |
|---|
| 1730 | write(*,*)'http://www.lmd.jussieu.fr/~lmdz/planets/mars/datadir' |
|---|
| 1731 | CALL ABORT |
|---|
| 1732 | else ! skip first line of file (dummy read) |
|---|
| 1733 | read(42,*) txt |
|---|
| 1734 | endif |
|---|
| 1735 | |
|---|
| 1736 | pi=2.*asin(1.) |
|---|
| 1737 | |
|---|
| 1738 | !2. Load MONS data (on MONS grid) |
|---|
| 1739 | do j=1,nblat |
|---|
| 1740 | do i=1,nblon |
|---|
| 1741 | ! swap latitude index so latitudes go from north pole to south pole: |
|---|
| 1742 | read(42,*) latitudes(nblat-j+1),longitudes(i), |
|---|
| 1743 | & Hdn(i,nblat-j+1),d21(i,nblat-j+1) |
|---|
| 1744 | ! multiply d21 by 10 to convert from g/cm2 to kg/m2 |
|---|
| 1745 | d21(i,nblat-j+1)=d21(i,nblat-j+1)*10.0 |
|---|
| 1746 | enddo |
|---|
| 1747 | enddo |
|---|
| 1748 | close(42) |
|---|
| 1749 | |
|---|
| 1750 | ! there is unfortunately no d21 data for latitudes -77 to -90 |
|---|
| 1751 | ! so we build some by linear interpolation between values at -75 |
|---|
| 1752 | ! and assuming d21=0 at the pole |
|---|
| 1753 | do j=84,90 ! latitudes(84)=-77 ; latitudes(83)=-75 |
|---|
| 1754 | do i=1,nblon |
|---|
| 1755 | d21(i,j)=d21(i,83)*((latitudes(j)+90)/15.0) |
|---|
| 1756 | enddo |
|---|
| 1757 | enddo |
|---|
| 1758 | |
|---|
| 1759 | ! 3. Build extended MONS dataset & boundaries (for interp_horiz) |
|---|
| 1760 | ! longitude boundaries (in radians): |
|---|
| 1761 | do i=1,nblon |
|---|
| 1762 | ! NB: MONS data is every 2 degrees in longitude |
|---|
| 1763 | lon_bound(i)=(longitudes(i)+1.0)*pi/180.0 |
|---|
| 1764 | enddo |
|---|
| 1765 | ! extra 'modulo' value |
|---|
| 1766 | lon_bound(nblon+1)=lon_bound(1)+2.0*pi |
|---|
| 1767 | |
|---|
| 1768 | ! latitude boundaries (in radians): |
|---|
| 1769 | do j=1,nblat-1 |
|---|
| 1770 | ! NB: Mons data is every 2 degrees in latitude |
|---|
| 1771 | lat_bound(j)=(latitudes(j)-1.0)*pi/180.0 |
|---|
| 1772 | enddo |
|---|
| 1773 | |
|---|
| 1774 | ! MONS datasets: |
|---|
| 1775 | do j=1,nblat |
|---|
| 1776 | Hdnx(1:nblon,j)=Hdn(1:nblon,j) |
|---|
| 1777 | Hdnx(nblon+1,j)=Hdnx(1,j) |
|---|
| 1778 | d21x(1:nblon,j)=d21(1:nblon,j) |
|---|
| 1779 | d21x(nblon+1,j)=d21x(1,j) |
|---|
| 1780 | enddo |
|---|
| 1781 | |
|---|
| 1782 | ! Interpolate onto GCM grid |
|---|
| 1783 | call interp_horiz(Hdnx,MONS_Hdn,nblon,nblat-1,iim,jjm,1, |
|---|
| 1784 | & lon_bound,lat_bound,rlonu,rlatv) |
|---|
| 1785 | call interp_horiz(d21x,MONS_d21,nblon,nblat-1,iim,jjm,1, |
|---|
| 1786 | & lon_bound,lat_bound,rlonu,rlatv) |
|---|
| 1787 | |
|---|
| 1788 | end subroutine |
|---|