Commit b5dd6827 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1022 Add new template parameter to UpdatePressureAtQuadPt to say whether...

#1022 Add new template parameter to UpdatePressureAtQuadPt to say whether computation occurs on solid or fluid mesh. Information is not yet used within the operator.
parent 78bd0bb2
......@@ -40,8 +40,9 @@ namespace HappyHeart
ParameterAtQuadraturePoint<::HappyHeart::ParameterNS::Type::scalar>;
//! Alias to pressure parameter operator.
template<MeshIndex MeshIndexT>
using pressure_parameter_operator_type =
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>;
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndexT>;
//! \copydoc doxygen_hide_alias_self
using self = NewFluidPressure<HyperelasticLawT>;
......@@ -83,10 +84,10 @@ namespace HappyHeart
public:
//! Operator which updates pressure parameter on solid mesh.
pressure_parameter_operator_type& GetNonCstUpdatePressureParamOnSolid() noexcept;
pressure_parameter_operator_type<MeshIndex::solid>& GetNonCstUpdatePressureParamOnSolid() noexcept;
//! Operator which updates pressure parameter on solid mesh.
pressure_parameter_operator_type& GetNonCstUpdatePressureParamOnFluid() noexcept;
pressure_parameter_operator_type<MeshIndex::fluid>& GetNonCstUpdatePressureParamOnFluid() noexcept;
//! Hyperelastic law.
const HyperelasticLawT& GetHyperelasticLaw() const noexcept;
......@@ -98,13 +99,13 @@ namespace HappyHeart
typename pressure_parameter_type::unique_ptr pressure_parameter_on_solid_ = nullptr;
//! Operator which updates pressure parameter.
typename pressure_parameter_operator_type::unique_ptr update_pressure_param_on_solid_ = nullptr;
typename pressure_parameter_operator_type<MeshIndex::solid>::unique_ptr update_pressure_param_on_solid_ = nullptr;
//! Pressure parameter.
typename pressure_parameter_type::unique_ptr pressure_parameter_on_fluid_ = nullptr;
//! Operator which updates pressure parameter.
typename pressure_parameter_operator_type::unique_ptr update_pressure_param_on_fluid_ = nullptr;
typename pressure_parameter_operator_type<MeshIndex::fluid>::unique_ptr update_pressure_param_on_fluid_ = nullptr;
//! Hyperelastic law.
const HyperelasticLawT& hyperelastic_law_;
......
......@@ -66,11 +66,11 @@ namespace HappyHeart
decltype(auto) hyperelastic_law = GetHyperelasticLaw();
update_pressure_param_on_solid_ =
std::make_unique<pressure_parameter_operator_type>(solid_felt_space,
solid_displacement_unknown,
*pressure_parameter_on_solid_,
hyperelastic_law,
this->GetCauchyGreenTensor());
std::make_unique<pressure_parameter_operator_type<MeshIndex::solid>>(solid_felt_space,
solid_displacement_unknown,
*pressure_parameter_on_solid_,
hyperelastic_law,
this->GetCauchyGreenTensor());
decltype(auto) fluid_felt_space =
fluid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::fluid));
......@@ -83,11 +83,11 @@ namespace HappyHeart
time_manager);
update_pressure_param_on_fluid_ =
std::make_unique<pressure_parameter_operator_type>(fluid_felt_space,
solid_displacement_unknown,
*pressure_parameter_on_fluid_,
hyperelastic_law,
this->GetCauchyGreenTensor()); // \todo #1022 Probably another one...
std::make_unique<pressure_parameter_operator_type<MeshIndex::fluid>>(fluid_felt_space,
solid_displacement_unknown,
*pressure_parameter_on_fluid_,
hyperelastic_law,
this->GetCauchyGreenTensor()); // \todo #1022 Probably another one...
}
......@@ -100,7 +100,7 @@ namespace HappyHeart
template<class HyperelasticLawT>
typename NewFluidPressure<HyperelasticLawT>::pressure_parameter_operator_type&
typename NewFluidPressure<HyperelasticLawT>::template pressure_parameter_operator_type<MeshIndex::solid>&
NewFluidPressure<HyperelasticLawT>::GetNonCstUpdatePressureParamOnSolid() noexcept
{
assert(!(!update_pressure_param_on_solid_));
......@@ -109,7 +109,7 @@ namespace HappyHeart
template<class HyperelasticLawT>
typename NewFluidPressure<HyperelasticLawT>::pressure_parameter_operator_type&
typename NewFluidPressure<HyperelasticLawT>::template pressure_parameter_operator_type<MeshIndex::fluid>&
NewFluidPressure<HyperelasticLawT>::GetNonCstUpdatePressureParamOnFluid() noexcept
{
assert(!(!update_pressure_param_on_fluid_));
......
......@@ -99,7 +99,7 @@ namespace HappyHeart
double internal_friction,
const HyperelasticLawT& law,
const cauchy_green_tensor_type& cauchy_green_tensor,
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>& update_pressure_operator,
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::fluid>& update_pressure_operator,
const TimeManager& time_manager,
const QuadratureRulePerTopology* const quadrature_rule_per_topology = nullptr);
......@@ -161,12 +161,12 @@ namespace HappyHeart
//! Update pressure operator.
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>& GetNonCstUpdatePressureOperator() const noexcept;
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::fluid>& GetNonCstUpdatePressureOperator() const noexcept;
private:
//! Update pressure operator.
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>& update_pressure_operator_;
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::fluid>& update_pressure_operator_;
};
......
......@@ -37,7 +37,7 @@ namespace HappyHeart
const double internal_friction,
const HyperelasticLawT& law,
const cauchy_green_tensor_type& cauchy_green_tensor,
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>& update_pressure_operator,
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::fluid>& update_pressure_operator,
const TimeManager& time_manager,
const QuadratureRulePerTopology* const quadrature_rule_per_topology)
: parent(felt_space,
......@@ -105,7 +105,8 @@ namespace HappyHeart
template<class HyperelasticLawT>
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>& Darcy<HyperelasticLawT>
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::fluid>&
Darcy<HyperelasticLawT>
::GetNonCstUpdatePressureOperator() const noexcept
{
return update_pressure_operator_;
......
//! \file
//
//
// PressureContribToRhs.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 03/02/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_IMPLICIT_STEP_x_IMPLICIT_STEP_FLUID_x_NEWTON_FIXED_POINT_x_GLOBAL_VARIATIONAL_OPERATOR_INSTANCES_x_PRESSURE_CONTRIB_TO_RHS_HPP_
# define HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_IMPLICIT_STEP_x_IMPLICIT_STEP_FLUID_x_NEWTON_FIXED_POINT_x_GLOBAL_VARIATIONAL_OPERATOR_INSTANCES_x_PRESSURE_CONTRIB_TO_RHS_HPP_
# include "Parameters/Parameter.hpp"
# include "Operators/GlobalVariationalOperator/GlobalVariationalOperator.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/Data/SolidDisplacement.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/ImplicitStep/ImplicitStepFluid/NewtonFixedPoint/LocalVariationalOperatorInstances/PressureContribToRhs.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/Parameter/UpdatePressureAtQuadPt.hpp"
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace ImplicitStepFluidNS
{
namespace NewtonFixedPointNS
{
namespace GlobalVariationalOperatorNS
{
/*!
* \brief Implementation of global PressureContribToRhs operator.
*
* \todo Improve the comment by writing its mathematical definition!
*/
template<class HyperelasticLawT>
class PressureContribToRhs final
: public GlobalVariationalOperator
<
PressureContribToRhs<HyperelasticLawT>,
LocalVariationalOperatorNS::PressureContribToRhs<HyperelasticLawT>
>
{
public:
//! \copydoc doxygen_hide_alias_self
using self = PressureContribToRhs<HyperelasticLawT>;
//! Alias to unique pointer.
using const_unique_ptr = std::unique_ptr<const self>;
//! Returns the name of the operator.
static const std::string& ClassName();
//! Convenient alias to pinpoint the GlobalVariationalOperator parent.
using parent = GlobalVariationalOperator
<
PressureContribToRhs,
LocalVariationalOperatorNS::PressureContribToRhs<HyperelasticLawT>
>;
//! Friendship to the parent class so that the CRTP can reach private methods defined below.
friend parent;
public:
/// \name Special members.
///@{
/*!
* \brief Constructor.
*
*/
explicit PressureContribToRhs(const FEltSpace& felt_space,
const Unknown& pressure_unknown,
const GlobalVector& current_solid_displacement,
const ScalarParameter<>& fluid_density,
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::solid>& update_pressure_operator,
const QuadratureRulePerTopology* const quadrature_rule_per_topology = nullptr);
//! Destructor.
~PressureContribToRhs() = default;
//! Copy constructor.
PressureContribToRhs(const PressureContribToRhs&) = default;
//! Move constructor.
PressureContribToRhs(PressureContribToRhs&&) = default;
//! Copy affectation.
PressureContribToRhs& operator=(const PressureContribToRhs&) = default;
//! Move affectation.
PressureContribToRhs& operator=(PressureContribToRhs&&) = default;
///@}
/*!
* \brief Assemble into one or several vectors.
*
* \tparam LinearAlgebraTupleT A tuple that may include \a GlobalVectorWithCoefficient objects.
*
* \param[in] global_vector_with_coeff_tuple List of global vectors into which the operator is
* assembled. These vectors are assumed to be already properly allocated.
* \param[in] domain Domain upon which the assembling takes place. Beware: if this domain is not a subset
* of the finite element space, assembling can only occur in a subset of the domain defined in the finite
* element space; if current \a domain is not a subset of finite element space one, assembling will occur
* upon the intersection of both.
*
*/
template<class LinearAlgebraTupleT>
void Assemble(LinearAlgebraTupleT&& global_vector_with_coeff_tuple,
const Domain& domain = Domain()) const;
private:
//! Solid displacement extended unknown.
const ExtendedUnknown& GetSolidDisplacementUnknown() const noexcept;
//! Reference to current solid displacement.
const GlobalVector& GetCurrentSolidDisplacement() const noexcept;
//! Update pressure operator.
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::solid>& GetNonCstUpdatePressureOperator() const noexcept;
private:
//! Reference to current solid displacement.
const GlobalVector& solid_current_displacement_;
//! Solid displacement extended unknown.
const ExtendedUnknown& solid_displacement_unknown_;
//! Update pressure operator.
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::solid>& update_pressure_operator_;
};
} // namespace GlobalVariationalOperatorNS
} // namespace NewtonFixedPointNS
} // namespace ImplicitStepFluidNS
} // namespace PoromechanicsNS
} // namespace HappyHeart
# include "ModelInstances/UnderDevelopment/Poromechanics/ImplicitStep/ImplicitStepFluid/NewtonFixedPoint/GlobalVariationalOperatorInstances/PressureContribToRhs.hxx"
#endif // HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_IMPLICIT_STEP_x_IMPLICIT_STEP_FLUID_x_NEWTON_FIXED_POINT_x_GLOBAL_VARIATIONAL_OPERATOR_INSTANCES_x_PRESSURE_CONTRIB_TO_RHS_HPP_
//! \file
//
//
// PressureContribToRhs.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 03/02/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_IMPLICIT_STEP_x_IMPLICIT_STEP_FLUID_x_NEWTON_FIXED_POINT_x_GLOBAL_VARIATIONAL_OPERATOR_INSTANCES_x_PRESSURE_CONTRIB_TO_RHS_HXX_
# define HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_IMPLICIT_STEP_x_IMPLICIT_STEP_FLUID_x_NEWTON_FIXED_POINT_x_GLOBAL_VARIATIONAL_OPERATOR_INSTANCES_x_PRESSURE_CONTRIB_TO_RHS_HXX_
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace ImplicitStepFluidNS
{
namespace NewtonFixedPointNS
{
namespace GlobalVariationalOperatorNS
{
template<class HyperelasticLawT>
PressureContribToRhs<HyperelasticLawT>
::PressureContribToRhs(const FEltSpace& felt_space,
const Unknown& pressure_unknown,
const GlobalVector& current_solid_displacement,
const ScalarParameter<>& fluid_density,
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::solid>& update_pressure_operator,
const QuadratureRulePerTopology* const quadrature_rule_per_topology)
: parent(felt_space,
pressure_unknown,
std::move(quadrature_rule_per_topology),
AllocateGradientFEltPhi::yes,
DoComputeProcessorWiseLocal2Global::yes, // \todo #820 See if no ok
fluid_density,
update_pressure_operator.GetPressureAtQuadPt()),
solid_current_displacement_(current_solid_displacement),
solid_displacement_unknown_(felt_space.GetExtendedUnknown(UnknownManager::GetInstance().GetUnknown(EnumUnderlyingType(UnknownIndex::solid_displacement)))),
update_pressure_operator_(update_pressure_operator)
{ }
template<class HyperelasticLawT>
const std::string& PressureContribToRhs<HyperelasticLawT>::ClassName()
{
static std::string name("PressureContribToRhs");
return name;
}
template<class HyperelasticLawT>
template<class LinearAlgebraTupleT>
inline void PressureContribToRhs<HyperelasticLawT>
::Assemble(LinearAlgebraTupleT&& linear_algebra_tuple,
const Domain& domain) const
{
GetNonCstUpdatePressureOperator().Update(GetCurrentSolidDisplacement());
parent::AssembleImpl(std::move(linear_algebra_tuple),
domain);
}
template<class HyperelasticLawT>
const GlobalVector& PressureContribToRhs<HyperelasticLawT>
::GetCurrentSolidDisplacement() const noexcept
{
return solid_current_displacement_;
}
template<class HyperelasticLawT>
const ExtendedUnknown& PressureContribToRhs<HyperelasticLawT>::GetSolidDisplacementUnknown() const noexcept
{
return solid_displacement_unknown_;
}
template<class HyperelasticLawT>
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndex::solid>&
PressureContribToRhs<HyperelasticLawT>
::GetNonCstUpdatePressureOperator() const noexcept
{
return update_pressure_operator_;
}
} // namespace GlobalVariationalOperatorNS
} // namespace NewtonFixedPointNS
} // namespace ImplicitStepFluidNS
} // namespace PoromechanicsNS
} // namespace HappyHeart
#endif // HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_IMPLICIT_STEP_x_IMPLICIT_STEP_FLUID_x_NEWTON_FIXED_POINT_x_GLOBAL_VARIATIONAL_OPERATOR_INSTANCES_x_PRESSURE_CONTRIB_TO_RHS_HXX_
......@@ -201,8 +201,9 @@ namespace HappyHeart
ParameterAtQuadraturePoint<::HappyHeart::ParameterNS::Type::scalar>;
//! Alias to pressure parameter operator.
template<MeshIndex MeshIndexT>
using pressure_parameter_operator_type =
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>;
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndexT>;
public:
......@@ -238,8 +239,8 @@ namespace HappyHeart
DataNS::Fluidmass& fluid_mass_data,
DataNS::SolidDisplacement& solid_displacement_data,
DataNS::SolidVelocity& solid_velocity_data,
pressure_parameter_operator_type& pressure_on_solid_operator,
pressure_parameter_operator_type& pressure_on_fluid_operator);
pressure_parameter_operator_type<MeshIndex::solid>& pressure_on_solid_operator,
pressure_parameter_operator_type<MeshIndex::fluid>& pressure_on_fluid_operator);
//! Destructor.
......@@ -552,10 +553,10 @@ namespace HappyHeart
const HyperelasticLawT& GetHyperelasticLaw() const noexcept;
//! Operator which updates pressure parameter on solid mesh.
pressure_parameter_operator_type& GetNonCstUpdatePressureParamOnSolid() noexcept;
pressure_parameter_operator_type<MeshIndex::solid>& GetNonCstUpdatePressureParamOnSolid() noexcept;
//! Operator which updates pressure parameter on solid mesh.
pressure_parameter_operator_type& GetNonCstUpdatePressureParamOnFluid() noexcept;
pressure_parameter_operator_type<MeshIndex::fluid>& GetNonCstUpdatePressureParamOnFluid() noexcept;
public:
......@@ -771,10 +772,10 @@ namespace HappyHeart
const NumberingSubset& numbering_subset_;
//! Operator which updates pressure parameter.
pressure_parameter_operator_type& pressure_on_solid_operator_;
pressure_parameter_operator_type<MeshIndex::solid>& pressure_on_solid_operator_;
//! Operator which updates pressure parameter.
pressure_parameter_operator_type& pressure_on_fluid_operator_;
pressure_parameter_operator_type<MeshIndex::fluid>& pressure_on_fluid_operator_;
};
......
......@@ -373,7 +373,7 @@ namespace HappyHeart
template<class HyperelasticLawT>
inline typename VariationalFormulation<HyperelasticLawT>::pressure_parameter_operator_type&
inline typename VariationalFormulation<HyperelasticLawT>::template pressure_parameter_operator_type<MeshIndex::solid>&
VariationalFormulation<HyperelasticLawT>::GetNonCstUpdatePressureParamOnSolid() noexcept
{
return pressure_on_solid_operator_;
......@@ -381,7 +381,7 @@ namespace HappyHeart
template<class HyperelasticLawT>
inline typename VariationalFormulation<HyperelasticLawT>::pressure_parameter_operator_type&
inline typename VariationalFormulation<HyperelasticLawT>::template pressure_parameter_operator_type<MeshIndex::fluid>&
VariationalFormulation<HyperelasticLawT>::GetNonCstUpdatePressureParamOnFluid() noexcept
{
return pressure_on_fluid_operator_;
......
......@@ -54,8 +54,8 @@ namespace HappyHeart
DataNS::Fluidmass& fluid_mass_data,
DataNS::SolidDisplacement& solid_displacement_data,
DataNS::SolidVelocity& solid_velocity_data,
pressure_parameter_operator_type& pressure_on_solid_operator,
pressure_parameter_operator_type& pressure_on_fluid_operator)
pressure_parameter_operator_type<MeshIndex::solid>& pressure_on_solid_operator,
pressure_parameter_operator_type<MeshIndex::fluid>& pressure_on_fluid_operator)
: parent(mpi,
time_manager,
god_of_dof,
......@@ -388,6 +388,7 @@ namespace HappyHeart
ComputeT21(DoRecomputeBlock::yes, Wrappers::Petsc::DoReuseMatrix::no);
ComputeT32(DoRecomputeBlock::yes, Wrappers::Petsc::DoReuseMatrix::no);
}
} // namespace NewtonFixedPointNS
......
......@@ -169,8 +169,9 @@ namespace HappyHeart
//! Alias to pressure parameter operator.
template<MeshIndex MeshIndexT>
using pressure_parameter_operator_type =
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT>;
GlobalParameterOperatorNS::UpdatePressureAtQuadPt<HyperelasticLawT, MeshIndexT>;
//! Alias to pressure parameter.
using pressure_parameter_type =
......@@ -210,7 +211,7 @@ namespace HappyHeart
DataNS::Monolithic& monolithic_data,
DataNS::Fluidmass& fluid_mass_data,
DataNS::FluidVelocity& fluid_velocity_data,
pressure_parameter_operator_type& pressure_on_fluid_operator);
pressure_parameter_operator_type<MeshIndex::fluid>& pressure_on_fluid_operator);
//! Destructor.
<