Skip to content

Commit

Permalink
Merge branch 'trm-C-el-change' into 'master'
Browse files Browse the repository at this point in the history
TRM: Changed elastic tangent stiffness computations

See merge request ogs/ogs!4942
  • Loading branch information
chleh committed Mar 11, 2024
2 parents 1f0a617 + de3a3ec commit 311f327
Show file tree
Hide file tree
Showing 30 changed files with 183 additions and 223 deletions.
14 changes: 12 additions & 2 deletions ProcessLib/Graph/Get.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ struct GetFlattenedTupleTypes

using type = boost::mp11::mp_flatten<std::tuple<Tuples...>>;
};

// Alias to be used together with static_assert to improve possible compile
// error messages.
template <typename List, typename Elem>
constexpr bool mp_contains_v = boost::mp11::mp_contains<List, Elem>::value;

// Alias to be used together with static_assert to improve possible compile
// error messages
template <typename Set>
constexpr bool mp_is_set_v = boost::mp11::mp_is_set<Set>::value;
} // namespace detail

/// Type-based access of an element of any of the passed tuples.
Expand All @@ -67,10 +77,10 @@ auto& get(Tuples&... ts)
mp_transform<std::remove_cvref_t, FlattenedTuple>;

static_assert(
mp_is_set<FlattenedTupleOfPlainTypes>::value,
detail::mp_is_set_v<FlattenedTupleOfPlainTypes>,
"The types of all elements of all passed tuples must be unique.");

static_assert(mp_contains<FlattenedTupleOfPlainTypes, T>::value,
static_assert(detail::mp_contains_v<FlattenedTupleOfPlainTypes, T>,
"Type T must be inside any of the passed tuples.");

return detail::getImpl<T>(ts...);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#pragma once

#include "Biot.h"
#include "LiquidDensity.h"
#include "Porosity.h"
#include "SolidThermalExpansion.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Bishops.h"
#include "ProcessLib/ConstitutiveRelations/StrainData.h"
#include "Saturation.h"
#include "SolidCompressibility.h"
#include "SolidCompressibilityData.h"

namespace ProcessLib::ThermoRichardsMechanics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@

#pragma once

#include "Base.h"

namespace ProcessLib::ThermoRichardsMechanics
{
template <int DisplacementDim>
struct ElasticTangentStiffnessData
struct SolidCompressibilityData
{
KelvinMatrix<DisplacementDim> C_el;
double beta_SR;
};
} // namespace ProcessLib::ThermoRichardsMechanics
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#pragma once

#include "Biot.h"
#include "LiquidDensity.h"
#include "Porosity.h"
#include "Saturation.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "ProcessLib/ConstitutiveRelations/StrainData.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Bishops.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidCompressibility.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidCompressibilityData.h"

namespace ProcessLib::ThermoRichardsMechanics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqT.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EquivalentPlasticStrainData.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Gravity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/MechanicalStrainData.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Saturation.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidDensity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidMechanicsDataStateless.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Swelling.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMHeatStorageAndFlux.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMVaporDiffusion.h"
Expand All @@ -38,16 +36,7 @@ namespace ConstitutiveStressSaturation_StrainPressureTemperature
template <int DisplacementDim>
using StatefulData =
std::tuple<SaturationData, PorosityData, TransportPorosityData,
StrainData<DisplacementDim>,
// TODO swelling is not used in this constitutive setting, but
// the stateful data is set in setInitialConditionsConcrete()
// Once this has been refactored, the swelling code can be moved
// from the common to the original subdirectory for constitutive
// settings
SwellingDataStateful<DisplacementDim>,
// TODO get rid of that
MechanicalStrainData<DisplacementDim>,
TotalStressData<DisplacementDim>>;
StrainData<DisplacementDim>, TotalStressData<DisplacementDim>>;

template <int DisplacementDim>
using StatefulDataPrev = PrevStateOf<StatefulData<DisplacementDim>>;
Expand All @@ -71,12 +60,10 @@ using ConstitutiveData =
/// Data that stores intermediate values, which are not needed outside the
/// constitutive setting.
template <int DisplacementDim>
using ConstitutiveTempData =
std::tuple<ElasticTangentStiffnessData<DisplacementDim>, BiotData,
SolidCompressibilityData, SaturationDataDeriv, BishopsData,
// TODO why not usual state tracking for that?
PrevState<BishopsData>,
SolidThermalExpansionData<DisplacementDim>,
FluidThermalExpansionData, EquivalentPlasticStrainData>;
using ConstitutiveTempData = std::tuple<
BiotData, SolidCompressibilityData, SaturationDataDeriv, BishopsData,
// TODO why not usual state tracking for that?
PrevState<BishopsData>, SolidThermalExpansionData<DisplacementDim>,
FluidThermalExpansionData, EquivalentPlasticStrainData>;
} // namespace ConstitutiveStressSaturation_StrainPressureTemperature
} // namespace ProcessLib::ThermoRichardsMechanics
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#pragma once

#include "ElasticTangentStiffnessModel.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/DarcyLaw.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqP.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqT.h"
Expand All @@ -21,6 +20,8 @@
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMHeatStorageAndFlux.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMVaporDiffusion.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/SolidCompressibilityModel.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/SolidMechanics.h"

namespace ProcessLib::ThermoRichardsMechanics
{
Expand All @@ -34,17 +35,14 @@ struct ConstitutiveModels
explicit ConstitutiveModels(
TRMProcessData const& process_data,
SolidConstitutiveRelation<DisplacementDim> const& solid_material)
: elastic_tangent_stiffness_model(solid_material),
solid_compressibility_model(solid_material),
: solid_compressibility_model(solid_material),
s_mech_model(solid_material),
grav_model(process_data.specific_body_force),
darcy_model(process_data.specific_body_force),
eq_p_model(process_data.specific_body_force)
{
}

ElasticTangentStiffnessModel<DisplacementDim>
elastic_tangent_stiffness_model;
BiotModel biot_model;
SolidCompressibilityModel<DisplacementDim,
SolidConstitutiveRelation<DisplacementDim>>
Expand All @@ -53,7 +51,6 @@ struct ConstitutiveModels
BishopsPrevModel bishops_prev_model;
PorosityModel<DisplacementDim> poro_model;
TransportPorosityModel<DisplacementDim> transport_poro_model;
SwellingModel<DisplacementDim> swelling_model;
SolidThermalExpansionModel<DisplacementDim> s_therm_exp_model;
SolidMechanicsModel<DisplacementDim> s_mech_model;
LiquidDensityModel<DisplacementDim> rho_L_model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ void ConstitutiveSetting<DisplacementDim>::eval(
// solving the global equation system)
std::get<StrainData<DisplacementDim>>(state).eps.noalias() = eps_arg;

G::eval(models.elastic_tangent_stiffness_model, aux_data, tmp);
G::eval(models.biot_model, aux_data, tmp);
G::eval(models.solid_compressibility_model, aux_data, tmp);

G::eval(models.s_mech_model, aux_data, tmp, state, prev_state,
mat_state_tuple, cd);

G::eval(models.solid_compressibility_model, aux_data, tmp, cd);

G::eval(models.bishops_model, aux_data, state, tmp);
// TODO why not ordinary state tracking?
G::eval(models.bishops_prev_model, aux_data, prev_state, tmp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ namespace ConstitutiveStressSaturation_StrainPressureTemperature
template <int DisplacementDim>
struct ConstitutiveSetting
{
void init(ConstitutiveModels<DisplacementDim>&, double const /*t*/,
double const /*dt*/, ParameterLib::SpatialPosition const&,
MediaData const&, TemperatureData<DisplacementDim> const&,
StatefulData<DisplacementDim>&,
StatefulDataPrev<DisplacementDim>&) const
{
}

/// Evaluate the constitutive setting.
void eval(ConstitutiveModels<DisplacementDim>& models, double const t,
double const dt, ParameterLib::SpatialPosition const& x_position,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* \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 "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Biot.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidCompressibilityData.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidMechanicsDataStateless.h"

namespace ProcessLib::ThermoRichardsMechanics
{
namespace ConstitutiveStressSaturation_StrainPressureTemperature
{
template <int DisplacementDim, typename SolidMaterial>
struct SolidCompressibilityModel
{
explicit SolidCompressibilityModel(SolidMaterial const& solid_material)
: solid_material_(solid_material)
{
}

void eval(SpaceTimeData const& x_t,
BiotData const& biot_data,
SolidMechanicsDataStateless<DisplacementDim> const&
s_mech_data_stateless,
SolidCompressibilityData& out) const
{
out.beta_SR =
(1 - biot_data()) /
solid_material_.getBulkModulus(
x_t.t, x_t.x, &s_mech_data_stateless.stiffness_tensor);
}

private:
SolidMaterial const& solid_material_;
};
} // namespace ConstitutiveStressSaturation_StrainPressureTemperature
} // namespace ProcessLib::ThermoRichardsMechanics
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ void SolidMechanicsModel<DisplacementDim>::eval(
StrainData<DisplacementDim> const& eps_data,
PrevState<StrainData<DisplacementDim>> const& eps_prev_data,
MaterialStateData<DisplacementDim>& mat_state,
MechanicalStrainData<DisplacementDim>& eps_m_data,
PrevState<TotalStressData<DisplacementDim>> const& total_stress_data_prev,
TotalStressData<DisplacementDim>& total_stress_data,
EquivalentPlasticStrainData& equiv_plast_strain_data,
Expand All @@ -32,12 +31,6 @@ void SolidMechanicsModel<DisplacementDim>::eval(
namespace MPL = MaterialPropertyLib;

double const T_prev = T_data.T_prev;

// This constitutive setting does not need eps_m. But eps_m is there,
// because it is set in setInitialConditionsConcrete()
// We set it to NaN for now.
eps_m_data.eps_m.noalias() = KV::KVnan<DisplacementDim>();

auto const& eps_total = eps_data.eps;
auto const& eps_total_prev = eps_prev_data->eps;
auto const& sigma_total_prev = total_stress_data_prev->sigma_total;
Expand Down
Loading

0 comments on commit 311f327

Please sign in to comment.