Commit 79758d35 authored by Beisman, James Joseph's avatar Beisman, James Joseph
Browse files

cleanup uneccessary SHR variables in header

parent d381b131
add_library (physics physics_dummy.cc CanopyHydrology.cc coldstart_topography.cc coldstart_snow.cc SurfaceRadiation.cc SurfaceResistanceMod_functions.cc QSatMod_functions.cc CanopyTemperature.cc FrictionVelocityMod_functions.cc)
add_library (physics physics_dummy.cc CanopyHydrology.cc coldstart_topography.cc coldstart_snow.cc SurfaceRadiation.cc SurfaceResistanceMod_functions.cc QSatMod_functions.cc CanopyTemperature.cc FrictionVelocityMod_functions.cc BareGroundFluxes.cc)
target_include_directories (physics PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
......@@ -318,7 +318,6 @@ frac_sno [double] fraction of ground covered by snow (0 to 1
double& frac_sno) {
if (!Land.lakpoi) {
double rpi = SHR_CONST_PI;
double temp_snow_depth, dz_snowf, newsnow, bifall, snowmelt, accum_factor, temp_intsnow, z_avg;
// Determine snow height and snow water
// Use Alta relationship, Anderson(1976); LaChapelle(1961),
......@@ -361,14 +360,14 @@ frac_sno [double] fraction of ground covered by snow (0 to 1
if (h2osno > 0.0) {
if(snowmelt > 0.0) {
double smr = std::min(1.0, (h2osno / int_snow));
frac_sno = 1.0 - pow((acos(std::min(1.0, (2.0 * smr - 1.0))) / rpi), n_melt);
frac_sno = 1.0 - pow((acos(std::min(1.0, (2.0 * smr - 1.0))) / ELM_PI), n_melt);
}
// update fsca by new snow event, add to previous fsca
if (newsnow > 0.0) {
double fsno_new = 1.0 - (1.0 - tanh(accum_factor * newsnow)) * (1.0 - frac_sno);
frac_sno = fsno_new;
// reset int_snow after accumulation events
temp_intsnow = (h2osno + newsnow) / (0.5 * (cos(rpi * pow( (1.0 - std::max(frac_sno, 1.e-6)), (1.0 / n_melt))) + 1.0));
temp_intsnow = (h2osno + newsnow) / (0.5 * (cos(ELM_PI * pow( (1.0 - std::max(frac_sno, 1.e-6)), (1.0 / n_melt))) + 1.0));
int_snow = std::min(1.e8, temp_intsnow);
}
/*====================================================================*/
......@@ -399,7 +398,7 @@ frac_sno [double] fraction of ground covered by snow (0 to 1
frac_sno = tanh(accum_factor * newsnow);
// make int_snow consistent w/ new fsno, h2osno
int_snow = 0.0; //reset prior to adding newsnow below
temp_intsnow = (h2osno + newsnow) / (0.5 * (cos(rpi * pow( (1.0 - std::max(frac_sno, 1.e-6)), (1.0 / n_melt))) + 1.0));
temp_intsnow = (h2osno + newsnow) / (0.5 * (cos(ELM_PI * pow( (1.0 - std::max(frac_sno, 1.e-6)), (1.0 / n_melt))) + 1.0));
int_snow = std::min(1.e8, temp_intsnow);
// update snow_depth and h2osno to be consistent with frac_sno, z_avg
if (subgridflag == 1 && !Land.urbpoi) {
......@@ -509,7 +508,7 @@ frac_h2osfc [double] fractional area with surface water greater
d = 0.0;
sigma = 1.0e3 * micro_sigma; // convert to mm
for (int l = 0; l < 10; l++) {
fd = 0.5 * d * (1.0 + erf(d / (sigma * sqrt(2.0)))) + sigma / sqrt(2.0 * SHR_CONST_PI) * exp(-pow(d, 2) / (2.0 * pow(sigma, 2))) - h2osfc;
fd = 0.5 * d * (1.0 + erf(d / (sigma * sqrt(2.0)))) + sigma / sqrt(2.0 * ELM_PI) * exp(-pow(d, 2) / (2.0 * pow(sigma, 2))) - h2osfc;
dfdd = 0.5 * (1.0 + erf(d / (sigma * sqrt(2.0))));
d = d - fd/dfdd;
}
......
......@@ -74,7 +74,7 @@ double StabilityFunc1(double zeta)
chik2 = std::sqrt(1.0 - 16.0 * zeta);
chik = std::sqrt(chik2);
retval = 2.0 * std::log((1.0 + chik) * 0.5) + std::log((1.0 + chik2) * 0.5) - 2.0 * atan(chik) + SHR_CONST_PI * 0.5;
retval = 2.0 * std::log((1.0 + chik) * 0.5) + std::log((1.0 + chik2) * 0.5) - 2.0 * atan(chik) + ELM_PI * 0.5;
return retval;
}
......
......@@ -55,7 +55,7 @@ void QSat(
const double d8 = 0.498070196e-16;
double td,vp,vp1,vp2,T_limit;
T_limit = T - SHR_CONST_TKFRZ;
T_limit = T - tfrz;
if (T_limit > 100.0) { T_limit=100.0; }
if (T_limit < -75.0) { T_limit=-75.0; }
......
......@@ -53,7 +53,7 @@ void calc_soilevap_stress(
fac_fc = std::min(1.0, wx / watfc[0]); // eqn5.66 but divided by theta at field capacity
fac_fc = std::max(fac_fc, 0.01);
// modify soil beta by snow cover. soilbeta for snow surface is one
soilbeta = (1.0 - frac_sno - frac_h2osfc) * 0.25 * pow(1.0 - cos(SHR_CONST_PI * fac_fc), 2.0)
soilbeta = (1.0 - frac_sno - frac_h2osfc) * 0.25 * pow(1.0 - cos(ELM_PI * fac_fc), 2.0)
+ frac_sno + frac_h2osfc;
} else {
soilbeta = 1.0;
......
......@@ -34,36 +34,31 @@ static const int icol_road_imperv = isturb_MIN*10 + 4;
static const int icol_road_perv = isturb_MIN*10 + 5;
//from shr_const_mod.F90
static const double SHR_CONST_PI = 3.14159265358979323846;
static const double SHR_CONST_TKFRZ = 273.15;
static const double SHR_CONST_RHOFW = 1.000e3; // density of fresh water ~ kg/m^3
static const double SHR_CONST_RHOSW = 1.026e3; // density of sea water ~ kg/m^3
static const double SHR_CONST_RHOICE = 0.917e3; // density of ice ~ kg/m^3
static const double SHR_CONST_BOLTZ = 1.38065e-23; // Boltzmann's constant ~ J/K/molecule
static const double SHR_CONST_AVOGAD = 6.02214e26; // Avogadro's number ~ molecules/kmole
static const double SHR_CONST_MWWV = 18.016; // molecular weight water vapor
static const double SHR_CONST_RGAS = SHR_CONST_AVOGAD*SHR_CONST_BOLTZ; // Universal gas constant ~ J/K/kmole
static const double SHR_CONST_RWV = SHR_CONST_RGAS/SHR_CONST_MWWV; // Water vapor gas constant ~ J/K/kg
static const double SHR_CONST_G = 9.80616; // acceleration of gravity ~ m/s^2
static const double SHR_CONST_LATICE = 3.337e5; // latent heat of fusion ~ J/kg
static const double SHR_CONST_LATVAP = 2.501e6; // latent heat of evaporation ~ J/kg
static const double SHR_CONST_LATSUB = SHR_CONST_LATICE + SHR_CONST_LATVAP; // latent heat of sublimation ~ J/kg
static const double SHR_CONST_KARMAN = 0.4; // Von Karman constant
//from clm_varcon.F90
static const double snw_rds_min = 54.526; //minimum allowed snow effective radius (also "fresh snow" value) [microns]
static const double zlnd = 0.01; // Roughness length for soil [m]
static const double zsno = 0.0024; // Roughness length for snow [m]
static const double spval = 1.0e36; // special value for real data
static const int ispval = -9999; // special value for int data
static const double tfrz = SHR_CONST_TKFRZ; // freezing temperature [K]
static const double roverg = SHR_CONST_RWV/SHR_CONST_G*1000.0; // Rw/g constant = (8.3144/0.018)/(9.80616)*1000. mm/K
static const double denice = SHR_CONST_RHOICE;
static const double denh2o = SHR_CONST_RHOFW;
static const double hvap = SHR_CONST_LATVAP; // Latent heat of evap for water [J/kg]
static const double hsub = SHR_CONST_LATSUB; // Latent heat of sublimation [J/kg]
static const double hfus = SHR_CONST_LATICE; // Latent heat of fusion for ice [J/kg]
static const double grav = SHR_CONST_G; // gravity constant [m/s2]
static const double vkc = SHR_CONST_KARMAN; // von Karman constant [-]
static const double snw_rds_min = 54.526; //minimum allowed snow effective radius (also "fresh snow" value) [microns]
static const double zlnd = 0.01; // Roughness length for soil [m]
static const double zsno = 0.0024; // Roughness length for snow [m]
static const double spval = 1.0e36; // special value for real data
static const int ispval = -9999; // special value for int data
static const double tfrz = 273.15; // freezing temperature [K]
static const double denice = 0.917e3; // density of ice ~ kg/m^3
static const double denh2o = 1.000e3; // // density of fresh water ~ kg/m^3
static const double hvap = 2.501e6; // Latent heat of evap for water [J/kg]
static const double hfus = 3.337e5; // Latent heat of fusion for ice [J/kg]
static const double hsub = hvap + hfus; // Latent heat of sublimation [J/kg]
static const double grav = 9.80616; // gravity constant [m/s2]
static const double roverg = SHR_CONST_RWV/grav*1000.0; // Rw/g constant = (8.3144/0.018)/(9.80616)*1000. mm/K
static const double vkc = 0.4; // von Karman constant [-]
static const double cpair = 1.00464e3; // specific heat of dry air ~ J/kg/K
static const double ELM_PI = 3.14159265358979323846; // pi
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment