Commit 3d7f3a3d authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#820 Add VariableHolder in SolidVariationalFormulation (and stop redefining...

#820 Add VariableHolder in SolidVariationalFormulation (and stop redefining there a new Solid object).
parent 16353c00
......@@ -4398,6 +4398,8 @@
BE1EBB0F1CA0A59600EC0EAA /* Model.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Model.cpp; path = Coloring/Model.cpp; sourceTree = "<group>"; };
BE1EBB101CA0A59600EC0EAA /* Model.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Model.hpp; path = Coloring/Model.hpp; sourceTree = "<group>"; };
BE1EBB111CA0A59600EC0EAA /* Model.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Model.hxx; path = Coloring/Model.hxx; sourceTree = "<group>"; };
BE2195771D40B28F00052F9C /* DeltaSolidVarf.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DeltaSolidVarf.hpp; sourceTree = "<group>"; };
BE2195781D40B28F00052F9C /* DeltaSolidVarf.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DeltaSolidVarf.hxx; sourceTree = "<group>"; };
BE2241BC19FA5FDE00B90563 /* InterfaceSpecialization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InterfaceSpecialization.cpp; sourceTree = "<group>"; };
BE2241BD19FA5FDE00B90563 /* InterfaceSpecialization.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InterfaceSpecialization.hpp; sourceTree = "<group>"; };
BE2241BE19FA5FDE00B90563 /* InterfaceSpecialization.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InterfaceSpecialization.hxx; sourceTree = "<group>"; };
......@@ -9615,6 +9617,8 @@
BEB7B2A31D12EC9E00FC333C /* VariationalFormulationComputeMatrixBlock.hxx */,
BEAE11F11D07064A00967C19 /* VariationalFormulationAccessors.hxx */,
BEAE11F21D07064A00967C19 /* VariationalFormulationInit.hxx */,
BE2195771D40B28F00052F9C /* DeltaSolidVarf.hpp */,
BE2195781D40B28F00052F9C /* DeltaSolidVarf.hxx */,
);
path = InnerLoop;
sourceTree = "<group>";
......@@ -321,7 +321,8 @@ namespace HappyHeart
std::move(bc_list),
GetHyperelasticLawPtr(),
GetSolidVelocityVector(),
GetInitialPorosityValue());
GetInitialPorosityValue(),
GetNonCstVariableHolder());
}
}
......
......@@ -107,7 +107,8 @@ namespace HappyHeart
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list,
const HyperelasticLawT* const hyperelastic_law,
const GlobalVector& dof_source,
double initial_porosity_value);
double initial_porosity_value,
VariableHolder& variable_holder);
//! Call the appropriate solver to deal with the equation.
void Solve();
......
......@@ -40,7 +40,8 @@ namespace HappyHeart
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list,
const HyperelasticLawT* const hyperelastic_law,
const GlobalVector& dof_source,
const double initial_porosity_value)
const double initial_porosity_value,
VariableHolder& variable_holder)
{
variational_formulation_ =
std::make_unique<variational_formulation_type>(mpi,
......@@ -52,7 +53,8 @@ namespace HappyHeart
std::move(boundary_condition_list),
hyperelastic_law,
dof_source,
initial_porosity_value);
initial_porosity_value,
variable_holder);
variational_formulation_->Init(input_parameter_data);
}
......
......@@ -30,6 +30,7 @@
# include "ModelInstances/Hyperelasticity/TimeSchemes/HalfSum/HalfSum.hpp"
# include "ModelInstances/Hyperelasticity/TimeSchemes/Midpoint/Midpoint.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/Crtp/VariableHolder.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/InputParameterList.hpp"
......@@ -67,6 +68,7 @@ namespace HappyHeart
EnumUnderlyingType(SolverIndex::main_solver)
>,
private ::HappyHeart::Crtp::Mutex<VariationalFormulationHyperElasticity<HyperelasticLawT, TimeSchemeT>>,
public ::HappyHeart::PoromechanicsNS::Crtp::VariableHolder<VariationalFormulationHyperElasticity<HyperelasticLawT, TimeSchemeT>>,
public VariationalFormulationNS::DofSourcePolicyNS::DofSource,
public FormulationSolverNS::HyperelasticLaw
<
......@@ -99,6 +101,8 @@ namespace HappyHeart
using ActiveStressPolicy =
::HappyHeart::GlobalVariationalOperatorNS::SecondPiolaKirchhoffStressTensorNS::ActiveStressPolicyNS::None;
using variable_holder_parent = ::HappyHeart::PoromechanicsNS::Crtp::VariableHolder<self>;
private:
using hyperelasticity_policy =
......@@ -149,7 +153,8 @@ namespace HappyHeart
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list,
const HyperelasticLawT* const hyperelastic_law,
const GlobalVector& dof_source,
double initial_porosity_value);
double initial_porosity_value,
VariableHolder& variable_holder);
//! Destructor.
~VariationalFormulationHyperElasticity() = default;
......@@ -372,10 +377,7 @@ namespace HappyHeart
//! Numbering subset covering the displacement in the main finite element space.
const NumberingSubset& numbering_subset_;
//! Material parameters related to the solid.
Solid::unique_ptr solid_ = nullptr;
//! Reference to hyperelastic law defined in the Model.
const HyperelasticLawT* const hyperelastic_law_;
......
......@@ -39,11 +39,13 @@ namespace HappyHeart
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list,
const HyperelasticLawT* const hyperelastic_law,
const GlobalVector& dof_source,
const double initial_porosity_value)
const double initial_porosity_value,
VariableHolder& variable_holder)
: parent(mpi,
time_manager,
god_of_dof,
std::move(boundary_condition_list)),
variable_holder_parent(variable_holder),
VariationalFormulationNS::DofSourcePolicyNS::DofSource(-1., dof_source), // #820 Check the sign (seems better than 1., but needs certainty!)
felt_space_(main_felt_space),
solid_displacement_(solid_displacement),
......@@ -64,12 +66,10 @@ namespace HappyHeart
void VariationalFormulationHyperElasticity<HyperelasticLawT, TimeSchemeT>
::SupplInit(const InputParameterDataT& input_parameter_data)
{
const auto& geometric_mesh_region = this->GetGodOfDof().GetGeometricMeshRegion();
solid_ = std::make_unique<Solid>(input_parameter_data,
geometric_mesh_region,
GetFEltSpace().GetQuadratureRulePerTopology());
static_cast<void>(input_parameter_data);
const auto& geometric_mesh_region = this->GetGodOfDof().GetGeometricMeshRegion();
if (!GetSolid().template GetParameter<Solid::param::volumic_mass>().IsConstant())
throw Exception("Current hyperelastic model is restricted to a constant volumic mass!",
__FILE__, __LINE__);
......@@ -455,8 +455,7 @@ namespace HappyHeart
inline const Solid& VariationalFormulationHyperElasticity<HyperelasticLawT, TimeSchemeT>
::GetSolid() const noexcept
{
assert(!(!solid_));
return *solid_;
return this->GetVariableHolder().GetSolid();
}
......
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