Commit 62cd2655 authored by Tom Fischer's avatar Tom Fischer
Browse files

Merge branch 'trm-collect-ip-data-accessors' into 'master'

TRM: Collect IP data accessors in the local assembler interface

See merge request ogs/ogs!4237
parents 5e8d5b6e 4d617b39
......@@ -119,6 +119,7 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface,
return 0;
}
private:
std::vector<double> getSigma() const
{
constexpr int kelvin_vector_size =
......@@ -323,6 +324,7 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface,
cache);
}
public:
// TODO move to NumLib::ExtrapolatableElement
unsigned getNumberOfIntegrationPoints() const
{
......@@ -352,6 +354,67 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface,
prev_states_ = current_states_;
}
struct IPDataAccessorForExtrapolation
{
std::string name;
unsigned num_comp;
std::function<std::vector<double> const&(
LocalAssemblerInterface<DisplacementDim> const&,
const double /*t*/,
std::vector<GlobalVector*> const& /*x*/,
std::vector<
NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
std::vector<double>& /*cache*/)>
ip_data_accessor;
};
static std::vector<IPDataAccessorForExtrapolation>
getIPDataAccessorsForExtrapolation()
{
using Self = LocalAssemblerInterface<DisplacementDim>;
constexpr auto kv_size =
MathLib::KelvinVector::kelvin_vector_dimensions(DisplacementDim);
return {{"sigma", kv_size, &Self::getIntPtSigma},
{"swelling_stress", kv_size, &Self::getIntPtSwellingStress},
{"epsilon", kv_size, &Self::getIntPtEpsilon},
{"velocity", DisplacementDim, &Self::getIntPtDarcyVelocity},
{"saturation", 1, &Self::getIntPtSaturation},
{"porosity", 1, &Self::getIntPtPorosity},
{"transport_porosity", 1, &Self::getIntPtTransportPorosity},
{"dry_density_solid", 1, &Self::getIntPtDryDensitySolid},
{"liquid_density", 1, &Self::getIntPtLiquidDensity},
{"viscosity", 1, &Self::getIntPtViscosity}};
}
struct IPDataAccessorForIPWriter
{
std::string name;
unsigned num_comp;
std::vector<double> (LocalAssemblerInterface<DisplacementDim>::*
ip_data_accessor)() const;
};
static std::vector<IPDataAccessorForIPWriter>
getIPDataAccessorsForIPWriter()
{
using Self = LocalAssemblerInterface<DisplacementDim>;
constexpr auto kv_size =
MathLib::KelvinVector::kelvin_vector_dimensions(DisplacementDim);
// TODO (naumov) remove ip suffix. Probably needs modification of the
// mesh properties, s.t. there is no "overlapping" with cell/point data.
// See getOrCreateMeshProperty.
return {
{"sigma_ip", kv_size, &Self::getSigma},
{"saturation_ip", 1, &Self::getSaturation},
{"porosity_ip", 1, &Self::getPorosity},
{"transport_porosity_ip", 1, &Self::getTransportPorosity},
{"swelling_stress_ip", kv_size, &Self::getSwellingStress},
{"epsilon_ip", kv_size, &Self::getEpsilon},
};
}
protected:
ThermoRichardsMechanicsProcessData<DisplacementDim>& process_data_;
......
......@@ -51,43 +51,14 @@ ThermoRichardsMechanicsProcess<DisplacementDim>::ThermoRichardsMechanicsProcess(
heat_flux_ = MeshLib::getOrCreateMeshProperty<double>(
mesh, "HeatFlowRate", MeshLib::MeshItemType::Node, 1);
// TODO (naumov) remove ip suffix. Probably needs modification of the mesh
// properties, s.t. there is no "overlapping" with cell/point data.
// See getOrCreateMeshProperty.
_integration_point_writer.emplace_back(
std::make_unique<IntegrationPointWriter>(
"sigma_ip",
static_cast<int>(mesh.getDimension() == 2 ? 4 : 6) /*n components*/,
integration_order, local_assemblers_, &LocalAssemblerIF::getSigma));
_integration_point_writer.emplace_back(
std::make_unique<IntegrationPointWriter>(
"saturation_ip", 1 /*n components*/, integration_order,
local_assemblers_, &LocalAssemblerIF::getSaturation));
_integration_point_writer.emplace_back(
std::make_unique<IntegrationPointWriter>(
"porosity_ip", 1 /*n components*/, integration_order,
local_assemblers_, &LocalAssemblerIF::getPorosity));
_integration_point_writer.emplace_back(
std::make_unique<IntegrationPointWriter>(
"transport_porosity_ip", 1 /*n components*/, integration_order,
local_assemblers_, &LocalAssemblerIF::getTransportPorosity));
_integration_point_writer.emplace_back(
std::make_unique<IntegrationPointWriter>(
"swelling_stress_ip",
static_cast<int>(mesh.getDimension() == 2 ? 4 : 6) /*n components*/,
integration_order, local_assemblers_,
&LocalAssemblerIF::getSwellingStress));
_integration_point_writer.emplace_back(
std::make_unique<IntegrationPointWriter>(
"epsilon_ip",
static_cast<int>(mesh.getDimension() == 2 ? 4 : 6) /*n components*/,
integration_order, local_assemblers_,
&LocalAssemblerIF::getEpsilon));
for (auto& [name, num_comp, ip_data_accessor] :
LocalAssemblerIF::getIPDataAccessorsForIPWriter())
{
_integration_point_writer.emplace_back(
std::make_unique<IntegrationPointWriter>(
name, num_comp, integration_order, local_assemblers_,
ip_data_accessor));
}
}
template <int DisplacementDim>
......@@ -172,40 +143,11 @@ void ThermoRichardsMechanicsProcess<DisplacementDim>::initializeConcreteProcess(
std::move(get_ip_values_function)));
};
add_secondary_variable("sigma",
MathLib::KelvinVector::KelvinVectorType<
DisplacementDim>::RowsAtCompileTime,
&LocalAssemblerIF::getIntPtSigma);
add_secondary_variable("swelling_stress",
MathLib::KelvinVector::KelvinVectorType<
DisplacementDim>::RowsAtCompileTime,
&LocalAssemblerIF::getIntPtSwellingStress);
add_secondary_variable("epsilon",
MathLib::KelvinVector::KelvinVectorType<
DisplacementDim>::RowsAtCompileTime,
&LocalAssemblerIF::getIntPtEpsilon);
add_secondary_variable("velocity", DisplacementDim,
&LocalAssemblerIF::getIntPtDarcyVelocity);
add_secondary_variable("saturation", 1,
&LocalAssemblerIF::getIntPtSaturation);
add_secondary_variable("porosity", 1, &LocalAssemblerIF::getIntPtPorosity);
add_secondary_variable("transport_porosity", 1,
&LocalAssemblerIF::getIntPtTransportPorosity);
add_secondary_variable("dry_density_solid", 1,
&LocalAssemblerIF::getIntPtDryDensitySolid);
add_secondary_variable("liquid_density", 1,
&LocalAssemblerIF::getIntPtLiquidDensity);
add_secondary_variable("viscosity", 1,
&LocalAssemblerIF::getIntPtViscosity);
for (auto& [name, num_comp, fct] : LocalAssemblerInterface<
DisplacementDim>::getIPDataAccessorsForExtrapolation())
{
add_secondary_variable(name, num_comp, fct);
};
//
// enable output of internal variables defined by material models
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment