From 43bd936b2a633e8d7647fac8c002682f70e89918 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Tue, 18 Jun 2024 20:53:27 +0200 Subject: [PATCH] [PL/TRM] Made saturation material property optional --- .../CreateThermoRichardsMechanicsProcess.cpp | 3 +- .../ThermoRichardsMechanicsFEM-impl.h | 36 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.cpp b/ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.cpp index 8bff9076ec9..33d25675af6 100644 --- a/ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.cpp +++ b/ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.cpp @@ -40,8 +40,7 @@ void checkMPLProperties( std::array const required_medium_properties = { MaterialPropertyLib::porosity, MaterialPropertyLib::biot_coefficient, MaterialPropertyLib::bishops_effective_stress, - MaterialPropertyLib::relative_permeability, - MaterialPropertyLib::saturation}; + MaterialPropertyLib::relative_permeability}; std::array const required_liquid_properties = { MaterialPropertyLib::viscosity, MaterialPropertyLib::density}; std::array const required_solid_properties = {MaterialPropertyLib::density}; diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h index 421998d8795..0e6788e5019 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h @@ -127,17 +127,24 @@ void ThermoRichardsMechanicsLocalAssembler< NumLib::shapeFunctionInterpolate(-p_L, N, p_cap_ip); MPL::VariableArray variables; - variables.capillary_pressure = p_cap_ip; - variables.liquid_phase_pressure = -p_cap_ip; - // setting pG to 1 atm - // TODO : rewrite equations s.t. p_L = pG-p_cap - variables.gas_phase_pressure = 1.0e5; - variables.temperature = T_ip; - - double const S_L = - medium.property(MPL::PropertyType::saturation) - .template value<double>(variables, x_position, t, dt); - std::get<PrevState<SaturationData>>(this->prev_states_[ip])->S_L = S_L; + + if (medium.hasProperty(MPL::PropertyType::saturation)) + { + variables.capillary_pressure = p_cap_ip; + variables.liquid_phase_pressure = -p_cap_ip; + // setting pG to 1 atm + // TODO : rewrite equations s.t. p_L = pG-p_cap + variables.gas_phase_pressure = 1.0e5; + variables.temperature = T_ip; + + double const S_L = + medium.property(MPL::PropertyType::saturation) + .template value<double>(variables, x_position, t, dt); + std::get<PrevState<SaturationData>>(this->prev_states_[ip])->S_L = + S_L; + + variables.liquid_saturation = S_L; + } constitutive_setting.init(models, t, dt, x_position, media_data, {T_ip, 0, {}}, this->current_states_[ip], @@ -145,7 +152,12 @@ void ThermoRichardsMechanicsLocalAssembler< if (this->process_data_.initial_stress.value) { - variables.liquid_saturation = S_L; + if (!medium.hasProperty(MPL::PropertyType::saturation)) + { + OGS_FATAL( + "The medium has no saturation property required to compute " + "initial stress."); + } convertInitialStressType(ip, t, x_position, medium, variables, -p_cap_ip); } -- GitLab