Skip to content

Commit

Permalink
[PL/TRM] Refactored constitutive setting for automatic model construc…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
chleh committed May 28, 2024
1 parent fdf9b28 commit 7590e6c
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "LiquidDensity.h"
#include "LiquidViscosity.h"
#include "PermeabilityData.h"
#include "SpecificBodyForceData.h"
#include "ThermoOsmosis.h"

namespace ProcessLib::ThermoRichardsMechanics
Expand Down Expand Up @@ -47,6 +48,12 @@ struct DarcyLawModel
ThermoOsmosisData<DisplacementDim> const& th_osmosis_data,
DarcyLawData<DisplacementDim>& out) const;

static DarcyLawModel create(
SpecificBodyForceData<DisplacementDim> const& specific_body_force_data)
{
return DarcyLawModel{specific_body_force_data.specific_body_force};
}

private:
/// Gravity vector (specific body force).
Eigen::Vector<double, DisplacementDim> const b_;
Expand Down
7 changes: 7 additions & 0 deletions ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqP.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "LiquidViscosity.h"
#include "PermeabilityData.h"
#include "Saturation.h"
#include "SpecificBodyForceData.h"
#include "TRMStorage.h"
#include "TRMVaporDiffusion.h"

Expand Down Expand Up @@ -59,6 +60,12 @@ struct EqPModel
TRMStorageData const& storage_data,
EqPData<DisplacementDim>& out) const;

static EqPModel create(
SpecificBodyForceData<DisplacementDim> const& specific_body_force_data)
{
return EqPModel{specific_body_force_data.specific_body_force};
}

private:
/// Gravity vector (specific body force).
Eigen::Vector<double, DisplacementDim> const b_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "LiquidDensity.h"
#include "Saturation.h"
#include "SolidDensity.h"
#include "SpecificBodyForceData.h"

namespace ProcessLib::ThermoRichardsMechanics
{
Expand All @@ -39,6 +40,12 @@ struct GravityModel
SaturationDataDeriv const& dS_L_data,
GravityData<DisplacementDim>& out) const;

static GravityModel create(
SpecificBodyForceData<DisplacementDim> const& specific_body_force_data)
{
return GravityModel{specific_body_force_data.specific_body_force};
}

private:
Eigen::Vector<double, DisplacementDim> const specific_body_force_;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* \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 <Eigen/Core>

namespace ProcessLib::ThermoRichardsMechanics
{
template <int DisplacementDim>
struct SpecificBodyForceData
{
Eigen::Vector<double, DisplacementDim> specific_body_force;
};
} // namespace ProcessLib::ThermoRichardsMechanics
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqT.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EquivalentPlasticStrainData.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Gravity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/LiquidViscosity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Saturation.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidDensity.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#pragma once

#include "ProcessLib/Graph/ConstructModels.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/DarcyLaw.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqP.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqT.h"
Expand Down Expand Up @@ -60,32 +61,11 @@ ConstitutiveModels<DisplacementDim> createConstitutiveModels(
TRMProcessData const& process_data,
SolidConstitutiveRelation<DisplacementDim> const& solid_material)
{
return {
{},
SolidMechanicsModel<DisplacementDim>{solid_material},
SolidCompressibilityModel<DisplacementDim,
SolidConstitutiveRelation<DisplacementDim>>{
solid_material},
{},
{},
{},

{},
{},
GravityModel<DisplacementDim>{process_data.specific_body_force},
{},
{},
{},
{},
DarcyLawModel<DisplacementDim>{process_data.specific_body_force},
{},
{},

{},
{},
{},
EqPModel<DisplacementDim>{process_data.specific_body_force},
{}};
return ProcessLib::Graph::constructModels<
ConstitutiveModels<DisplacementDim>>(
SpecificBodyForceData<DisplacementDim>{
process_data.specific_body_force},
solid_material);
}

} // namespace ConstitutiveStressSaturation_StrainPressureTemperature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace ProcessLib::ThermoRichardsMechanics
{
namespace ConstitutiveStressSaturation_StrainPressureTemperature
{
// TODO remove typename SolidMaterial
template <int DisplacementDim, typename SolidMaterial>
struct SolidCompressibilityModel
{
Expand All @@ -38,6 +39,11 @@ struct SolidCompressibilityModel
x_t.t, x_t.x, &s_mech_data_stateless.stiffness_tensor);
}

static SolidCompressibilityModel create(SolidMaterial const& solid_material)
{
return SolidCompressibilityModel{solid_material};
}

private:
SolidMaterial const& solid_material_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ struct SolidMechanicsModel
PrevState<SaturationData> const& S_L_prev_data,
SaturationData& S_L_data, SaturationDataDeriv& dS_L_data) const;

static SolidMechanicsModel create(
SolidConstitutiveRelation<DisplacementDim> const& solid_material)
{
return SolidMechanicsModel{solid_material};
}

private:
SolidConstitutiveRelation<DisplacementDim> const& solid_material_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqT.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EquivalentPlasticStrainData.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Gravity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/LiquidViscosity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Saturation.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/SolidDensity.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#pragma once

#include "ElasticTangentStiffnessModel.h"
#include "ProcessLib/Graph/ConstructModels.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/DarcyLaw.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqP.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/EqT.h"
Expand Down Expand Up @@ -65,36 +66,11 @@ ConstitutiveModels<DisplacementDim> createConstitutiveModels(
TRMProcessData const& process_data,
SolidConstitutiveRelation<DisplacementDim> const& solid_material)
{
return {
ElasticTangentStiffnessModel<DisplacementDim>{solid_material},
{} /* BiotModel */,
SolidCompressibilityModel<DisplacementDim,
SolidConstitutiveRelation<DisplacementDim>>{
solid_material},
{} /* SaturationModel<DisplacementDim> */,
{} /* BishopsModel */,
{} /* BishopsPrevModel */,
{} /* PorosityModel<DisplacementDim> */,

{} /* SwellingModel<DisplacementDim> */,
{} /* SolidThermalExpansionModel<DisplacementDim> */,
SolidMechanicsModel<DisplacementDim>{solid_material},
{} /* LiquidDensityModel<DisplacementDim> */,

{} /* SolidDensityModel<DisplacementDim> */,
GravityModel<DisplacementDim>{process_data.specific_body_force},
{} /* LiquidViscosityModel<DisplacementDim> */,
{} /* TransportPorosityModel<DisplacementDim> */,
{} /* PermeabilityModel<DisplacementDim> */,
{} /* ThermoOsmosisModel<DisplacementDim> */,
DarcyLawModel<DisplacementDim>{process_data.specific_body_force},
{} /* TRMHeatStorageAndFluxModel<DisplacementDim> */,
{} /* TRMVaporDiffusionModel<DisplacementDim> */,
{} /* FluidThermalExpansionModel<DisplacementDim> */,
{} /* TRMStorageModel<DisplacementDim> */,
EqPModel<DisplacementDim>{process_data.specific_body_force},
{} /* EqTModel<DisplacementDim> */
};
return ProcessLib::Graph::constructModels<
ConstitutiveModels<DisplacementDim>>(
SpecificBodyForceData<DisplacementDim>{
process_data.specific_body_force},
solid_material);
}
} // namespace ConstitutiveStress_StrainTemperature
} // namespace ProcessLib::ThermoRichardsMechanics
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ struct ElasticTangentStiffnessModel
TemperatureData<DisplacementDim> const& T_data,
ElasticTangentStiffnessData<DisplacementDim>& out) const;

static ElasticTangentStiffnessModel create(
SolidConstitutiveRelation<DisplacementDim> const& solid_material)
{
return ElasticTangentStiffnessModel{solid_material};
}

private:
SolidConstitutiveRelation<DisplacementDim> const& solid_material_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace ProcessLib::ThermoRichardsMechanics
{
namespace ConstitutiveStress_StrainTemperature
{
// TODO remove typename SolidMaterial
template <int DisplacementDim, typename SolidMaterial>
struct SolidCompressibilityModel
{
Expand All @@ -35,6 +36,11 @@ struct SolidCompressibilityModel
x_t.t, x_t.x, &C_el_data.C_el);
}

static SolidCompressibilityModel create(SolidMaterial const& solid_material)
{
return SolidCompressibilityModel{solid_material};
}

private:
SolidMaterial const& solid_material_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ struct SolidMechanicsModel
return solid_material_.getInternalVariables();
}

static SolidMechanicsModel create(
SolidConstitutiveRelation<DisplacementDim> const& solid_material)
{
return SolidMechanicsModel{solid_material};
}

private:
SolidConstitutiveRelation<DisplacementDim> const& solid_material_;
};
Expand Down

0 comments on commit 7590e6c

Please sign in to comment.