- Timestamp:
- Mar 19, 2012, 4:44:04 PM (13 years ago)
- Location:
- trunk/LMDZ.GENERIC
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/README
r588 r589 610 610 in interp_horiz (which "fixes" an odd behaviour which fills some arrays with 611 611 zeros, but only when using some versions of ifort!) 612 613 == 19/03/2012 == AS 614 - Cleaned rcm1d.F and made it truly generic by asking for planetary constants without any default values. 615 - Settings are now needed in a rcm1d.def file. Unbeknown to the user, we create a minimal run.def file, read parameters, then remove this dummy run.def. 616 - Introduced a keyword force_cpp if the user wants to give values for cpp and mugaz in def files. -
trunk/LMDZ.GENERIC/libf/phystd/calc_cpp_mugaz.F90
r588 r589 9 9 ! unless option 'check_cpp_match' is set to false in 10 10 ! callphys.def. 11 ! NOTE: for now, in 1D we do as before. Jeremy, if you're12 ! re-writing rcm1d you may want to alter this.13 11 ! 14 12 ! Authors 15 13 ! ------- 16 14 ! Robin Wordsworth (2009) 15 ! A. Spiga: make the routine OK with latest changes in rcm1d 17 16 ! 18 17 !================================================================== … … 26 25 #include "callkeys.h" 27 26 28 real cpp_c 27 real cpp_c 29 28 real mugaz_c 30 29 … … 74 73 print*,'Predefined Mg in physics is ',mugaz,'amu' 75 74 76 if(ngridmx.eq.1)then 77 print*,'Automatically setting cpp & mugaz to calculated values in calc_cpp_mugaz' 78 cpp = cpp_c 79 mugaz = mugaz_c 80 R = 8.314511E+0 *1000.E+0/mugaz 81 rcp = R/cpp 82 ! elseif((cpp.ne.cpp_c) .or. (mugaz.ne.mugaz_c))then 83 ! Ehouarn: tolerate a small mismatch between computed/stored values 84 elseif((abs(1.-cpp/cpp_c).gt.1.e-6) .or. & 75 if (check_cpp_match) then 76 print*,'REQUEST TO CHECK cpp_match :' 77 if((abs(1.-cpp/cpp_c).gt.1.e-6) .or. & 85 78 (abs(1.-mugaz/mugaz_c).gt.1.e-6)) then 86 if(check_cpp_match)then87 print*,' Values do not match!'88 print*,' Either adjust cpp / mugaz via newstart to calculated values,'89 print*,' or set check_cpp_match to .false. in callphys.def.'79 ! Ehouarn: tolerate a small mismatch between computed/stored values 80 print*,'--> Values do not match!' 81 print*,' Either adjust cpp / mugaz via newstart to calculated values,' 82 print*,' or set check_cpp_match to .false. in callphys.def.' 90 83 stop 84 else 85 print*,'--> OK. Settings match composition.' 91 86 endif 92 87 endif 93 88 89 if (.not.force_cpp) then 90 print*,'*** Setting cpp & mugaz to computations in calc_cpp_mugaz.' 91 mugaz = mugaz_c 92 cpp = cpp_c 93 else 94 print*,'*** Setting cpp & mugaz to predefined values.' 95 endif 96 97 94 98 return 95 99 end subroutine calc_cpp_mugaz -
trunk/LMDZ.GENERIC/libf/phystd/callkeys.h
r538 r589 21 21 & , newtonian & 22 22 & , check_cpp_match & 23 & , force_cpp & 23 24 & , tau_relax & 24 25 & , testradtimes & … … 63 64 logical newtonian 64 65 logical check_cpp_match 66 logical force_cpp 65 67 logical testradtimes 66 68 logical rayleigh -
trunk/LMDZ.GENERIC/libf/phystd/inifis.F
r586 r589 182 182 write(*,*) " check_cpp_match = ",check_cpp_match 183 183 184 185 184 write(*,*) "call radiative transfer ?" 186 185 callrad=.true. ! default value … … 308 307 call abort 309 308 endif 310 if (noradsurf.and.calldifv) then311 print*,'noradsurf not compatible with a boundary layer!'312 call abort313 endif309 !if (noradsurf.and.calldifv) then 310 ! print*,'noradsurf not compatible with a boundary layer!' 311 ! call abort 312 !endif 314 313 315 314 write(*,*)"Use Newtonian cooling for radiative transfer?" … … 508 507 endif 509 508 510 mugaz=8.314*1000./pr 509 write(*,*) "Does user want to force cpp and mugaz?" 510 force_cpp=.false. ! default value 511 call getin("force_cpp",force_cpp) 512 write(*,*) " force_cpp = ",force_cpp 513 514 if (force_cpp) then 515 mugaz = -99999. 516 PRINT *,'MEAN MOLECULAR MASS in g mol-1 ?' 517 call getin("mugaz",mugaz) 518 IF (mugaz.eq.-99999.) THEN 519 PRINT *, "mugaz must be set if force_cpp = T" 520 STOP 521 ELSE 522 write(*,*) "mugaz=",mugaz 523 ENDIF 524 cpp = -99999. 525 PRINT *,'SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?' 526 call getin("cpp",cpp) 527 IF (cpp.eq.-99999.) THEN 528 PRINT *, "cpp must be set if force_cpp = T" 529 STOP 530 ELSE 531 write(*,*) "cpp=",cpp 532 ENDIF 533 else 534 mugaz=8.314*1000./pr 535 endif 511 536 call su_gases 512 537 call calc_cpp_mugaz -
trunk/LMDZ.GENERIC/libf/phystd/rcm1d.F
r586 r589 25 25 ! F. Montmessin (water ice added) 26 26 ! R. Wordsworth 27 ! B. Charnay 28 ! A. Spiga 27 29 ! 28 30 !================================================================== … … 116 118 saveprofile=.false. 117 119 118 c ---------------------------------------- --------------119 c Default values for constants(corresponding to Mars)120 c ---------------------------------------- --------------120 c ---------------------------------------- 121 c Default values (corresponding to Mars) 122 c ---------------------------------------- 121 123 122 124 pi=2.E+0*asin(1.E+0) 123 125 124 c Constante de la Planete Mars125 c ----------------------------126 rad=3397200. ! rayon de mars (m) ~3397200 m127 daysec=88775. ! duree du sol (s) ~88775 s128 omeg=4.*asin(1.)/(daysec) ! vitesse de rotation (rad.s-1)129 g=3.72 ! gravite (m.s-2) ~3.72130 mugaz=43.49 ! Masse molaire de l'atm (g.mol-1) ~43.49131 rcp=.256793 ! = r/cp ~0.256793132 r= 8.314511E+0 *1000.E+0/mugaz133 cpp= r/rcp134 year_day = 669 ! duree de l'annee (sols) ~668.6135 periastr = 206.66 ! min. dist. star-planet (Mkm) ~206.66136 apoastr = 249.22 ! max. dist. star-planet (Mkm) ~249.22137 peri_day = 485. ! date du periastron (sols depuis printemps)138 obliquit = 25.2 ! Obliquite de la planete (deg) ~25.2139 140 126 c Parametres Couche limite et Turbulence 141 127 c -------------------------------------- … … 159 145 160 146 c ------------------------------------------------------ 161 c Load parameters from "run.def" 147 c Load parameters from "run.def" and "gases.def" 162 148 c ------------------------------------------------------ 163 149 164 ! also check if 'run1d.def' file is around (otherwise reading parameters 165 ! from callphys.def via getin() routine won't work. 166 open(90,file='run.def',status='old',form='formatted', 150 ! check if 'rcm1d.def' file is around 151 open(90,file='rcm1d.def',status='old',form='formatted', 167 152 & iostat=ierr) 168 153 if (ierr.ne.0) then 169 write(*,*) 'Cannot find required file "run.def"' 170 write(*,*) ' (which should contain some input parameters' 171 write(*,*) ' along with the following line:' 172 write(*,*) ' INCLUDEDEF=callphys.def' 173 write(*,*) ' )' 154 write(*,*) 'Cannot find required file "rcm1d.def"' 155 write(*,*) 'which should contain some input parameters' 174 156 write(*,*) ' ... might as well stop here ...' 175 157 stop … … 178 160 endif 179 161 162 ! now, run.def is needed anyway. so we create a dummy temporary one 163 ! for ioipsl to work. if a run.def is already here, stop the 164 ! program and ask the user to do a bit of cleaning 165 open(90,file='run.def',status='old',form='formatted', 166 & iostat=ierr) 167 if (ierr.eq.0) then 168 close(90) 169 write(*,*) 'There is already a run.def file.' 170 write(*,*) 'This is not compatible with 1D runs.' 171 write(*,*) 'Please remove the file and restart the run.' 172 write(*,*) 'Runtime parameters are supposed to be in rcm1d.def' 173 stop 174 else 175 call system('touch run.def') 176 call system("echo 'INCLUDEDEF=callphys.def' >> run.def") 177 call system("echo 'INCLUDEDEF=rcm1d.def' >> run.def") 178 endif 179 180 180 ! check if we are going to run with or without tracers 181 181 write(*,*) "Run with or without tracer transport ?" … … 183 183 call getin("tracer",tracer) 184 184 write(*,*) " tracer = ",tracer 185 186 ! OK. now that run.def has been read once -- any variable is in memory. 187 ! so we can dump the dummy run.def 188 call system("rm -rf run.def") 185 189 186 190 ! while we're at it, check if there is a 'traceur.def' file … … 256 260 endif ! of if (tracer) 257 261 262 !!! We have to check that check_cpp_match is F for 1D computations 263 !!! We think this check is better than make a particular case for 1D in inifis or calc_cpp_mugaz 264 check_cpp_match = .false. 265 call getin("check_cpp_match",check_cpp_match) 266 if (check_cpp_match) then 267 print*,"In 1D modeling, check_cpp_match is supposed to be F" 268 print*,"Please correct callphys.def" 269 stop 270 endif 271 272 !!! GEOGRAPHICAL INITIALIZATIONS 273 !!! AREA. useless in 1D 274 area(1)=1.E+0 275 aire(1)=area(1) !JL+EM to have access to the area in the diagfi.nc files. area in comgeomfi.h and aire in comgeom.h 276 !!! GEOPOTENTIAL. useless in 1D because control bu surface pressure 277 phisfi(1)=0.E+0 278 !!! LATITUDE. can be set. 279 lati(1)=0 ! default value for lati(1) 280 PRINT *,'latitude (in degrees) ?' 281 call getin("latitude",lati(1)) 282 write(*,*) " latitude = ",lati(1) 283 lati(1)=lati(1)*pi/180.E+0 284 !!! LONGITUDE. useless in 1D. 285 long(1)=0.E+0 286 long(1)=long(1)*pi/180.E+0 287 288 !!! CALL INIFIS 289 !!! - read callphys.def 290 !!! - calculate sine and cosine of longitude and latitude 291 !!! - calculate mugaz and cp 292 !!! NB: some operations are being done dummily in inifis in 1D 293 !!! - physical constants: nevermind, things are done allright below 294 !!! - physical frequency: nevermind, in inifis this is a simple print 295 CALL inifis(1,llm,day0,daysec,dtphys, 296 . lati,long,area,rad,g,r,cpp) 297 !!! We check everything is OK. 298 PRINT *,"CHECK" 299 PRINT *,"--> mugaz = ",mugaz 300 PRINT *,"--> cpp = ",cpp 301 r = 8.314511E+0 * 1000.E+0 / mugaz 302 rcp = r / cpp 303 304 305 !!!!!!!!!!!!!!!!!!!!!!!!!!!!! 306 !!!! PLANETARY CONSTANTS !!!! 307 !!!!!!!!!!!!!!!!!!!!!!!!!!!!! 308 309 g = -99999. 310 PRINT *,'GRAVITY in m s-2 ?' 311 call getin("g",g) 312 IF (g.eq.-99999.) THEN 313 PRINT *,"STOP. I NEED g IN RUN.DEF." 314 STOP 315 ELSE 316 PRINT *,"--> g = ",g 317 ENDIF 318 319 !rad = -99999. 320 !PRINT *,'PLANETARY RADIUS in m ?' 321 !call getin("rad",rad) 322 !IF (rad.eq.-99999.) THEN 323 ! PRINT *,"STOP. I NEED rad IN RUN.DEF." 324 ! STOP 325 !ELSE 326 ! PRINT *,"--> rad = ",rad 327 !ENDIF 328 329 daysec = -99999. 330 PRINT *,'LENGTH OF A DAY in s ?' 331 call getin("daysec",daysec) 332 IF (daysec.eq.-99999.) THEN 333 PRINT *,"STOP. I NEED daysec IN RUN.DEF." 334 STOP 335 ELSE 336 PRINT *,"--> daysec = ",daysec 337 ENDIF 338 omeg=4.*asin(1.)/(daysec) 339 PRINT *,"OK. FROM THIS I WORKED OUT:" 340 PRINT *,"--> omeg = ",omeg 341 342 year_day = -99999. 343 PRINT *,'LENGTH OF A YEAR in days ?' 344 call getin("year_day",year_day) 345 IF (year_day.eq.-99999.) THEN 346 PRINT *,"STOP. I NEED year_day IN RUN.DEF." 347 STOP 348 ELSE 349 PRINT *,"--> year_day = ",year_day 350 ENDIF 351 352 periastr = -99999. 353 PRINT *,'MIN DIST STAR-PLANET in AU ?' 354 call getin("periastr",periastr) 355 IF (periastr.eq.-99999.) THEN 356 PRINT *,"STOP. I NEED periastr IN RUN.DEF." 357 STOP 358 ELSE 359 PRINT *,"--> periastr = ",periastr 360 ENDIF 361 periastr=periastr*149.598 ! AU to Mkm 362 363 apoastr = -99999. 364 PRINT *,'MIN DIST STAR-PLANET in AU ?' 365 call getin("apoastr",apoastr) 366 IF (apoastr.eq.-99999.) THEN 367 PRINT *,"STOP. I NEED apoastr IN RUN.DEF." 368 STOP 369 ELSE 370 PRINT *,"--> apoastr = ",apoastr 371 ENDIF 372 apoastr=apoastr*149.598 ! AU to Mkm 373 374 peri_day = -99999. 375 PRINT *,'DATE OF PERIASTRON in days ?' 376 call getin("peri_day",peri_day) 377 IF (peri_day.eq.-99999.) THEN 378 PRINT *,"STOP. I NEED peri_day IN RUN.DEF." 379 STOP 380 ELSE IF (peri_day.gt.year_day) THEN 381 PRINT *,"STOP. peri_day.gt.year_day" 382 STOP 383 ELSE 384 PRINT *,"--> peri_day = ", peri_day 385 ENDIF 386 387 obliquit = -99999. 388 PRINT *,'OBLIQUITY in deg ?' 389 call getin("obliquit",obliquit) 390 IF (obliquit.eq.-99999.) THEN 391 PRINT *,"STOP. I NEED obliquit IN RUN.DEF." 392 STOP 393 ELSE 394 PRINT *,"--> obliquit = ",obliquit 395 ENDIF 396 397 psurf = -99999. 398 PRINT *,'SURFACE PRESSURE in Pa ?' 399 call getin("psurf",psurf) 400 IF (psurf.eq.-99999.) THEN 401 PRINT *,"STOP. I NEED psurf IN RUN.DEF." 402 STOP 403 ELSE 404 PRINT *,"--> psurf = ",psurf 405 ENDIF 406 !! we need reference pressures 407 pa=psurf/30. 408 preff=psurf ! these values are not needed in 1D (are you sure JL12) 409 410 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 411 !!!! END PLANETARY CONSTANTS !!!! 412 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 258 413 259 414 c Date et heure locale du debut du run … … 298 453 ndt=ndt*day_step 299 454 dtphys=daysec/day_step 300 455 write(*,*)"-------------------------------------" 456 write(*,*)"-------------------------------------" 457 write(*,*)"--> Physical timestep is ",dtphys 458 write(*,*)"-------------------------------------" 459 write(*,*)"-------------------------------------" 301 460 302 461 c output spectrum? … … 306 465 write(*,*)" specOLR = ",specOLR 307 466 308 309 c Pression de surface sur la planete 310 c ------------------------------------ 311 c 312 psurf=100000. ! default value for psurf 313 PRINT *,'Surface pressure (Pa) ?' 314 call getin("psurf",psurf) 315 write(*,*) " psurf = ",psurf 316 c Pression de reference 317 pa=psurf/30. 318 preff=psurf ! these values are not needed in 1D (are you sure JL12) 319 320 c Gravity of planet 321 c ----------------- 322 g=10.0 ! default value for g 323 PRINT *,'Gravity ?' 324 call getin("g",g) 325 write(*,*) " g = ",g 326 327 mugaz=0. 328 cpp=0. 329 330 call su_gases 331 call calc_cpp_mugaz 332 333 467 !!! AS12: what shall we do with this? 334 468 c Proprietes des poussiere aerosol 335 469 c -------------------------------- … … 339 473 write(*,*) " tauvis = ",tauvis 340 474 341 c latitude/longitude342 c ------------------343 lati(1)=0 ! default value for lati(1)344 PRINT *,'latitude (in degrees) ?'345 call getin("latitude",lati(1))346 write(*,*) " latitude = ",lati(1)347 lati(1)=lati(1)*pi/180.E+0348 long(1)=0.E+0349 long(1)=long(1)*pi/180.E+0350 351 c periastron/apoastron352 c --------------------353 periastr=227.94354 apoastr=227.94 ! default = mean martian values355 PRINT *,'periastron (in AU) ?'356 call getin("periastr",periastr)357 write(*,*) "periastron = ",periastr358 periastr=periastr*149.598 ! AU to Mkm359 PRINT *,'apoastron (in AU) ?'360 call getin("apoastr",apoastr)361 write(*,*) "apoastron = ",apoastr362 apoastr=apoastr*149.598 ! AU to Mkm363 364 c obliquity365 c ---------366 obliquit=0.0! default=zero in 1d367 PRINT *,'obliquity (in AU) ?'368 call getin("obliquit",obliquit)369 write(*,*) "obliquity = ",obliquit370 371 c Initialisation albedo / inertie du sol372 c --------------------------------------373 albedodat(1)=0.2 ! default value for albedodat374 PRINT *,'Albedo of bare ground ?'375 call getin("albedo",albedodat(1))376 write(*,*) " albedo = ",albedodat(1)377 378 inertiedat(1,1)=400 ! default value for inertiedat379 PRINT *,'Soil thermal inertia (SI) ?'380 call getin("inertia",inertiedat(1,1))381 write(*,*) " inertia = ",inertiedat(1,1)382 475 c 383 476 c pour le schema d'ondes de gravite 384 477 c --------------------------------- 385 c386 478 zmea(1)=0.E+0 387 479 zstd(1)=0.E+0 … … 403 495 ENDDO 404 496 405 c Initialisation speciales "physiq"406 c ---------------------------------407 c la surface de chaque maille est inutile en 1D --->408 area(1)=1.E+0409 aire(1)=area(1) !JL+EM to have access to the area in the diagfi.nc files. area in comgeomfi.h and aire in comgeom.h410 411 c le geopotentiel au sol est inutile en 1D car tout est controle412 c par la pression de surface --->413 phisfi(1)=0.E+0414 415 c "inifis" reproduit un certain nombre d'initialisations deja faites416 c + lecture des clefs de callphys.def417 c + calcul de la frequence d'appel au rayonnement418 c + calcul des sinus et cosinus des longitude latitude419 420 !Mars possible issue with dtphys in input and include!!!421 CALL inifis(1,llm,day0,daysec,dtphys,422 . lati,long,area,rad,g,r,cpp)423 497 c Initialisation pour prendre en compte les vents en 1-D 424 498 c ------------------------------------------------------ … … 488 562 write(*,*) " autozlevs = ", autozlevs 489 563 490 pceil =100.0 ! Pascals564 pceil = psurf / 1000.0 ! Pascals 491 565 PRINT *,'Ceiling pressure (Pa) ?' 492 566 call getin("pceil",pceil) … … 571 645 572 646 647 c Initialisation albedo / inertie du sol 648 c -------------------------------------- 649 albedodat(1)=0.2 ! default value for albedodat 650 PRINT *,'Albedo of bare ground ?' 651 call getin("albedo",albedodat(1)) 652 write(*,*) " albedo = ",albedodat(1) 653 654 inertiedat(1,1)=400 ! default value for inertiedat 655 PRINT *,'Soil thermal inertia (SI) ?' 656 call getin("inertia",inertiedat(1,1)) 657 write(*,*) " inertia = ",inertiedat(1,1) 573 658 574 659 ! Initialize soil properties and temperature
Note: See TracChangeset
for help on using the changeset viewer.