Skip to content

Commit

Permalink
Merge pull request #6 from wrf-model/develop
Browse files Browse the repository at this point in the history
Coupling CTSM with WRF (wrf-model#1275)
  • Loading branch information
hsbadr authored Sep 25, 2020
2 parents 41e8dee + 7df983d commit c7be2d6
Show file tree
Hide file tree
Showing 17 changed files with 1,156 additions and 49 deletions.
1 change: 1 addition & 0 deletions Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -2909,6 +2909,7 @@ package lsmscheme sf_surface_physics==2 - state:flx4,fv
package ruclsmscheme sf_surface_physics==3 - state:smfr3d,keepfr3dflag,soilt1,rhosnf,snowfallac,precipfr,acrunoff
package noahmpscheme sf_surface_physics==4 - state:isnowxy,tvxy,tgxy,canliqxy,canicexy,eahxy,tahxy,cmxy,chxy,fwetxy,sneqvoxy,alboldxy,qsnowxy,wslakexy,zwtxy,waxy,wtxy,tsnoxy,zsnsoxy,snicexy,snliqxy,lfmassxy,rtmassxy,stmassxy,woodxy,stblcpxy,fastcpxy,xsaixy,taussxy,t2mvxy,t2mbxy,q2mvxy,q2mbxy,tradxy,neexy,gppxy,nppxy,fvegxy,qinxy,runsfxy,runsbxy,ecanxy,edirxy,etranxy,fsaxy,firaxy,aparxy,psnxy,savxy,sagxy,rssunxy,rsshaxy,bgapxy,wgapxy,tgvxy,tgbxy,chvxy,chbxy,shgxy,shcxy,shbxy,evgxy,evbxy,ghvxy,ghbxy,irgxy,ircxy,irbxy,trxy,evcxy,chleafxy,chucxy,chv2xy,chb2xy,chstarxy,smoiseq,smcwtdxy,rechxy,deeprechxy,fdepthxy,areaxy,rivercondxy,riverbedxy,eqzwt,pexpxy,qrfxy,qrfsxy,qspringxy,qspringsxy,qslatxy,stepwtd,rechclim,gddxy,grainxy,croptype,planting,harvest,season_gdd,cropcat,pgsxy,soilcomp,soilcl1,soilcl2,soilcl3,soilcl4
package clmscheme sf_surface_physics==5 - state:numc,nump,sabv,sabg,lwup,lhsoi,lhveg,lhtran,snl,snowdp,wtc,wtp,h2osno,t_grnd,t_veg,h2ocan,h2ocan_col,t2m_max,t2m_min,t2clm,t_ref2m,h2osoi_liq_s1,h2osoi_liq_s2,h2osoi_liq_s3,h2osoi_liq_s4,h2osoi_liq_s5,h2osoi_liq1,h2osoi_liq2,h2osoi_liq3,h2osoi_liq4,h2osoi_liq5,h2osoi_liq6,h2osoi_liq7,h2osoi_liq8,h2osoi_liq9,h2osoi_liq10,h2osoi_ice_s1,h2osoi_ice_s2,h2osoi_ice_s3,h2osoi_ice_s4,h2osoi_ice_s5,h2osoi_ice1,h2osoi_ice2,h2osoi_ice3,h2osoi_ice4,h2osoi_ice5,h2osoi_ice6,h2osoi_ice7,h2osoi_ice8,h2osoi_ice9,h2osoi_ice10,t_soisno_s1,t_soisno_s2,t_soisno_s3,t_soisno_s4,t_soisno_s5,t_soisno1,t_soisno2,t_soisno3,t_soisno4,t_soisno5,t_soisno6,t_soisno7,t_soisno8,t_soisno9,t_soisno10,dzsnow1,dzsnow2,dzsnow3,dzsnow4,dzsnow5,snowrds1,snowrds2,snowrds3,snowrds4,snowrds5,t_lake1,t_lake2,t_lake3,t_lake4,t_lake5,t_lake6,t_lake7,t_lake8,t_lake9,t_lake10,h2osoi_vol1,h2osoi_vol2,h2osoi_vol3,h2osoi_vol4,h2osoi_vol5,h2osoi_vol6,h2osoi_vol7,h2osoi_vol8,h2osoi_vol9,h2osoi_vol10,albedosubgrid,lhsubgrid,hfxsubgrid,lwupsubgrid,q2subgrid,sabvsubgrid,sabgsubgrid,nrasubgrid,swupsubgrid
package ctsmscheme sf_surface_physics==6 - -
package pxlsmscheme sf_surface_physics==7 - state:t2_ndg_new,q2_ndg_new,t2_ndg_old,q2_ndg_old,t2obs,q2obs,vegf_px,imperv,canfra,lai_px,wwlt_px,wfc_px,wsat_px,clay_px,csand_px,fmsand_px
package ssibscheme sf_surface_physics==8 - state:ssib_fm,ssib_fh,ssib_cm,ssibxdd,ssib_br,ssib_lhf,ssib_shf,ssib_ghf,ssib_egs,ssib_eci,ssib_ect,ssib_egi,ssib_egt,ssib_sdn,ssib_sup,ssib_ldn,ssib_lup,ssib_wat,ssib_shc,ssib_shg,ssib_lai,ssib_vcf,ssib_z00,ssib_veg,isnow,swe,snowden,snowdepth,tkair,dzo1,wo1,tssn1,tssno1,bwo1,bto1,cto1,fio1,flo1,bio1,blo1,ho1,dzo2,wo2,tssn2,tssno2,bwo2,bto2,cto2,fio2,flo2,bio2,blo2,ho2,dzo3,wo3,tssn3,tssno3,bwo3,bto3,cto3,fio3,flo3,bio3,blo3,ho3,dzo4,wo4,tssn4,tssno4,bwo4,bto4,cto4,fio4,flo4,bio4,blo4,ho4

Expand Down
34 changes: 34 additions & 0 deletions arch/Config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$sw_jasperinc_path="";
$sw_esmflib_path="";
$sw_esmfinc_path="";
$sw_ctsm_mkfile_path="";
$sw_ldflags="";
$sw_compileflags="";
$sw_opt_level="";
Expand Down Expand Up @@ -321,6 +322,20 @@
$sw_esmf_ldflag = "yes" ;
}

# A separately-installed CTSM library and its dependencies are required
# to build WRF with the CTSM land surface model (the next generation of
# the CLM model, coupled via LILAC). The user must set the environment
# variable WRF_CTSM_MKFILE, which should be a path to a make-formatted
# file containing settings of CTSM_INCLUDES and CTSM_LIBS. When this
# environment variable is set, this also triggers adding -DWRF_USE_CTSM;
# when this env var is not set, then we instead use -DWRF_USE_CLM, which
# builds an old version of CLM that is included in the WRF source code.
# (We currently cannot build with both at once because of namespace
# collisions at link time.)
if ( $ENV{WRF_CTSM_MKFILE} ) {
$sw_ctsm_mkfile_path = $ENV{WRF_CTSM_MKFILE};
}

# parse the configure.wrf file

$validresponse = 0 ;
Expand Down Expand Up @@ -584,6 +599,19 @@
$_ =~ s:ESMFIOEXTLIB:-L\$\(WRF_SRC_ROOT_DIR\)/external/esmf_time_f90 -lesmf_time:g ;
}
}

# CTSM substitutions in configure.defaults and postamble
if ( $sw_ctsm_mkfile_path ) {
$_ =~ s:CONFIGURE_D_CTSM:-DWRF_USE_CTSM:g ;
$_ =~ s:CONFIGURE_CTSM_INC:\$\(CTSM_INCLUDES\):g ;
$_ =~ s:CONFIGURE_CTSM_LIB:\$\(CTSM_LIBS\):g ;
}
else {
$_ =~ s:CONFIGURE_D_CTSM:-DWRF_USE_CLM:g ;
$_ =~ s:CONFIGURE_CTSM_INC::g ;
$_ =~ s:CONFIGURE_CTSM_LIB::g ;
}

if ( $ENV{HWRF} )
{
$_ =~ s:CONFIGURE_ATMOCN_LIB:-L\$\(WRF_SRC_ROOT_DIR\)/external/atm_ocn -latm_ocn:g ;
Expand Down Expand Up @@ -779,6 +807,12 @@
$_ =~ s:ESMFIODEFS::g ;
$_ =~ s:ESMFTARGET:esmf_time:g ;
}

# CTSM substitutions in preamble
if ( $sw_ctsm_mkfile_path ) {
$_ =~ s:\# CTSMINCLUDEGOESHERE:include $sw_ctsm_mkfile_path: ;
}

if ( $ENV{HWRF} )
{
$_ =~ s:CONFIGURE_ATMOCN_LIB:-L\$\(WRF_SRC_ROOT_DIR\)/external/atm_ocn -latm_ocn:g ;
Expand Down
Loading

0 comments on commit c7be2d6

Please sign in to comment.