Commit 2ed6e658 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#820 Move Solid object within VariableHolder.

parent bf351cb3
......@@ -96,7 +96,7 @@ namespace HappyHeart
unsigned int geom_mesh_region_dimension,
const Solid& solid,
const TimeManager& time_manager,
const HyperelasticLawT* hyperelastic_law,
const HyperelasticLawT& hyperelastic_law,
QuadratureRulePerTopology::const_unique_ptr&& quadrature_rule_per_topology = nullptr);
//! Destructor.
......@@ -179,7 +179,7 @@ namespace HappyHeart
} // namespace HappyHeart
# include "ModelInstances/UnderDevelopment/Poromechanics/GlobalVariationalOperatorInstances/SolidDeltaResidual.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/GlobalVariationalOperatorInstances/SolidDeltaResidual.hxx"
#endif // HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_GLOBAL_VARIATIONAL_OPERATOR_INSTANCES_x_SOLID_DELTA_RESIDUAL_HPP_
......@@ -31,7 +31,7 @@ namespace HappyHeart
unsigned int geom_mesh_region_dimension,
const Solid& solid,
const TimeManager& time_manager,
const typename HyperelasticityPolicyT::law_type* hyperelastic_law,
const HyperelasticLawT& hyperelastic_law,
QuadratureRulePerTopology::const_unique_ptr&& quadrature_rule_per_topology)
: parent(felt_space,
vectorial_unknown,
......
......@@ -294,6 +294,9 @@ namespace HappyHeart
//! Constant accessor to the t21 operator.
const GlobalVariationalOperatorNS::T21<HyperelasticLawT>& GetT21Operator() const noexcept;
//! Constant accessor to the solidDeltaResidual (deltaResidualFSIMiddlePoint in dH.edp).
const GlobalVariationalOperatorNS::SolidDeltaResidual<HyperelasticLawT>& GetSolidDeltaResidualOperator() const noexcept;
/*!
* \brief Constant accessor to the matrix into which mass operator is assembled (\todo #820 See if
* really required...).
......@@ -641,7 +644,11 @@ namespace HappyHeart
GlobalVector& GetNonCstSolidDifferentialVelocityOnRobinInterface() noexcept;
//! Constant accessor to the deltaResidual ( odo #820 Rename and comment!)
const GlobalVector& GetDeltaResidual() const noexcept;
//! Non constant accessor to the deltaResidual ( odo #820 Rename and comment!)
GlobalVector& GetNonCstDeltaResidual() noexcept;
private:
......@@ -963,6 +970,9 @@ namespace HappyHeart
//! deltaSolidVector (\todo #820 Rename and comment!)
GlobalVector::unique_ptr delta_solid_vector_ = nullptr;
//! deltaResidual (\todo #820 Rename and comment!)
GlobalVector::unique_ptr delta_residual_ = nullptr;
///@}
......
......@@ -347,7 +347,14 @@ namespace HappyHeart
PETSC_VIEWER_ASCII_MATLAB);
}
{
auto& delta_residual = GetNonCstDeltaResidual();
GlobalVectorWithCoefficient with_coeff(delta_residual, 1.);
// ASSEMBLE SHOULD NOT BE CALLED DIRECTLY HERE! Use the free function in Private
// GetSolidDeltaResidualOperator().Assemble(std::make_tuple(std::ref(with_coeff)),
//
// );
}
// \todo #820 At the moment, I accept my norm is not the same as Bruno's; see what Petsc gives when
......
......@@ -763,6 +763,30 @@ namespace HappyHeart
}
template<class HyperelasticLawT>
inline const GlobalVariationalOperatorNS::SolidDeltaResidual<HyperelasticLawT>& VariationalFormulation<HyperelasticLawT>
::GetSolidDeltaResidualOperator() const noexcept
{
assert(!(!solid_delta_residual_operator_));
return *solid_delta_residual_operator_;
}
template<class HyperelasticLawT>
inline const GlobalVector& VariationalFormulation<HyperelasticLawT>::GetDeltaResidual() const noexcept
{
assert(!(!delta_residual_));
return *delta_residual_;
}
template<class HyperelasticLawT>
inline GlobalVector& VariationalFormulation<HyperelasticLawT>::GetNonCstDeltaResidual() noexcept
{
return const_cast<GlobalVector&>(GetDeltaResidual());
}
} // namespace InnerLoopNS
......
......@@ -183,6 +183,8 @@ namespace HappyHeart
delta_solid_vector_ =
std::make_unique<GlobalVector>(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::solid_velocity)));
AllocateGlobalVector(solid_god_of_dof, GetNonCstDeltaSolidVector());
delta_residual_ = std::make_unique<GlobalVector>(GetDeltaSolidVector());
}
{
......@@ -329,7 +331,31 @@ namespace HappyHeart
GetFluidDensity(),
porosity,
DoComputeProcessorWiseLocal2Global::yes); // \todo #820 Check if no is ok.
{
using type = GlobalVariationalOperatorNS::SolidDeltaResidual<HyperelasticLawT>;
decltype(auto) god_of_dof_manager = GodOfDofManager::GetInstance();
decltype(auto) solid_god_of_dof =
god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::solid));
decltype(auto) felt_space =
solid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::solid));
decltype(auto) solid_disp =
unknown_manager.GetUnknown(EnumUnderlyingType(UnknownIndex::solid_displacement));
solid_delta_residual_operator_ =
std::make_unique<type>(felt_space,
solid_disp,
mesh_dimension,
variable_holder_parent::GetVariableHolder().GetSolid(),
parent::GetTimeManager(),
GetHyperelasticLaw());
}
{
using type = GVO::ScalarDivVectorial;
......
......@@ -84,11 +84,7 @@ namespace HappyHeart
using vector_type = LocalVector;
//! Alias to variational operator parent.
using parent = NonlinearLocalVariationalOperator
<
LocalMatrix,
LocalVector
>;
using parent = LinearLocalVariationalOperator<LocalVector>;
//! Alias to the parent that provides LocalMatrixStorage.
using matrix_parent = ::HappyHeart::Crtp::LocalMatrixStorage<self, 9ul>;
......@@ -134,7 +130,7 @@ namespace HappyHeart
elementary_data_type&& elementary_data,
const Solid& solid,
const TimeManager& time_manager,
const HyperelasticLawT* hyperelastic_law);
const HyperelasticLawT& hyperelastic_law);
//! Destructor.
virtual ~SolidDeltaResidual();
......@@ -281,7 +277,7 @@ namespace HappyHeart
LocalMatrix work_matrix_outer_product_;
//! Underlying hyperelasticity law.
const HyperelasticLawT* const hyperelastic_law_;
const HyperelasticLawT& hyperelastic_law_;
};
......
......@@ -43,11 +43,11 @@ namespace HappyHeart
elementary_data_type&& a_elementary_data,
const Solid& solid,
const TimeManager& time_manager,
const HyperelasticLawT* hyperelastic_law)
const HyperelasticLawT& hyperelastic_law)
: parent(unknown_list, std::move(a_elementary_data)),
hyperelastic_law_(hyperelastic_law),
matrix_parent(),
vector_parent()
vector_parent(),
hyperelastic_law_(hyperelastic_law)
{
const auto& elementary_data = parent::GetElementaryData();
const unsigned int Ncomponent = elementary_data.GetGeomEltDimension();
......
......@@ -261,10 +261,7 @@ namespace HappyHeart
//! Non constant accessor to the object which manages porosity parameters on either god of dof.
Private::PorosityParameter& GetNonCstPorosityParameter() noexcept;
//! Constant accessor to the material parameters related to the solid.
const Solid& GetSolid() const noexcept;
//! Constant accessor to the hyperelatic law to consider.
const hyperelastic_law_type& GetHyperelasticLaw() const noexcept;
......@@ -420,9 +417,7 @@ namespace HappyHeart
private:
//! Material parameters related to the solid.
Solid::unique_ptr solid_ = nullptr;
//! Object that includes the attributes used at many levels.
VariableHolder::unique_ptr variable_holder_ = nullptr;
......
......@@ -212,14 +212,6 @@ namespace HappyHeart
}
template<class SolidVariationalFormulationPolicyT>
inline const Solid& Model<SolidVariationalFormulationPolicyT>::GetSolid() const noexcept
{
assert(!(!solid_));
return *solid_;
}
template<class SolidVariationalFormulationPolicyT>
inline const typename Model<SolidVariationalFormulationPolicyT>::hyperelastic_law_type&
Model<SolidVariationalFormulationPolicyT>
......
......@@ -51,11 +51,7 @@ namespace HappyHeart
decltype(auto) solid_mesh = solid_god_of_dof.GetGeometricMeshRegion();
decltype(auto) felt_space = solid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::solid));
solid_ = std::make_unique<Solid>(input_parameter_data,
solid_mesh,
felt_space.GetQuadratureRulePerTopology()
);
// \todo #820 Order below will have to be adapted probably: porosity that is used in almost all
......@@ -277,7 +273,7 @@ namespace HappyHeart
DirichletBoundaryCondition::vector_shared_ptr bc_list;
hyperelastic_law_ =
std::make_unique<hyperelastic_law_type>(GetSolid(),
std::make_unique<hyperelastic_law_type>(GetVariableHolder().GetSolid(),
fluid_density,
GetPenalizationPorosity(),
GetInitialPorosityValue(),
......
......@@ -31,7 +31,8 @@ namespace HappyHeart
decltype(auto) fluid_god_of_dof = god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::fluid));
decltype(auto) solid_god_of_dof = god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::solid));
decltype(auto) fluid_mesh = fluid_god_of_dof.GetGeometricMeshRegion();
decltype(auto) solid_mesh = solid_god_of_dof.GetGeometricMeshRegion();
fluid_density_ = InitScalarParameter<InputParameter::Fluid::Density>("Fluid density",
fluid_mesh,
......@@ -83,7 +84,13 @@ namespace HappyHeart
time_manager);
}
{
decltype(auto) felt_space = solid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::solid));
solid_ = std::make_unique<Solid>(input_parameter_data,
solid_mesh,
felt_space.GetQuadratureRulePerTopology()
);
}
}
......
......@@ -18,6 +18,7 @@
# include "Core/LinearAlgebra/GlobalVector.hpp"
# include "Parameters/Parameter.hpp"
# include "Parameters/Compound/Solid/Solid.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/Private/SolidOnFluidMesh.hpp"
......@@ -114,6 +115,10 @@ namespace HappyHeart
Private::SolidOnFluidMesh& GetNonCstSolidOnFluidMesh() noexcept;
//! Constant accessor to the material parameters related to the solid.
const Solid& GetSolid() const noexcept;
private:
//! Fluid mass expressed at dofs of the solid mesh.
......@@ -134,6 +139,10 @@ namespace HappyHeart
//! Object which keeps track on solid displacement and velocity on fluid mesh.
Private::SolidOnFluidMesh::unique_ptr solid_on_fluid_mesh_ = nullptr;
//! Material parameters related to the solid.
Solid::unique_ptr solid_ = nullptr;
};
......
......@@ -84,6 +84,13 @@ namespace HappyHeart
{
return const_cast<Private::SolidOnFluidMesh&>(GetSolidOnFluidMesh());
}
inline const Solid& VariableHolder::GetSolid() const noexcept
{
assert(!(!solid_));
return *solid_;
}
......
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