📄 parse_namelist.f90
字号:
!! Disclaimer: The namelist items, nhstpr, fhstpr1-fhstpr6, fhstwrtpr1-fwrtpr6,! ideal_phys, trace_gas, bndtvg, sulfdata, scenario_ghg, scenario_so4, ! scenario_scon, rampYear_ghg, rampYear_so4, and rampYear_scon! are considered unsuported features. The code may not even run with! these options and has NOT been verified to create correct science.! As such these options should only be used at the users discression.! namelist /camexp/ ctitle ,ncdata ,bndtvs ,bndtvo , bndtvg , & rest_pfile,mss_wpass,nsrest ,mss_irt , archive_dir, & nrevsn ,nhstpr ,ndens ,nhtfrq , & nrefrq ,mfilt ,absems_data , & fincl1 ,fincl2 ,fincl3 ,fincl4 ,fincl5 , & fincl6 ,fexcl1 ,fexcl2 ,fexcl3 ,fexcl4 , & fexcl5 ,fexcl6 ,hfilename_spec, & fhstpr1 ,fhstpr2 ,fhstpr3 ,fhstpr4 ,fhstpr5 ,fhstpr6 , & fwrtpr1 ,fwrtpr2 ,fwrtpr3, fwrtpr4 ,fwrtpr5 ,fwrtpr6 , & calendar, dtime, nelapse, nestep, start_ymd, start_tod, & stop_ymd, stop_tod, ref_ymd, ref_tod, perpetual_run, & perpetual_ymd, & eps ,dif2 ,dif4 ,kmxhdc ,iradsw , & iradlw ,iradae ,itsst ,nlvdry ,sstcyc , & ozncyc , & pertlim , & divdampn,caseid ,adiabatic,flxave , & trace_gas,trace_test1 , & trace_test2,trace_test3 ,readtrace, & co2vmr ,ch4vmr ,n2ovmr ,f11vmr ,f12vmr , & obliq ,eccen ,mvelp ,iyear_AD,scon , & inithist,tauvis ,linebuf ,ideal_phys, & nusr_adv,nusr_nad,aqua_planet, & indirect, sulfdata, nsplit, & iord, jord, kord, use_eta, & scenario_ghg, scenario_so4, scenario_scon, & rampYear_ghg, rampYear_so4, rampYear_scon, empty_htapes, & print_step_cost, avgflag_pertape,prognostic_icesnow, & reset_csim_iceprops#endif! !------------------------------Externals--------------------------------! character(len=8), external :: upcase ! Uppercase 8-character variable! !-----------------------------------------------------------------------!! Preset scenario variables and ramping year! scenario_ghg = 'FIXED' scenario_so4 = 'FIXED' scenario_scon = 'FIXED' rampYear_ghg = 0 rampYear_so4 = 0 rampYear_scon = 0!! Finite volume code only: Set Lagrangian time splits. A default of zero indicates the number! should be automatically computed unless the user enters something.! nsplit = 0 iord = 4 jord = 4 kord = 4 use_eta = .false. ! Use a's and b's from the initial file!! Preset sulfate aerosol related variables sulfdata = ' ' indirect = .false.! ! Set anncyc true, no longer in namelist! anncyc = .true. if (masterproc) then!! Read in the camexp namelist from standard input! read (5,camexp,iostat=ierr) if (ierr /= 0) then write(6,*)'PARSE_NAMELIST: Namelist read returns ',ierr call endrun end if! ! Check CASE namelist variable! if (caseid==' ') then write(6,*)'PARSE_NAMELIST: Namelist variable CASEID must be set' call endrun end if lastchar = len(caseid) if (caseid(lastchar:lastchar) /= ' ') then write(6,*)'PARSE_NAMELIST: CASEID must not exceed ', len(caseid)-1, & ' characters' call endrun end if icecyc = sstcyc ! ice-cycling is tied to the sst-dataset#ifndef COUP_CSM!! Data ice-model can not use prognostic snow-depth or reset the ice properties! if ( icemodel_is('data') )then if ( .not. prognostic_icesnow ) & write(6,*) 'Warning: prognostic_icesnow for data-ice-model is always false' prognostic_icesnow = .false. if ( .not. reset_csim_iceprops ) & write(6,*) 'Warning: reset_csim_iceprops for data-ice-model is always false' reset_csim_iceprops = .false. end if#endif end if!! Line buffer stdout if requested! if (linebuf) then! call flush(6) call linebuf_stdout () end if#if ( defined SPMD ) call distnl ( & scenario_ghg , rampYear_ghg , & scenario_so4 , rampYear_so4 , & scenario_scon, rampYear_scon)#endif! Communicate to time manager (there should be a method for this). tm_aqua_planet = aqua_planet! ! Set continuation run flags! if (nsrest>0) then nlres = .true. endif if (nsrest==2) then write(6,*)'PARSE_NAMELIST: The regeneration option is no longer available' call endrun end if if (nsrest==3) then nlhst = .true. lbrnch = .true. endif#if ( defined COUP_CSM )!! Check that flxave occurs only if iradsw is gt 1! if (flxave .and. iradsw==1 ) then write(6,*)'PARSE_NAMELIST: iradsw must be greater that one if flux averaging option is enabled' call endrun endif#endif!++mv!! Determine ramping logic! if (scenario_ghg == 'FIXED') then doRamp_ghg = .false. else if (scenario_ghg == 'RAMPED') then doRamp_ghg = .true. else if (masterproc) & write(6,*)' PARSE_NAMELIST: input namelist SCENARIO_GHG must be set to either FIXED or RAMPED' call endrun endif if (scenario_so4 == 'FIXED') then doRamp_so4 = .false. else if (scenario_so4 == 'RAMPED') then doRamp_so4 = .true. if (sulfdata == ' ') then if (masterproc) & write(6,*)'PARSE_NAMELIST: SULFDATA must be specified for SCENARIO_SO4 set to RAMPED' call endrun endif else if (masterproc) & write(6,*)' PARSE_NAMELIST: input namelist SCENARIO_SO4 must be set to either', & ' FIXED or RAMPED' call endrun endif if (scenario_scon == 'FIXED') then doRamp_scon = .false. else if (scenario_scon == 'RAMPED') then doRamp_scon = .true. else if (masterproc) & write(6,*)' PARSE_NAMELIST: input namelist SCENARIO_SCON must be set to either FIXED or RAMPED' call endrun endif! ! Initialize namelist related ghg info! if (doRamp_ghg) then call rampnl_ghg( rampYear_ghg ) if (masterproc) write(6,*) 'co2,nh4,n2o,cfc11,cfc12 volume mixing ratios set by ghg ramp code' else if (masterproc) then write(6,*) 'global co2 volume mixing ratio = ',co2vmr write(6,*) 'global ch4 volume mixing ratio = ',ch4vmr write(6,*) 'global n2o volume mixing ratio = ',n2ovmr write(6,*) 'global f11 volume mixing ratio = ',f11vmr write(6,*) 'global f12 volume mixing ratio = ',f12vmr end if endif!! Initialize namelist related so4 info! if (doRamp_so4) then call rampnl_so4( rampYear_so4 ) call so4bndnl( sulfdata ) endif! ! Initialize namelist related scon info! if (doRamp_scon) then call rampnl_scon( rampYear_scon ) if (masterproc) write(6,*)'scon set by ramp code' else if (masterproc) write(6,*)'scon set to fixed value of ',scon endif!! Auxiliary history files:! Store input auxf values in array aux (from common block /comhst/).!! If generate an initial conditions history file as an auxillary tape:! ctemp = upcase(inithist) inithist = trim(ctemp) if (inithist /= 'MONTHLY' .and. inithist /= 'YEARLY') then inithist = 'NONE' endif!! Ensure that monthly averages have not been specified for aux. tapes! do t=2,ptapes if (nhtfrq(t) == 0) then write(6,*)'PARSE_NAMELIST: Only the primary history file may be monthly averaged' call endrun end if end do! ! History file write up times! Convert write freq. of hist files from hours to timesteps if necessary.! do t=1,ptapes if (nhtfrq(t) < 0) then nhtfrq(t) = nint((-nhtfrq(t)*3600.)/dtime) end if end do!! Initialize the filename specifier if not already set! This is the format for the history filenames:! %c= caseid, %t=tape no., %y=year, %m=month, %d=day, %s=second, %%=%! See the filenames module for more information! do t = 1, ptapes if ( len_trim(hfilename_spec(t)) == 0 )then if ( nhtfrq(t) == 0 )then hfilename_spec(t) = '%c.cam2.h%t.%y-%m.nc' ! Monthly files else hfilename_spec(t) = '%c.cam2.h%t.%y-%m-%d-%s.nc' end if end if if ( masterproc ) then write(6,*) 'Filename specifier for tape ', t, ' = ', & trim(hfilename_spec(t)) end if end do!! Only one time sample allowed per monthly average file! if (nhtfrq(1) == 0) mfilt(1) = 1!! Check validity of per-tape averaging flag! do t=1,ptapes if (avgflag_pertape(t) /= ' ') then if (avgflag_pertape(t) == 'A' .or. avgflag_pertape(t) == 'I' .or. & avgflag_pertape(t) == 'X' .or. avgflag_pertape(t) == 'M') then write(6,*)'Unless overridden by namelist input on a per-field basis (FINCL),' write(6,*)'All fields on history file ',t,' will have averaging flag ',avgflag_pertape(t) else write(6,*)'Invalid per-tape averaging flag specified:', avgflag_pertape(t) call endrun () end if end if end do! ! Convert iradsw and iradlw from hours to timesteps if necessary! if (iradsw < 0) iradsw = nint((-iradsw*3600.)/dtime) if (iradlw < 0) iradlw = nint((-iradlw*3600.)/dtime)! ! Convert iradae from hours to timesteps if necessary and check that! iradae must be an even multiple of iradlw! if (iradae < 0) iradae = nint((-iradae*3600.)/dtime) if (mod(iradae,iradlw)/=0) then write(6,*)'PARSE_NAMELIST:iradae must be an even multiple of iradlw.' write(6,*)' iradae = ',iradae,', iradlw = ',iradlw call endrun end if! ! Do absorptivities/emissivities have to go on a restart dataset?! if (nhtfrq(1) /= 0) then if (masterproc .and. mod(nhtfrq(1),iradae)/=0) then write(6,*)'PARSE_NAMELIST: *** NOTE: Extra overhead invoked putting', & ' a/e numbers on restart dataset. *** ', & ' To avoid, make mod(nhtfrq,iradae) = 0' end if else ntspdy = nint(86400./dtime) ! no. timesteps per day if (masterproc) then if (mod(ntspdy,iradae) /= 0 .or. iradae > ntspdy) then write(6,*)'PARSE_NAMELIST: *** NOTE: Extra overhead invoked', & ' putting a/e numbers on restart dataset. ***' write(6,*)' To avoid, make mod(timesteps per day,iradae)= 0' end if end if end if! ! Number of levels to apply Courant limiter! if (kmxhdc >= plev .or. kmxhdc < 0) then write(6,*)'PARSE_NAMELIST: KMXHDC must be between 0 and plev-1' call endrun end if! ! Build MSS pathname for restart file for branch run.! Note that full (absolute) pathname must be input as nrevsn.! if (lbrnch .and. (nrevsn(1:1) /= '/') ) then write(6,*)'PARSE_NAMELIST: for BRANCH run, NREVSN must be a full pathname.' call endrun endif!! Restart files write frequence!#if ( defined COUP_CSM ) nrefrq = 1#else if (nrefrq /= 0) then if ((nrefrq /= 1)) then write(6,*) 'PARSE_NAMELIST: the value of NREFRQ must be 1 or 0' call endrun endif end if#endif!! Initialize file paths module! call init_filepaths( archivedirname=archive_dir )!! If branch set restart filepath to path given on namelist! if ( lbrnch ) call set_restart_filepath( nrevsn )! ! Print camexp input variables to standard output! if (masterproc) then write(6,*)'PARSE_NAMELIST:rest_pfile= ',rest_pfile write(6,*)' ------------------------------------------' write(6,*)' *** INPUT VARIABLES (CAMEXP) ***' write(6,*)' ------------------------------------------' if (nlres) then write(6,*) ' Continuation of an earlier run' else write(6,*) ' Initial run' end if write(6,*) ' ********** CASE = ',trim(caseid),' **********' write(6,'(1x,a80)') ctitle if (len_trim(ncdata) > 0) then write(6,*) 'Initial dataset is: ',trim(ncdata) end if write(6,*) ' History-file archive directory = ', trim(get_archivedir('hist')) write(6,*) ' Restart-file archive directory = ', trim(get_archivedir('rest')) write(6,*) ' Initial-file archive directory = ', trim(get_archivedir('init'))#if ( ! defined COUP_CSM ) write(6,*)'Time-variant boundary dataset (sst) is: ', trim(bndtvs)#endif write(6,*)'Time-variant boundary dataset (ozone) is: ', trim(bndtvo) write(6,*)'Time-invariant (absorption/emissivity) factor dataset is: ', trim(absems_data) if ( trace_gas ) then write(6,*)'Time-variant boundary dataset (greenhouse loss rates) is: ', trim(bndtvg) end if!! Restart files info! if (nrefrq == 1) then write(6,*)'PARSE_NAMELIST3:rest_pfile=',rest_pfile write(6,*)'Restart pointer file is: ',trim(rest_pfile) else if (nrefrq==0) then write(6,*) 'NO RESTART DATASET will be written' endif#if ( defined COUP_CSM ) write(6,*)'Restart files will be written only when specified by the flux coupler'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -