SUBROUTINE inifis(ngrid,nlayer, $ day_ini,pdaysec,ptimestep, $ plat,plon,parea, $ prad,pg,pr,pcpp) use radinc_h, only : naerkind use datafile_mod, only: datadir !======================================================================= ! ! purpose: ! ------- ! ! Initialisation for the physical parametrisations of the LMD ! Generic Model. ! ! author: Frederic Hourdin 15 / 10 /93 ! ------- ! modified: Sebastien Lebonnois 11/06/2003 (new callphys.def) ! Ehouarn Millour (oct. 2008) tracers are now identified ! by their names and may not be contiguously ! stored in the q(:,:,:,:) array ! E.M. (june 2009) use getin routine to load parameters ! ! ! arguments: ! ---------- ! ! input: ! ------ ! ! ngrid Size of the horizontal grid. ! All internal loops are performed on that grid. ! nlayer Number of vertical layers. ! pdayref Day of reference for the simulation ! pday Number of days counted from the North. Spring ! equinoxe. ! !======================================================================= ! !----------------------------------------------------------------------- ! declarations: ! ------------- use datafile_mod, only: datadir ! to use 'getin' USE ioipsl_getincom IMPLICIT NONE #include "dimensions.h" #include "dimphys.h" #include "planete.h" #include "comcstfi.h" #include "comsaison.h" #include "comdiurn.h" #include "comgeomfi.h" #include "callkeys.h" #include "surfdat.h" REAL prad,pg,pr,pcpp,pdaysec,ptimestep INTEGER ngrid,nlayer REAL plat(ngrid),plon(ngrid),parea(ngridmx) integer day_ini INTEGER ig,ierr EXTERNAL iniorbit,orbite EXTERNAL SSUM REAL SSUM CHARACTER ch1*12 CHARACTER ch80*80 logical chem, h2o logical :: parameter, doubleq=.false. real psurf,pN2 ! added by RW for Gliese 581d N2+CO2 rad=prad daysec=pdaysec dtphys=ptimestep cpp=pcpp g=pg r=pr rcp=r/cpp avocado = 6.02214179e23 ! added by RW ! -------------------------------------------------------- ! The usual Tests ! -------------- IF (nlayer.NE.nlayermx) THEN PRINT*,'STOP in inifis' PRINT*,'Probleme de dimensions :' PRINT*,'nlayer = ',nlayer PRINT*,'nlayermx = ',nlayermx STOP ENDIF IF (ngrid.NE.ngridmx) THEN PRINT*,'STOP in inifis' PRINT*,'Probleme de dimensions :' PRINT*,'ngrid = ',ngrid PRINT*,'ngridmx = ',ngridmx STOP ENDIF ! -------------------------------------------------------------- ! Reading the "callphys.def" file controlling some key options ! -------------------------------------------------------------- ! check that 'callphys.def' file is around OPEN(99,file='callphys.def',status='old',form='formatted' & ,iostat=ierr) CLOSE(99) IF(ierr.EQ.0) THEN PRINT* PRINT* PRINT*,'--------------------------------------------' PRINT*,' inifis: Parametres pour la physique (callphys.def)' PRINT*,'--------------------------------------------' write(*,*) "Directory where external input files are:" ! default 'datadir' is set in "datadir_mod" call getin("datadir",datadir) ! default path write(*,*) " datadir = ",trim(datadir) write(*,*) "Run with or without tracer transport ?" tracer=.false. ! default value call getin("tracer",tracer) write(*,*) " tracer = ",tracer write(*,*) "Diurnal cycle ?" write(*,*) "(if diurnal=false, diurnal averaged solar heating)" diurnal=.true. ! default value call getin("diurnal",diurnal) write(*,*) " diurnal = ",diurnal write(*,*) "Seasonal cycle ?" write(*,*) "(if season=false, Ls stays constant, to value ", & "set in 'start'" season=.true. ! default value call getin("season",season) write(*,*) " season = ",season write(*,*) "Tidally resonant rotation ?" tlocked=.false. ! default value call getin("tlocked",tlocked) write(*,*) "tlocked = ",tlocked ! Test of incompatibility: ! if tlocked, then diurnal should be false if (tlocked.and.diurnal) then print*,'If diurnal=true, we should turn off tlocked.' stop endif write(*,*) "Tidal resonance ratio ?" nres=0 ! default value call getin("nres",nres) write(*,*) "nres = ",nres write(*,*) "Write some extra output to the screen ?" lwrite=.false. ! default value call getin("lwrite",lwrite) write(*,*) " lwrite = ",lwrite write(*,*) "Save statistics in file stats.nc ?" callstats=.true. ! default value call getin("callstats",callstats) write(*,*) " callstats = ",callstats write(*,*) "Test energy conservation of model physics ?" enertest=.false. ! default value call getin("enertest",enertest) write(*,*) " enertest = ",enertest write(*,*) "call radiative transfer ?" callrad=.true. ! default value call getin("callrad",callrad) write(*,*) " callrad = ",callrad write(*,*) "call correlated-k radiative transfer ?" corrk=.true. ! default value call getin("corrk",corrk) write(*,*) " corrk = ",corrk write(*,*) "call gaseous absorption in the visible bands?", & "(matters only if callrad=T)" callgasvis=.false. ! default value call getin("callgasvis",callgasvis) write(*,*) " callgasvis = ",callgasvis write(*,*) "call continuum opacities in radiative transfer ?", & "(matters only if callrad=T)" Continuum=.false. ! default value call getin("Continuum",Continuum) write(*,*) " Continuum = ",Continuum write(*,*) "call turbulent vertical diffusion ?" calldifv=.true. ! default value call getin("calldifv",calldifv) write(*,*) " calldifv = ",calldifv write(*,*) "call convective adjustment ?" calladj=.true. ! default value call getin("calladj",calladj) write(*,*) " calladj = ",calladj write(*,*)"Gas is nonideal CO2 ?" nonideal=.false. call getin("nonideal",nonideal) write(*,*)" nonideal = ",nonideal ! Test of incompatibility if (enertest.and.nonideal) then print*,'Energy conservation calculations currently & assume ideal gas!' call abort endif write(*,*) "call CO2 condensation ?" co2cond=.true. ! default value call getin("co2cond",co2cond) write(*,*) " co2cond = ",co2cond write(*,*) "CO2 supersaturation level ?" co2supsat=1.0 ! default value call getin("co2supsat",co2supsat) write(*,*) " co2supsat = ",co2supsat write(*,*) "Radiative timescale for Newtonian cooling ?" tau_relax=30. ! default value call getin("tau_relax",tau_relax) write(*,*) " tau_relax = ",tau_relax tau_relax=tau_relax*24*3600 ! convert Earth days --> seconds write(*,*)"call thermal conduction in the soil ?" callsoil=.true. ! default value call getin("callsoil",callsoil) write(*,*) " callsoil = ",callsoil write(*,*)"Rad transfer is computed every iradia", & " physical timestep" iradia=1 ! default value call getin("iradia",iradia) write(*,*)" iradia = ",iradia write(*,*)"Rayleigh scattering ?" rayleigh=.false. call getin("rayleigh",rayleigh) write(*,*)" rayleigh = ",rayleigh write(*,*) "Use blackbody for stellar spectrum ?" stelbbody=.false. ! default value call getin("stelbbody",stelbbody) write(*,*) " stelbbody = ",stelbbody write(*,*) "Stellar blackbody temperature ?" stelTbb=5800.0 ! default value call getin("stelTbb",stelTbb) write(*,*) " stelTbb = ",stelTbb write(*,*)"Output mean OLR in 1D?" meanOLR=.false. call getin("meanOLR",meanOLR) write(*,*)" meanOLR = ",meanOLR write(*,*)"Output spectral OLR in 3D?" specOLR=.false. call getin("specOLR",specOLR) write(*,*)" specOLR = ",specOLR write(*,*)"Operate in kastprof mode?" kastprof=.false. call getin("kastprof",kastprof) write(*,*)" kastprof = ",kastprof write(*,*)"Uniform absorption coefficient in IR?" graybody=.false. call getin("graybody",graybody) write(*,*)" graybody = ",graybody ! Test of incompatibility: ! if kastprof used, we must be in 1D if (kastprof.and.(ngridmx.gt.1)) then print*,'kastprof can only be used in 1D!' call abort endif write(*,*)"Stratospheric temperature for kastprof mode?" Tstrat=167.0 call getin("Tstrat",Tstrat) write(*,*)" Tstrat = ",Tstrat write(*,*)"Remove lower boundary?" noradsurf=.false. call getin("noradsurf",noradsurf) write(*,*)" noradsurf = ",noradsurf ! Tests of incompatibility: if (noradsurf.and.callsoil) then print*,'noradsurf not compatible with soil scheme!' call abort endif if (noradsurf.and.calldifv) then print*,'noradsurf not compatible with a boundary layer!' call abort endif write(*,*)"Use Newtonian cooling for radiative transfer?" newtonian=.false. call getin("newtonian",newtonian) write(*,*)" newtonian = ",newtonian ! Tests of incompatibility: if (newtonian.and.corrk) then print*,'newtonian not compatible with correlated-k!' call abort endif if (newtonian.and.calladj) then print*,'newtonian not compatible with adjustment!' call abort endif if (newtonian.and.calldifv) then print*,'newtonian not compatible with a boundary layer!' call abort endif write(*,*)"Test physics timescale in 1D?" testradtimes=.false. call getin("testradtimes",testradtimes) write(*,*)" testradtimes = ",testradtimes ! Test of incompatibility: ! if testradtimes used, we must be in 1D if (testradtimes.and.(ngridmx.gt.1)) then print*,'testradtimes can only be used in 1D!' call abort endif write(*,*)"Default planetary temperature?" tplanet=215.0 call getin("tplanet",tplanet) write(*,*)" tplanet = ",tplanet write(*,*)"Which star?" startype=1 ! default value = Sol call getin("startype",startype) write(*,*)" startype = ",startype write(*,*)"Value of stellar flux at 1 AU?" Fat1AU=1356.0 ! default value = Sol today call getin("Fat1AU",Fat1AU) write(*,*)" Fat1AU = ",Fat1AU ! 1D solar zenith angle write(*,*)"Solar zenith angle in 1D?" szangle=60.0 call getin("szangle",szangle) write(*,*)" szangle = ",szangle ! TRACERS: write(*,*)"Fixed / inactive aerosol distribution?" aerofixed=.true. ! default value call getin("aerofixed",aerofixed) write(*,*)" aerofixed = ",aerofixed write(*,*)"Varying H2O cloud fraction?" CLFvarying=.false. ! default value call getin("CLFvarying",CLFvarying) write(*,*)" CLFvarying = ",CLFvarying write(*,*)"Value of fixed H2O cloud fraction?" CLFfixval=1.0 ! default value call getin("CLFfixval",CLFfixval) write(*,*)" CLFfixval = ",CLFfixval write(*,*)"Number mixing ratio of CO2 ice particles:" Nmix_co2=100000. ! default value call getin("Nmix_co2",Nmix_co2) write(*,*)" Nmix_co2 = ",Nmix_co2 write(*,*)"Number mixing ratio of H2O ice particles:" Nmix_h2o=10000000. ! default value call getin("Nmix_h2o",Nmix_h2o) write(*,*)" Nmix_h2o = ",Nmix_h2o write(*,*)"Opacity of dust (if used):" dusttau=0. ! default value call getin("dusttau",dusttau) write(*,*)" dusttau = ",dusttau ! Test of incompatibility: ! if less than 3 aerosols, then dusttau should = 0 if ((naerkind.lt.3).and.dusttau.gt.0.) then print*,'Need naer>2 for radiatively active dust!' stop endif write(*,*)"Cloud pressure level (with kastprof only):" cloudlvl=0. ! default value call getin("cloudlvl",cloudlvl) write(*,*)" cloudlvl = ",cloudlvl write(*,*)"Is the variable gas species radiatively active?" Tstrat=167.0 varactive=.false. call getin("varactive",varactive) write(*,*)" varactive = ",varactive write(*,*)"Is the variable gas species distribution set?" varfixed=.false. call getin("varfixed",varfixed) write(*,*)" varfixed = ",varfixed write(*,*)"What is the saturation % of the variable species?" satval=0.8 call getin("satval",satval) write(*,*)" satval = ",satval ! Test of incompatibility: ! if no tracers, then aerofixed should be true if ((.not.tracer).and.(.not.aerofixed)) then print*,'if tracers are off, aerofixed must be ON!' stop endif ! Test of incompatibility: ! if varactive, then varfixed should be false if (varactive.and.varfixed) then print*,'if varactive, varfixed must be OFF!' stop endif ! Test of incompatibility: write(*,*) "Gravitationnal sedimentation ?" sedimentation=.true. ! default value call getin("sedimentation",sedimentation) write(*,*) " sedimentation = ",sedimentation ! Test of incompatibility: write(*,*) "Compute water cycle ?" water=.false. ! default value call getin("water",water) write(*,*) " water = ",water write(*,*) "Include water condensation ?" watercond=.false. ! default value call getin("watercond",watercond) write(*,*) " watercond = ",watercond write(*,*) "Include water precipitation ?" waterrain=.false. ! default value call getin("waterrain",waterrain) write(*,*) " waterrain = ",waterrain write(*,*) "Precipitation threshold ?" rainthreshold=0.011 ! default value (Emmanuel 1997) call getin("rainthreshold",rainthreshold) write(*,*) " rainthreshold = ",rainthreshold write(*,*) "Include surface hydrology ?" hydrology=.false. ! default value call getin("hydrology",hydrology) write(*,*) " hydrology = ",hydrology write(*,*) "Evolve surface water sources ?" sourceevol=.false. ! default value call getin("sourceevol",sourceevol) write(*,*) " sourceevol = ",sourceevol write(*,*) "Ice evolution timestep ?" icetstep=100.0 ! default value call getin("icetstep",icetstep) write(*,*) " icetstep = ",icetstep write(*,*) "Snow albedo ?" albedosnow=0.5 ! default value call getin("albedosnow",albedosnow) write(*,*) " albedosnow = ",albedosnow write(*,*) "Maximum ice thickness ?" maxicethick=2.0 ! default value call getin("maxicethick",maxicethick) write(*,*) " maxicethick = ",maxicethick write(*,*) "Freezing point of seawater ?" Tsaldiff=-1.8 ! default value call getin("Tsaldiff",Tsaldiff) write(*,*) " Tsaldiff = ",Tsaldiff ! Test of incompatibility: ! if watercond is used, then water should be used too if (watercond.and.(.not.watercond)) then print*,'if watercond is used, water should be used too' stop endif mugaz=0. cpp=0. call su_gases call calc_cpp_mugaz PRINT*,'--------------------------------------------' PRINT* PRINT* ELSE write(*,*) write(*,*) 'Cannot read file callphys.def. Is it here ?' stop ENDIF 8000 FORMAT(t5,a12,l8) 8001 FORMAT(t5,a12,i8) PRINT* PRINT*,'inifis: daysec',daysec PRINT* PRINT*,'inifis: The radiative transfer is computed:' PRINT*,' each ',iradia,' physical time-step' PRINT*,' or each ',iradia*dtphys,' seconds' PRINT* !----------------------------------------------------------------------- ! Some more initialization: ! ------------------------ CALL SCOPY(ngrid,plon,1,long,1) CALL SCOPY(ngrid,plat,1,lati,1) CALL SCOPY(ngrid,parea,1,area,1) totarea=SSUM(ngridmx,area,1) DO ig=1,ngrid sinlat(ig)=sin(plat(ig)) coslat(ig)=cos(plat(ig)) sinlon(ig)=sin(plon(ig)) coslon(ig)=cos(plon(ig)) ENDDO pi=2.*asin(1.) ! NB: pi is a common in comcstfi.h RETURN END