-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rm-constitutive-setting' into 'master'
Refactoring assembly of RichardsMechanics See merge request ogs/ogs!5008
- Loading branch information
Showing
15 changed files
with
688 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "BaseLib/StrongType.h" | ||
#include "MaterialLib/MPL/Medium.h" | ||
#include "MathLib/KelvinVector.h" | ||
#include "ParameterLib/SpatialPosition.h" | ||
#include "ProcessLib/ConstitutiveRelations/Base.h" | ||
#include "ProcessLib/Reflection/ReflectionData.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
|
||
using namespace ProcessLib::ConstitutiveRelations; | ||
namespace KV = MathLib::KelvinVector; | ||
|
||
template <int DisplacementDim> | ||
using KelvinVector = KV::KelvinVectorType<DisplacementDim>; | ||
|
||
template <int DisplacementDim> | ||
using KelvinMatrix = KV::KelvinMatrixType<DisplacementDim>; | ||
|
||
template <int DisplacementDim> | ||
using GlobalDimVector = Eigen::Vector<double, DisplacementDim>; | ||
|
||
template <int DisplacementDim> | ||
using GlobalDimMatrix = | ||
Eigen::Matrix<double, DisplacementDim, DisplacementDim, Eigen::RowMajor>; | ||
|
||
/// Used to set a D dimensional vector to all not-a-number. | ||
template <int D> | ||
constexpr GlobalDimVector<D> DVnan() | ||
{ | ||
return GlobalDimVector<D>::Constant(nan); | ||
} | ||
|
||
/// Used to set a D x D matrix to all not-a-number. | ||
template <int D> | ||
constexpr GlobalDimMatrix<D> DMnan() | ||
{ | ||
return GlobalDimMatrix<D>::Constant(nan); | ||
} | ||
|
||
struct MediaData | ||
{ | ||
explicit MediaData(MaterialPropertyLib::Medium const& medium) | ||
: medium{medium}, | ||
liquid{medium.phase("AqueousLiquid")}, | ||
solid{medium.phase("Solid")} | ||
{ | ||
} | ||
|
||
MaterialPropertyLib::Medium const& medium; | ||
MaterialPropertyLib::Phase const& liquid; | ||
MaterialPropertyLib::Phase const& solid; | ||
}; | ||
|
||
using TemperatureData = BaseLib::StrongType<double, struct TemperatureDataTag>; | ||
|
||
template <int DisplacementDim> | ||
struct CapillaryPressureData | ||
{ | ||
double p_cap; | ||
double p_cap_prev; | ||
Eigen::Vector<double, DisplacementDim> grad_p_cap; | ||
}; | ||
} // namespace ProcessLib::RichardsMechanics |
59 changes: 59 additions & 0 deletions
59
ProcessLib/RichardsMechanics/ConstitutiveRelations/ConstitutiveData.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Density.h" | ||
#include "LiquidDensity.h" | ||
#include "ProcessLib/ConstitutiveRelations/Base.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Biot.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/LiquidViscosity.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/PermeabilityData.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Saturation.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidCompressibilityData.h" | ||
#include "SaturationSecantDerivative.h" | ||
#include "StiffnessTensor.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
// TODO directly declare these type aliases in Traits.h | ||
/// Data whose state must be tracked by the TRM process. | ||
template <int DisplacementDim> | ||
using StatefulData = std::tuple<>; | ||
|
||
template <int DisplacementDim> | ||
using StatefulDataPrev = ProcessLib::ConstitutiveRelations::PrevStateOf< | ||
StatefulData<DisplacementDim>>; | ||
|
||
/// Data that is needed for output purposes, but not directly for the assembly. | ||
template <int DisplacementDim> | ||
using OutputData = std::tuple<>; | ||
|
||
/// Data that is needed for the equation system assembly. | ||
template <int DisplacementDim> | ||
using ConstitutiveData = std::tuple< | ||
// TODO (CL) check if all that data should stay here | ||
StiffnessTensor<DisplacementDim>, | ||
ProcessLib::ThermoRichardsMechanics::PorosityData, Density, LiquidDensity, | ||
ProcessLib::ThermoRichardsMechanics::BiotData, | ||
ProcessLib::ThermoRichardsMechanics::SaturationDataDeriv, | ||
ProcessLib::ThermoRichardsMechanics::LiquidViscosityData, | ||
ProcessLib::ThermoRichardsMechanics::SolidCompressibilityData, | ||
ProcessLib::ThermoRichardsMechanics::BishopsData, | ||
PrevState<ProcessLib::ThermoRichardsMechanics::BishopsData>, | ||
ProcessLib::ThermoRichardsMechanics::PermeabilityData<DisplacementDim>, | ||
SaturationSecantDerivative>; | ||
|
||
/// Data that stores intermediate values, which are not needed outside the | ||
/// constitutive setting. | ||
template <int DisplacementDim> | ||
using ConstitutiveTempData = std::tuple<>; | ||
} // namespace ProcessLib::RichardsMechanics |
34 changes: 34 additions & 0 deletions
34
ProcessLib/RichardsMechanics/ConstitutiveRelations/ConstitutiveModels.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "MaterialLib/SolidModels/MechanicsBase.h" | ||
#include "ProcessLib/Graph/ConstructModels.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SpecificBodyForceData.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
/// Constitutive models used for assembly. | ||
template <int DisplacementDim> | ||
using ConstitutiveModels = std::tuple<>; | ||
|
||
template <int DisplacementDim, typename TRMProcessData> | ||
ConstitutiveModels<DisplacementDim> createConstitutiveModels( | ||
TRMProcessData const& process_data, | ||
MaterialLib::Solids::MechanicsBase<DisplacementDim> const& solid_material) | ||
{ | ||
return ProcessLib::Graph::constructModels< | ||
ConstitutiveModels<DisplacementDim>>( | ||
ProcessLib::ThermoRichardsMechanics::SpecificBodyForceData< | ||
DisplacementDim>{process_data.specific_body_force}, | ||
solid_material); | ||
} | ||
} // namespace ProcessLib::RichardsMechanics |
35 changes: 35 additions & 0 deletions
35
ProcessLib/RichardsMechanics/ConstitutiveRelations/ConstitutiveSetting.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#include "ConstitutiveSetting.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
template <int DisplacementDim> | ||
void ConstitutiveSetting<DisplacementDim>::eval( | ||
ConstitutiveModels<DisplacementDim>& /*models*/, double const /*t*/, | ||
double const /*dt*/, ParameterLib::SpatialPosition const& /*x_position*/, | ||
MaterialPropertyLib::Medium const& /*medium*/, | ||
TemperatureData const /*T_data*/, | ||
CapillaryPressureData<DisplacementDim> const& /*p_cap_data*/, | ||
KelvinVector<DisplacementDim> const& /*eps_arg*/, | ||
StatefulData<DisplacementDim>& /*state*/, | ||
StatefulDataPrev<DisplacementDim> const& /*prev_state*/, | ||
ProcessLib::ThermoRichardsMechanics::MaterialStateData<DisplacementDim>& | ||
/*mat_state*/, | ||
ConstitutiveTempData<DisplacementDim>& /*tmp*/, | ||
OutputData<DisplacementDim>& /*out*/, | ||
ConstitutiveData<DisplacementDim>& /*cd*/) const | ||
{ | ||
} | ||
|
||
template struct ConstitutiveSetting<2>; | ||
template struct ConstitutiveSetting<3>; | ||
} // namespace ProcessLib::RichardsMechanics |
41 changes: 41 additions & 0 deletions
41
ProcessLib/RichardsMechanics/ConstitutiveRelations/ConstitutiveSetting.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Base.h" | ||
#include "ConstitutiveData.h" | ||
#include "ConstitutiveModels.h" | ||
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/MaterialState.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
template <int DisplacementDim> | ||
struct ConstitutiveSetting | ||
{ | ||
/// Evaluate the constitutive setting. | ||
void eval( | ||
ConstitutiveModels<DisplacementDim>& models, double const t, | ||
double const dt, ParameterLib::SpatialPosition const& x_position, | ||
MaterialPropertyLib::Medium const& medium, TemperatureData const T_data, | ||
CapillaryPressureData<DisplacementDim> const& p_cap_data, | ||
KelvinVector<DisplacementDim> const& eps_arg, | ||
StatefulData<DisplacementDim>& state, | ||
StatefulDataPrev<DisplacementDim> const& prev_state, | ||
ProcessLib::ThermoRichardsMechanics::MaterialStateData<DisplacementDim>& | ||
mat_state, | ||
ConstitutiveTempData<DisplacementDim>& tmp, | ||
OutputData<DisplacementDim>& out, | ||
ConstitutiveData<DisplacementDim>& cd) const; | ||
}; | ||
|
||
extern template struct ConstitutiveSetting<2>; | ||
extern template struct ConstitutiveSetting<3>; | ||
} // namespace ProcessLib::RichardsMechanics |
32 changes: 32 additions & 0 deletions
32
ProcessLib/RichardsMechanics/ConstitutiveRelations/CreateConstitutiveSetting.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#include "CreateConstitutiveSetting.h" | ||
|
||
#include "MaterialLib/SolidModels/CreateConstitutiveRelation.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
template <int DisplacementDim> | ||
std::map<int, | ||
std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim>>> | ||
CreateConstitutiveSetting<DisplacementDim>::createSolidConstitutiveRelations( | ||
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters, | ||
std::optional<ParameterLib::CoordinateSystem> const& | ||
local_coordinate_system, | ||
BaseLib::ConfigTree const& config) | ||
{ | ||
return MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>( | ||
parameters, local_coordinate_system, config); | ||
} | ||
|
||
template struct CreateConstitutiveSetting<2>; | ||
template struct CreateConstitutiveSetting<3>; | ||
} // namespace ProcessLib::RichardsMechanics |
33 changes: 33 additions & 0 deletions
33
ProcessLib/RichardsMechanics/ConstitutiveRelations/CreateConstitutiveSetting.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <map> | ||
|
||
#include "MaterialLib/SolidModels/MechanicsBase.h" | ||
#include "ParameterLib/Parameter.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
template <int DisplacementDim> | ||
struct CreateConstitutiveSetting | ||
{ | ||
static std::map< | ||
int, | ||
std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim>>> | ||
createSolidConstitutiveRelations( | ||
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& | ||
parameters, | ||
std::optional<ParameterLib::CoordinateSystem> const& | ||
local_coordinate_system, | ||
BaseLib::ConfigTree const& config); | ||
}; | ||
} // namespace ProcessLib::RichardsMechanics |
19 changes: 19 additions & 0 deletions
19
ProcessLib/RichardsMechanics/ConstitutiveRelations/Density.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "BaseLib/StrongType.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
// effective density of both the solid and fluid phases | ||
using Density = BaseLib::StrongType<double, struct DensityTag>; | ||
} // namespace ProcessLib::RichardsMechanics |
19 changes: 19 additions & 0 deletions
19
ProcessLib/RichardsMechanics/ConstitutiveRelations/EffectivePorePressure.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "BaseLib/StrongType.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
using EffectivePorePressure = | ||
BaseLib::StrongType<double, struct EffectivePorePressureTag>; | ||
} // namespace ProcessLib::RichardsMechanics |
18 changes: 18 additions & 0 deletions
18
ProcessLib/RichardsMechanics/ConstitutiveRelations/LiquidDensity.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* \file | ||
* \copyright | ||
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) | ||
* Distributed under a Modified BSD License. | ||
* See accompanying file LICENSE.txt or | ||
* http://www.opengeosys.org/project/license | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "BaseLib/StrongType.h" | ||
|
||
namespace ProcessLib::RichardsMechanics | ||
{ | ||
using LiquidDensity = BaseLib::StrongType<double, struct LiquidDensityTag>; | ||
} // namespace ProcessLib::RichardsMechanics |
Oops, something went wrong.