Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent double precision definitions #2099

Merged
merged 10 commits into from
Jan 11, 2025
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS
# Only define if set, this is to use #ifdef/#ifndef preprocessors
# in code since cmake cannot handle basically any others :(
# https://gitlab.kitware.com/cmake/cmake/-/issues/17398
if ( ${USE_DOUBLE} )
list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS DOUBLE_PRECISION )
endif()
if ( ${ENABLE_CHEM} )
list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_CHEM=1 )
if ( ${ENABLE_KPP} )
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ em_real : wrf
ln -sf ../../run/ishmael-qi-qr.bin . ; \
ln -sf ../../run/BROADBAND_CLOUD_GODDARD.bin . ; \
ln -sf ../../run/STOCHPERT.TBL . ; \
if [ $(RWORDSIZE) -eq 8 ] ; then \
if [ -n "$(DOUBLE_PRECISION)" ] ; then \
ln -sf ../../run/ETAMPNEW_DATA_DBL ETAMPNEW_DATA ; \
ln -sf ../../run/ETAMPNEW_DATA.expanded_rain_DBL ETAMPNEW_DATA.expanded_rain ; \
ln -sf ../../run/RRTM_DATA_DBL RRTM_DATA ; \
Expand Down Expand Up @@ -677,7 +677,7 @@ em_real : wrf
ln -sf ../../run/ishmael-qi-qr.bin . ; \
ln -sf ../../run/BROADBAND_CLOUD_GODDARD.bin . ; \
ln -sf ../../run/STOCHPERT.TBL . ; \
if [ $(RWORDSIZE) -eq 8 ] ; then \
if [ -n "$(DOUBLE_PRECISION)" ] ; then \
ln -sf ../../run/ETAMPNEW_DATA_DBL ETAMPNEW_DATA ; \
ln -sf ../../run/ETAMPNEW_DATA.expanded_rain_DBL ETAMPNEW_DATA.expanded_rain ; \
ln -sf ../../run/RRTM_DATA_DBL RRTM_DATA ; \
Expand Down
10 changes: 10 additions & 0 deletions arch/Config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$sw_compileflags="";
$sw_opt_level="";
$sw_rwordsize="\$\(NATIVE_RWORDSIZE\)";
$sw_promotion="";
$sw_rttov_flag = "" ;
$sw_rttov_inc = "" ;
$sw_rttov_path = "" ;
Expand Down Expand Up @@ -228,6 +229,10 @@
{
$sw_config_line=substr( $ARGV[0], 13 ) ;
}
if ( substr( $ARGV[0], 1, 6 ) eq "rword=" )
{
$sw_rwordsize=substr( $ARGV[0], 7 ) ;
}
shift @ARGV ;
}

Expand Down Expand Up @@ -316,6 +321,10 @@
}

$sw_rwordsize = "8" if ( $sw_wrfplus_core eq "-DWRFPLUS=1" );
if ( $sw_rwordsize eq "8" )
{
$sw_promotion = "-DDOUBLE_PRECISION" ;
}

# A separately-installed ESMF library is required to build the ESMF
# implementation of WRF IOAPI in external/io_esmf. This is needed
Expand Down Expand Up @@ -634,6 +643,7 @@
$_ =~ s/CONFIGURE_LDFLAGS/$sw_ldflags/g ;
$_ =~ s/CONFIGURE_COMPILEFLAGS/$sw_compileflags/g ;
$_ =~ s/CONFIGURE_RWORDSIZE/$sw_rwordsize/g ;
$_ =~ s/CONFIGURE_PROMOTION/$sw_promotion/g ;
$_ =~ s/CONFIGURE_FC/$sw_time $sw_fc/g ;
$_ =~ s/CONFIGURE_CC/$sw_cc/g ;
$_ =~ s/CONFIGURE_COMMS_LIB/$sw_comms_lib/g ;
Expand Down
Loading