Commit 78bd0bb2 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1022 Fluidmass: add still more methods.

parent 64f58c20
......@@ -11,7 +11,7 @@
#include "FiniteElement/FiniteElementSpace/GodOfDofManager.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/InputParameterList.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/InterpolatorHolder.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/Data/Fluidmass.hpp"
......@@ -35,8 +35,10 @@ namespace HappyHeart
Fluidmass::Fluidmass(const Monolithic& monolithic_data,
const GlobalMatrix& monolithic_2_mass)
: from_monolithic_parent(monolithic_data, monolithic_2_mass)
const GlobalMatrix& monolithic_2_mass,
const InterpolatorHolder& interpolator_holder)
: from_monolithic_parent(monolithic_data, monolithic_2_mass),
interpolator_holder_(interpolator_holder)
{
decltype(auto) god_of_dof_manager = GodOfDofManager::GetInstance();
......@@ -66,9 +68,13 @@ namespace HappyHeart
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_mass));
current_value_on_fluid_ = std::make_unique<GlobalVector>(fluid_numbering_subset);
AllocateGlobalVector(fluid_god_of_dof, *current_value_on_fluid_);
auto& value = *current_value_on_fluid_;
AllocateGlobalVector(fluid_god_of_dof, value);
global_vector_temporary_fluid_parent::InitGlobalVectorTemporary(*current_value_on_fluid_);
new_minus_current_on_fluid_ = std::make_unique<GlobalVector>(value);
current_minus_former_on_fluid_ = std::make_unique<GlobalVector>(value);
global_vector_temporary_fluid_parent::InitGlobalVectorTemporary(value);
}
......@@ -113,6 +119,26 @@ namespace HappyHeart
felt_space,
fluid_mass_unknown,
GetCurrentMinusFormerOnSolid());
decltype(auto) fluid_mesh = fluid_god_of_dof.GetGeometricMeshRegion();
const auto& fluid_felt_space = fluid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::fluid));
new_minus_current_on_fluid_as_param_ =
std::make_unique<scalar_at_dof_type>("New - current fluid mass on fluid",
fluid_mesh,
fluid_felt_space,
fluid_mass_unknown,
GetNewMinusCurrentOnFluid());
current_minus_former_on_fluid_as_param_ =
std::make_unique<scalar_at_dof_type>("Current - former fluid mass on fluid",
fluid_mesh,
fluid_felt_space,
fluid_mass_unknown,
GetCurrentMinusFormerOnFluid());
decltype(auto) inlet_border_felt_space
......@@ -208,6 +234,49 @@ namespace HappyHeart
}
const GlobalVector& Fluidmass::GetNewMinusCurrentOnFluid() const noexcept
{
assert(!(!new_minus_current_on_fluid_));
auto& ret = *new_minus_current_on_fluid_;
if (new_minus_current_on_fluid_tag_ != GetValueTag())
{
Wrappers::Petsc::MatMult(GetInterpolatorHolder().GetMatrixFluidmassSolidToFluid(),
GetNewMinusCurrentOnSolid(),
ret,
__FILE__, __LINE__);
new_minus_current_on_fluid_tag_ = GetValueTag();
}
return *new_minus_current_on_fluid_;
}
const GlobalVector& Fluidmass::GetCurrentMinusFormerOnFluid() const noexcept
{
assert(!(!current_minus_former_on_fluid_));
auto& ret = *current_minus_former_on_fluid_;
if (current_minus_former_on_fluid_tag_ != GetValueTag())
{
Wrappers::Petsc::MatMult(GetInterpolatorHolder().GetMatrixFluidmassSolidToFluid(),
GetCurrentMinusFormerOnSolid(),
ret,
__FILE__, __LINE__);
current_minus_former_on_fluid_tag_ = GetValueTag();
}
return *current_minus_former_on_fluid_;
}
} // namespace DataNS
......
......@@ -92,7 +92,8 @@ namespace HappyHeart
//! Constructor.
explicit Fluidmass(const Monolithic& monolithic_data,
const GlobalMatrix& monolithic_2_mass);
const GlobalMatrix& monolithic_2_mass,
const InterpolatorHolder& interpolator_holder);
//! Destructor.
~Fluidmass() = default;
......@@ -133,14 +134,14 @@ namespace HappyHeart
GlobalVector& GetNonCstFormer() noexcept;
/*!
*\brief Constant accessor to the new minus current fluid mass expressed at dofs of the solid mesh.*
*\brief Constant accessor to the new minus current fluid mass expressed at dofs of the solid mesh.
*
* The vector is automatically updated if need be.
*/
const GlobalVector& GetNewMinusCurrentOnSolid() const noexcept;
/*!
*\brief Constant accessor to the current minus former fluid mass expressed at dofs of the solid mesh.*
*\brief Constant accessor to the current minus former fluid mass expressed at dofs of the solid mesh.
*
* The vector is automatically updated if need be.
*/
......@@ -226,10 +227,25 @@ namespace HappyHeart
//! Non constant accessor to projection onto fluid mesh value at iteration {n - 1}.
GlobalVector& GetNonCstFormerOnFluid() noexcept;
/*!
*\brief Constant accessor to the new minus current fluid mass expressed at dofs of the fluid mesh.
*
* The vector is automatically updated if need be.
*/
const GlobalVector& GetNewMinusCurrentOnFluid() const noexcept;
/*!
*\brief Constant accessor to the current minus former fluid mass expressed at dofs of the fluid mesh.
*
* The vector is automatically updated if need be.
*/
const GlobalVector& GetCurrentMinusFormerOnFluid() const noexcept;
///@}
//! Interpolator holder.
const InterpolatorHolder& GetInterpolatorHolder() const noexcept;
private:
......@@ -283,6 +299,23 @@ namespace HappyHeart
* need to be recomputed.
*/
mutable unsigned int new_minus_current_on_solid_tag_ = NumericNS::UninitializedIndex<unsigned int>();
/*!
* \brief Tag used to check whether the current_minus_former_on_fluid_ is up-to-date.
*
* If this tag is equal to GetValueTag(); current_minus_former_on_fluid_ already holds the correct value and doesn't
* need to be recomputed.
*/
mutable unsigned int current_minus_former_on_fluid_tag_ = NumericNS::UninitializedIndex<unsigned int>();
/*!
* \brief Tag used to check whether the new_minus_current_on_fluid_ is up-to-date.
*
* If this tag is equal to GetValueTag(); new_minus_current_on_fluid_ already holds the correct value and doesn't
* need to be recomputed.
*/
mutable unsigned int new_minus_current_on_fluid_tag_ = NumericNS::UninitializedIndex<unsigned int>();
//! Delta fluid mass (for dH computation).
......@@ -317,6 +350,13 @@ namespace HappyHeart
ParameterAtDof<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None>::unique_ptr
current_value_on_inlet_border_as_param_ = nullptr;
//! Parameter that encapsulates new minus current fluid_mass_vector, expressed on the fluid mesh.
ParameterAtDof<ParameterNS::Type::scalar>::unique_ptr new_minus_current_on_fluid_as_param_ = nullptr;
//! Parameter that encapsulates new minus current fluid_mass_vector, expressed on the fluid mesh.
ParameterAtDof<ParameterNS::Type::scalar>::unique_ptr current_minus_former_on_fluid_as_param_ = nullptr;
///@}
......@@ -338,6 +378,13 @@ namespace HappyHeart
//! Fluid mass expressed at dofs of the fluid mesh for iteration {n - 1}.
GlobalVector::unique_ptr former_value_on_fluid_ = nullptr;
//! Difference new - current expressed at dofs of the fluid mesh.
GlobalVector::unique_ptr new_minus_current_on_fluid_ = nullptr;
//! Difference current - former expressed at dofs of the fluid mesh.
GlobalVector::unique_ptr current_minus_former_on_fluid_ = nullptr;
///@}
private:
......@@ -354,9 +401,14 @@ namespace HappyHeart
///@}
//! Interpolator holder.
const InterpolatorHolder& interpolator_holder_;
};
} // namespace DataNS
......
......@@ -169,9 +169,16 @@ namespace HappyHeart
decltype(auto) new_value = GetCurrentMinusFormerOnSolid(); // lazy reevaluation may occur here.
static_cast<void>(new_value);
}
inline const InterpolatorHolder& Fluidmass::GetInterpolatorHolder() const noexcept
{
return interpolator_holder_;
}
} // namespace DataNS
......
......@@ -63,7 +63,8 @@ namespace HappyHeart
decltype(auto) monolithic_data = GetMonolithicData();
fluid_mass_data_ = std::make_unique<DataNS::Fluidmass>(monolithic_data,
interpolator_holder.GetMatrixMonolithicToFluidmassOnSolid());
interpolator_holder.GetMatrixMonolithicToFluidmassOnSolid(),
interpolator_holder);
fluid_velocity_data_ =
std::make_unique<DataNS::FluidVelocity>(monolithic_data,
......
......@@ -99,9 +99,9 @@ namespace HappyHeart
else
{
new_value = (hyperelastic_law.Wbulk(invariant_holder,
quad_pt,
geom_elt,
FluidmassNS::TimeLabel::new_value)
quad_pt,
geom_elt,
FluidmassNS::TimeLabel::new_value)
- hyperelastic_law.Wbulk(invariant_holder,
quad_pt,
geom_elt,
......
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