namelist.osm.sh 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # namelist.osm.sh
  2. ## TO FIX
  3. #--------------------------------------
  4. # Setup defaults
  5. # -------------------------------------
  6. LEVGEN=${LEVGEN:-true}
  7. LESSRO=${LESSRO:-true}
  8. LESN09=${LESN09:-true}
  9. LRDALB=${LRDALB:-false}
  10. N_COMPUTE_EFF_VEG_FRACTION=${n_compute_eff_veg_fraction}
  11. LE4ALB=${LE4ALB:-true}
  12. LELAIV=${LELAIV:-true}
  13. LREADDAY=${LREADDAY:-true}
  14. NINDAT=$(date -u -d "${run_start_date}" +%Y%m%d)
  15. IFYYYY=$(echo $leg_start_date_yyyymmdd | cut -c1-4)
  16. IFMM=$(echo $leg_start_date_yyyymmdd | cut -c5-6)
  17. IFDD=$(echo $leg_start_date_yyyymmdd| cut -c7-8)
  18. IFTIM=0000
  19. # Find out forcing frequency
  20. t2=$( cdo -s -infov -selvar,LWdown -seltimestep,2 ${osm_forcing_dir}/${leg_start_date_yyyy}/LWdown.nc | tail -1 | awk '{print $3,$4}')
  21. t1=$( cdo -s -infov -selvar,LWdown -seltimestep,1 ${osm_forcing_dir}/${leg_start_date_yyyy}/LWdown.nc | tail -1 | awk '{print $3,$4}')
  22. ZDTFORC=$(( $( date -u -d "$t2" +%s) - $( date -u -d "$t1" +%s) ))
  23. [ $LREADDAY = true ] && NDFORC=$(( 86400/ZDTFORC +2 )) || NDFORC=1
  24. # set the reference levels for near-surface temp, humidity and wind
  25. # ZPHISTA REFERENCE LEVEL (FOR T, Q)
  26. # ZUV REFERENCE LEVEL FOR WIND
  27. # ZPHISTA is assumed to be always 2, except for erai and era5
  28. ZPHISTA=2.
  29. case "${osm_forcing_type}" in
  30. ifs) ZPHISTA=2. ;;
  31. erai) ZPHISTA=10. ;;
  32. era5) ZPHISTA=10. ;;
  33. e20c) ZPHISTA=2. ;;
  34. gswp3) ZPHISTA=2. ;;
  35. *) info "unknown OSM forcing type osm_forcing_type, setting ZPHISTA=2."
  36. ;;
  37. esac
  38. # ZUV is assumed to be always 10
  39. ZUV=10.
  40. LPROD=".TRUE."
  41. LPROD2=".FALSE."
  42. NDLEVEL=0
  43. NCDFTYPE=4
  44. case "${ifs_grid}" in
  45. T159L*) NLON=35718 ;;
  46. T255L*) NLON=88838 ;;
  47. T511L*) NLON=348528 ;;
  48. *) error "Can't set time steps for unknown horizontal grid: ${ifs_grid}"
  49. ;;
  50. esac
  51. # end of Defaults
  52. # ---------------------------------------
  53. #--------------------------------------
  54. # Start || Restart
  55. #-------------------------------------
  56. NSTART=$(( leg_start_sec / ifs_time_step_sec ))
  57. NSTOP=$(( leg_end_sec / ifs_time_step_sec ))
  58. # TODO check this when multi-year files are generated!
  59. forcing_end=$(cdo -s -infov -selvar,LWdown -seltimestep,-1 ${osm_forcing_dir}/${leg_end_date_yyyy}/LWdown.nc | tail -1 | awk '{print $3,$4}')
  60. forcing_end=$(date -uR -d "${forcing_end}")
  61. forcing_end_sec=$(( $(date -u -d "${forcing_end}" +%s) - $(date -u -d "${run_start_date}" +%s) ))
  62. if [ ${forcing_end_sec} -lt ${leg_end_sec} ]
  63. then
  64. if [ $(date -u -d "${leg_end_date}" +%s) -eq $(date -u -d "${run_end_date}" +%s) ] && [ $((forcing_end_sec+ZDTFORC)) = $leg_end_sec ]
  65. then
  66. NSTOP=$(( forcing_end_sec / ifs_time_step_sec ))
  67. else
  68. info "$NSTOP,$forcing_end,$forcing_end_sec"
  69. error "NSTOP > forcing availability"
  70. fi
  71. fi
  72. if [ $NSTART = 0 ]
  73. then
  74. # Start
  75. LNF=true
  76. ln -sf soilinit restartin.nc
  77. else
  78. # Restart
  79. test -f restartin.nc || error "restartin.nc not present"
  80. LNF=false
  81. fi
  82. ## Find out domain size
  83. NLAT=$( ncdump -h restartin.nc | grep "^.y = " | head -1 | awk '{print $3}' )
  84. NLON=$( ncdump -h restartin.nc | grep "^.x = " | head -1 | awk '{print $3}' )
  85. if [[ $NLON = "" ]]; then
  86. NLAT=$( ncdump -h restartin.nc | grep "^.lat = " | head -1 | awk '{print $3}' )
  87. NLON=$( ncdump -h restartin.nc | grep "^.lon = " | head -1 | awk '{print $3}' )
  88. fi
  89. NDIMCDF=2
  90. if [[ $NLAT = "" ]]; then
  91. NDIMCDF=1
  92. NLAT=0
  93. fi
  94. # Switch on/off LPJ-GUESS feedback to IFS
  95. (( ${lpjg_on:-} )) && LLPJGON=TRUE || LLPJGON=FALSE
  96. (( ${lpjg_fdbck:-} )) && LLPJGFBON=TRUE || LLPJGFBON=FALSE
  97. cat << EOF
  98. &NAMCT01S
  99. NSTART=$NSTART ! first timestep of model 0
  100. NSTOP=$NSTOP ! last timestep of model 17520
  101. NFRPOS=$ifs_output_freq ! frequency of post-processing events (time-steps)
  102. NFRRES=0 ! frequency of writing intermediate restart files (time-steps)
  103. LNF=$LNF ! .T. = start, .F. = restart
  104. NCYCLE=1 ! number of the experiment
  105. CNMEXP="${exp_name}" ! name of the experiment
  106. /
  107. &NAMDYN1S
  108. TSTEP=$ifs_time_step_sec ! TSTEP : length of the timestep in seconds
  109. NACCTYPE=2 ! =0 Forcing fluxes assument centered on timestamp (linear interp.)
  110. ! =1 forward accumulation (starting at timestamp)
  111. ! =2 backward accumulation (ending at timestamp)
  112. LSWINT=.TRUE. ! SWdown solar angle interpolation if true
  113. LPREINT=.FALSE. ! precipitation interpolation if true
  114. LFLXINT=.FALSE. ! SWdown/LWdown linear interpolation if true
  115. /
  116. &NAMDIM
  117. NLAT=$NLAT ! number of latitudes
  118. NLON=$NLON ! number of longitudes
  119. NDFORC=$NDFORC ! namelist forcing dimension
  120. NSLAB=0 ! 2D, NSLAB = nr of latitude lines
  121. NPROMA=240 ! working dimension for grid-point computations
  122. /
  123. &NAMRIP
  124. NINDAT=${NINDAT} ! run initial date in the form YYYYMMDD
  125. NSSSSS=0 ! initial time in seconds (e.g. for 12h, 43200)
  126. /
  127. &NAM1S
  128. CFFORC='netcdf' ! CHARACTER: IDENTIFIES THE FORCING DATA SET
  129. CFOUT='netcdf' ! CHARACTER: IDENTIFIES THE OUTPUT DATA SET
  130. CFSURF='netcdf' ! CHARACTER: IDENTIFIES THE SURFACE CLIMATOLOGY DATA SET
  131. CFINIT='netcdf' ! CHARACTER: IDENTIFIES THE INITIALIZATION DATA SET
  132. CMODID='EC-EARTH' ! CHARACTER: MODEL IDENTIFICATION
  133. CVERID='EC-EARTH' ! CHARACTER: VERSION IDENTIFICATION
  134. LACCUMW=.TRUE. ! LOGICAL : WRITE OUT ACCUMULATED FLUXES (DEFAULT=TRUE)
  135. LRESET=.TRUE. ! LOGICAL : RESET ACCUMULATION EVERY WRITE OUT TIME STEP
  136. NACCUR=1 ! INTEGER : OUTPUT CDF ACCURACY: 1=SINGLE PREC, 2=DOUBLE PREC
  137. NDIMCDF=${NDIMCDF} ! INTEGER : NR OF GRID DIMENSIONS
  138. NDLEVEL=${NDLEVEL} ! INTEGER : Level of netcdf4 compression 0-9: 0== no compression -faster output
  139. NCDFTYPE=${NCDFTYPE} ! type of netcdf output
  140. LNCSNC=.FALSE. ! if true sync netcdf output every writting step (slows down run)
  141. LWRGG=$LPROD ! logical, wrtie o_gg - instantaneus prognostics
  142. LWRCLM=$LPROD ! logical, write o_fix - fix soil properties
  143. LWRGGD=.FALSE. ! logical, write o_ggd - mean prognostic evolution
  144. LWREFL=$LPROD ! logical, write o_efl - surface energy balance
  145. LWRWAT=$LPROD ! logical, write o_wat - water balance
  146. LWRD2M=$LPROD ! logical, write o_d2m - 2 meters diagnostics
  147. ! TODO only save daily 66,67,27,28,29,30 for icmcl
  148. LWRSUS=$LPROD ! logical, write o_sus - surface state variables (vegT,albedo, etc..)
  149. LWREVA=$LPROD2 ! logical, write o_eva - evaporation components
  150. LWRCLD=$LPROD2 ! logical, write o_cld - cold processes variables
  151. LWRCO2=.FALSE. ! logical, write o_co2 - cO2 fluxes
  152. LWRBIO=.FALSE. ! logical, write o_bio - biomass
  153. LWRVEG=.FALSE. ! logical, write o_veg - vegetation 2D high/low veg
  154. LWRVTY=.FALSE. ! logical, write o_vty - vegetation 2D high/low veg biomass
  155. LWRTIL=.FALSE. ! logical, write o_til - tiles 2D (tile) state
  156. LWRLKE=.FALSE. ! logical, write o_lke - lake variables
  157. LSEMISS=.FALSE. ! LOGICAL : EMISSIVITY SET TO CONSTANT VALUE REMISS
  158. LDBGS1=.FALSE. ! LOGICAL : PRINT DEBUG INFO, EG FORCING DATA (DEFAULT=FALSE)
  159. IDBGS1=2 ! Debug level : output printing
  160. LREADDAY=${LREADDAY} ! Logical: read daily chuncks
  161. /
  162. &NAMFORC
  163. ZPHISTA=${ZPHISTA} ! REFERENCE LEVEL (FOR T, Q) last model level ERAI
  164. ZUV=${ZUV} ! REFERENCE LEVEL FOR WIND last model level ERAI
  165. ZDTFORC=$ZDTFORC ! FORCING TIME STEP 3h forcing from ERAI
  166. IFYYYY=$IFYYYY ! REFERENCE YEAR
  167. IFMM=$IFMM ! REFERENCE MONTH
  168. IFDD=$IFDD ! REFERENCE DAY
  169. IFTIM=$IFTIM ! REFERENCE TIME (HHMM)
  170. INSTFC=0 ! NUMBER OF TIME STEPS TO BE READ (0 = ALL)
  171. NDIMFORC=${NDIMCDF} ! NUMBER OF GRID DIMENSIONS in FORCING
  172. LOADIAB=.FALSE. ! FLAG FOR APPLYING ADIABATIC HEIGHT CORRECTION
  173. CFORCV="forcing"
  174. CFORCU="Wind.nc"
  175. CFORCT="Tair.nc"
  176. CFORCQ="Qair.nc"
  177. CFORCP="PSurf.nc"
  178. CFORCRAIN="Rainf.nc"
  179. CFORCSNOW="Snowf.nc"
  180. CFORCSW="SWdown.nc"
  181. CFORCLW="LWdown.nc"
  182. /
  183. &NAMPHY
  184. LEVGEN=$LEVGEN ! LOGICAL : TURN THE VAN GENUCHTEN HYDROLOGY ON
  185. LESSRO=$LESSRO ! LOGICAL : TURN THE SUB-GRID SURFACE RUNOFF ON
  186. LEFLAKE=.FALSE. ! LOGICAL : TURN THE FLAKE ON
  187. LESN09=$LESN09 ! LOGICAL : TURN THE NEW SNOW PARAMETERIZATION ON
  188. LEINTWIND=.T.
  189. LECLIM10D=.F. ! LOGICAL : TURN usage of 10-day Climatology for Alb and LAI
  190. LE4ALB=$LE4ALB
  191. LELAIV=$LELAIV
  192. /
  193. &NAMPHYOFF
  194. LRDALB=$LRDALB
  195. N_COMPUTE_EFF_VEG_FRACTION=${N_COMPUTE_EFF_VEG_FRACTION}
  196. LRDVEG=.TRUE.
  197. LLPJG = ${LLPJGON},
  198. LLPJGFB = ${LLPJGFBON},
  199. /
  200. EOF