From acd37a41df0d8f09c73eb2c670da87654e8b23ef Mon Sep 17 00:00:00 2001 From: Ethan Coon Date: Fri, 30 Jun 2023 16:10:23 -0400 Subject: [PATCH] clang-format --- .../volumetric_snow_ponded_depth_evaluator.cc | 3 +- .../wrm/rel_perm_frzBC_evaluator.cc | 58 ++++++++++++------- .../land_cover/seb_physics_funcs.cc | 14 +++-- .../seb_threecomponent_evaluator.cc | 4 +- 4 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/pks/flow/constitutive_relations/elevation/volumetric_snow_ponded_depth_evaluator.cc b/src/pks/flow/constitutive_relations/elevation/volumetric_snow_ponded_depth_evaluator.cc index b4517313f..c7d8551eb 100644 --- a/src/pks/flow/constitutive_relations/elevation/volumetric_snow_ponded_depth_evaluator.cc +++ b/src/pks/flow/constitutive_relations/elevation/volumetric_snow_ponded_depth_evaluator.cc @@ -194,7 +194,8 @@ VolumetricSnowPondedDepthEvaluator::EnsureCompatibility_ToDeps_(State& S) // Loop over my dependencies, ensuring they meet the requirements. for (const auto& key_tag : dependencies_) { - if (key_tag.first == delta_max_key_ || key_tag.first == delta_ex_key_ || key_tag.first == sd_key_) { + if (key_tag.first == delta_max_key_ || key_tag.first == delta_ex_key_ || + key_tag.first == sd_key_) { S.Require(key_tag.first, key_tag.second) .Update(*no_bf_dep_fac); } else { diff --git a/src/pks/flow/constitutive_relations/wrm/rel_perm_frzBC_evaluator.cc b/src/pks/flow/constitutive_relations/wrm/rel_perm_frzBC_evaluator.cc index 7a3a3d04e..3b74113dd 100644 --- a/src/pks/flow/constitutive_relations/wrm/rel_perm_frzBC_evaluator.cc +++ b/src/pks/flow/constitutive_relations/wrm/rel_perm_frzBC_evaluator.cc @@ -25,7 +25,7 @@ RelPermFrzBCEvaluator::RelPermFrzBCEvaluator(Teuchos::ParameterList& plist) RelPermFrzBCEvaluator::RelPermFrzBCEvaluator(Teuchos::ParameterList& plist, - const Teuchos::RCP& wrms) + const Teuchos::RCP& wrms) : EvaluatorSecondaryMonotypeCV(plist), wrms_(wrms), min_val_(0.) { InitializeFromPlist_(); @@ -156,8 +156,9 @@ RelPermFrzBCEvaluator::Evaluate_(const State& S, const std::vectorfirst)[c]; double sat_res = wrms_->second[index]->residualSaturation(); - double coef = 1 - std::exp(-omega_*(sat_c[0][c]+sat_gas_c[0][c])) + std::exp(-omega_); - res_c[0][c] = std::max(coef*std::pow((1-sat_gas_c[0][c]-sat_res)/(1-sat_res), 3+2*b_), min_val_); + double coef = 1 - std::exp(-omega_ * (sat_c[0][c] + sat_gas_c[0][c])) + std::exp(-omega_); + res_c[0][c] = std::max( + coef * std::pow((1 - sat_gas_c[0][c] - sat_res) / (1 - sat_res), 3 + 2 * b_), min_val_); } // -- Potentially evaluate the model on boundary faces as well. @@ -180,26 +181,38 @@ RelPermFrzBCEvaluator::Evaluate_(const State& S, const std::vectorface_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); AMANZI_ASSERT(cells.size() == 1); - + int index = (*wrms_->first)[cells[0]]; double sat_res = wrms_->second[index]->residualSaturation(); double krel; - double coef_b = 1 - std::exp(-omega_*(sat_bf[0][bf]+sat_gas_bf[0][bf])) + std::exp(-omega_); - double coef_c = 1 - std::exp(-omega_*(sat_c[0][cells[0]]+sat_gas_c[0][cells[0]])) + std::exp(-omega_); + double coef_b = + 1 - std::exp(-omega_ * (sat_bf[0][bf] + sat_gas_bf[0][bf])) + std::exp(-omega_); + double coef_c = + 1 - std::exp(-omega_ * (sat_c[0][cells[0]] + sat_gas_c[0][cells[0]])) + std::exp(-omega_); if (boundary_krel_ == BoundaryRelPerm::HARMONIC_MEAN) { - double krelb = std::max(coef_b*std::pow((1-sat_gas_bf[0][bf]-sat_res)/(1-sat_res), 3+2*b_), min_val_); - double kreli = std::max(coef_c*std::pow((1-sat_gas_c[0][cells[0]]-sat_res)/(1-sat_res), 3+2*b_), min_val_); + double krelb = + std::max(coef_b * std::pow((1 - sat_gas_bf[0][bf] - sat_res) / (1 - sat_res), 3 + 2 * b_), + min_val_); + double kreli = std::max( + coef_c * std::pow((1 - sat_gas_c[0][cells[0]] - sat_res) / (1 - sat_res), 3 + 2 * b_), + min_val_); krel = 1.0 / (1.0 / krelb + 1.0 / kreli); } else if (boundary_krel_ == BoundaryRelPerm::ARITHMETIC_MEAN) { - double krelb = std::max(coef_b*std::pow((1-sat_gas_bf[0][bf]-sat_res)/(1-sat_res), 3+2*b_), min_val_); - double kreli = std::max(coef_c*std::pow((1-sat_gas_c[0][cells[0]]-sat_res)/(1-sat_res), 3+2*b_), min_val_); + double krelb = + std::max(coef_b * std::pow((1 - sat_gas_bf[0][bf] - sat_res) / (1 - sat_res), 3 + 2 * b_), + min_val_); + double kreli = std::max( + coef_c * std::pow((1 - sat_gas_c[0][cells[0]] - sat_res) / (1 - sat_res), 3 + 2 * b_), + min_val_); krel = (krelb + kreli) / 2.0; } else if (boundary_krel_ == BoundaryRelPerm::INTERIOR_PRESSURE) { - krel = std::max(coef_c*std::pow((1-sat_gas_c[0][cells[0]]-sat_res)/(1-sat_res), 3+2*b_), min_val_); + krel = std::max( + coef_c * std::pow((1 - sat_gas_c[0][cells[0]] - sat_res) / (1 - sat_res), 3 + 2 * b_), + min_val_); } else if (boundary_krel_ == BoundaryRelPerm::ONE) { krel = 1.; } else { - krel = coef_b*std::pow((1-sat_gas_bf[0][bf]-sat_res)/(1-sat_res), 3+2*b_); + krel = coef_b * std::pow((1 - sat_gas_bf[0][bf] - sat_res) / (1 - sat_res), 3 + 2 * b_); } res_bf[0][bf] = std::max(krel, min_val_); } @@ -260,9 +273,9 @@ RelPermFrzBCEvaluator::Evaluate_(const State& S, const std::vector& result) + const Key& wrt_key, + const Tag& wrt_tag, + const std::vector& result) { // Initialize the MeshPartition if (!wrms_->first->initialized()) { @@ -287,7 +300,9 @@ RelPermFrzBCEvaluator::EvaluatePartialDerivative_(const State& S, for (unsigned int c = 0; c != ncells; ++c) { int index = (*wrms_->first)[c]; double sat_res = wrms_->second[index]->residualSaturation(); - res_c[0][c] = omega_*std::pow((1.-sat_gas_c[0][c]-sat_res)/(1-sat_res), 2*b_+3)*std::exp(-omega_*(sat_c[0][c]+sat_gas_c[0][c])); + res_c[0][c] = omega_ * + std::pow((1. - sat_gas_c[0][c] - sat_res) / (1 - sat_res), 2 * b_ + 3) * + std::exp(-omega_ * (sat_c[0][c] + sat_gas_c[0][c])); AMANZI_ASSERT(res_c[0][c] >= 0.); } @@ -329,10 +344,13 @@ RelPermFrzBCEvaluator::EvaluatePartialDerivative_(const State& S, for (unsigned int c = 0; c != ncells; ++c) { int index = (*wrms_->first)[c]; double sat_res = wrms_->second[index]->residualSaturation(); - double dbc_dsg = -(2*b_+3)/(1-sat_res)*std::pow((1-sat_gas_c[0][c]-sat_res)/(1-sat_res), 2*b_+2); - double coef = 1-std::exp(-omega_*(sat_c[0][c]+sat_gas_c[0][c]))+std::exp(-omega_); - double dcoef_dsg = omega_*std::exp(-omega_*(sat_c[0][c]+sat_gas_c[0][c])); - res_c[0][c] = dbc_dsg * coef + dcoef_dsg * std::pow((1.-sat_gas_c[0][c]-sat_res)/(1-sat_res), 2*b_+3); + double dbc_dsg = -(2 * b_ + 3) / (1 - sat_res) * + std::pow((1 - sat_gas_c[0][c] - sat_res) / (1 - sat_res), 2 * b_ + 2); + double coef = 1 - std::exp(-omega_ * (sat_c[0][c] + sat_gas_c[0][c])) + std::exp(-omega_); + double dcoef_dsg = omega_ * std::exp(-omega_ * (sat_c[0][c] + sat_gas_c[0][c])); + res_c[0][c] = + dbc_dsg * coef + + dcoef_dsg * std::pow((1. - sat_gas_c[0][c] - sat_res) / (1 - sat_res), 2 * b_ + 3); } // -- Potentially evaluate the model on boundary faces as well. diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/seb_physics_funcs.cc b/src/pks/surface_balance/constitutive_relations/land_cover/seb_physics_funcs.cc index a38d761e3..f77e45560 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/seb_physics_funcs.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/seb_physics_funcs.cc @@ -290,9 +290,14 @@ UpdateEnergyBalanceWithSnow_Inner(const GroundProperties& surf, // latent heat double vapor_pressure_skin = SaturatedVaporPressure(snow.temp); - double u_star = met.Us * c_von_Karman / std::log(met.Z_Us / CalcRoughnessFactor(snow.height, surf.roughness, snow.roughness)); - double Re0 = params.density_air * u_star * CalcRoughnessFactor(snow.height, surf.roughness, snow.roughness) / params.dynamic_viscosity_air; - double KB = params.Da0_a * std::pow(Re0, params.Da0_b) - (params.Cd0_c * std::log(Re0) + params.Cd0_d); + double u_star = + met.Us * c_von_Karman / + std::log(met.Z_Us / CalcRoughnessFactor(snow.height, surf.roughness, snow.roughness)); + double Re0 = params.density_air * u_star * + CalcRoughnessFactor(snow.height, surf.roughness, snow.roughness) / + params.dynamic_viscosity_air; + double KB = + params.Da0_a * std::pow(Re0, params.Da0_b) - (params.Cd0_c * std::log(Re0) + params.Cd0_d); double Dhe_latent = WindFactor( met.Us, met.Z_Us, CalcRoughnessFactor(snow.height, surf.roughness, snow.roughness), KB); eb.fQe = LatentHeat(Dhe_latent * Sqig, @@ -370,7 +375,8 @@ UpdateEnergyBalanceWithoutSnow(const GroundProperties& surf, double vapor_pressure_skin = VaporPressureGround(surf, params); double u_star = met.Us * c_von_Karman / std::log(met.Z_Us / surf.roughness); double Re0 = params.density_air * u_star * surf.roughness / params.dynamic_viscosity_air; - double KB = params.Da0_a * std::pow(Re0, params.Da0_b) - (params.Cd0_c * std::log(Re0) + params.Cd0_d); + double KB = + params.Da0_a * std::pow(Re0, params.Da0_b) - (params.Cd0_c * std::log(Re0) + params.Cd0_d); double Dhe_latent = WindFactor(met.Us, met.Z_Us, surf.roughness, KB); double Rsoil = EvaporativeResistanceGround(surf, met, params, vapor_pressure_skin); double coef = 1.0 / (Rsoil + 1.0 / (Dhe_latent * Sqig)); diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc index b863d5add..59de50e22 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc @@ -436,8 +436,8 @@ SEBThreeComponentEvaluator::Evaluate_(const State& S, const std::vector