Commit 74401f93 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#820 Poromechanics: enrich implicit varf with not yet tested contribution.

parent bc5cce5b
......@@ -248,7 +248,7 @@ Mesh1 = {
-- Path of the mesh file to use.
-- Expected format: "VALUE"
mesh = '${HOME}/Codes/HappyHeart/Data/Mesh/poromechanics_2x2.mesh',
mesh = '${HOME}/Codes/HappyHeart/Data/Mesh/poromechanics_3x3.mesh',
-- Format of the input mesh.
-- Expected format: "VALUE"
......@@ -275,7 +275,7 @@ Mesh2 = {
-- Path of the mesh file to use.
-- Expected format: "VALUE"
mesh = '${HOME}/Codes/HappyHeart/Data/Mesh/poromechanics_2x2.mesh',
mesh = '${HOME}/Codes/HappyHeart/Data/Mesh/poromechanics_3x3.mesh',
-- Format of the input mesh.
-- Expected format: "VALUE"
......
......@@ -51,8 +51,20 @@ namespace HappyHeart
auto& rhs = parent::GetNonCstSystemRhs(numbering_subset);
rhs.ZeroEntries(__FILE__, __LINE__);
// \todo #820 NOT YET TESTED FOR ONE OF THE CONTRIBUTION; WAIT SECOND ITERATION TO SEE IF IT IS OK.
// auto& mass_matrix = GetNonCstMassMatrix();
// GlobalMatrixWithCoefficient matrix(GetNonCstMassMatrix(), 1.);
// GetMassOperator().Assemble(std::make_tuple(std::ref(matrix)));
//
// Wrappers::Petsc::MatMult(mass_matrix,
// parent::GetSystemSolution(numbering_subset),
// rhs,
// __FILE__, __LINE__);
GlobalVectorWithCoefficient vector(rhs, -1.); // \todo #820 -1. empirical, to match Freefem's output. To check later!!!
GetInletPressureSourceOperator().Assemble(std::make_tuple(std::ref(vector)), time);
parent::ApplyEssentialBoundaryCondition<OperatorNS::Nature::nonlinear>(numbering_subset,
numbering_subset);
......@@ -60,6 +72,10 @@ namespace HappyHeart
rhs.Print<MpiScale::processor_wise>(parent::MpiHappyHeart(),
parent::GetOutputDirectory(numbering_subset) + "/implicit_rhs_time_" + std::to_string(time_manager.NtimeModified()) + ".hhdata",
__FILE__, __LINE__);
// parent::SolveLinear<IsFactorized::no>(numbering_subset, numbering_subset);
// parent::WriteSolution(time_manager, numbering_subset);
......@@ -73,6 +89,9 @@ namespace HappyHeart
parent::AllocateSystemMatrix(numbering_subset, numbering_subset);
parent::AllocateSystemVector(numbering_subset);
decltype(auto) system_matrix = parent::GetSystemMatrix(numbering_subset, numbering_subset);
mass_matrix_ = std::make_unique<GlobalMatrix>(system_matrix);
}
......@@ -102,15 +121,30 @@ namespace HappyHeart
god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::inlet_border));
namespace GVO = GlobalVariationalOperatorNS;
decltype(auto) porosity = GetPorosity();
inlet_pressure_source_operator_ =
std::make_unique<GVO::TransientSource<>>(inlet_border_felt_space,
fluid_velocity,
mesh_dimension,
default_quadrature_rule_set,
GetPorosity(),
porosity,
DoComputeProcessorWiseLocal2Global::yes,
GetInletPressure());
const auto& felt_space =
god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::fluid));
mass_operator_
= std::make_unique<GVO::Mass>(felt_space,
fluid_velocity,
mesh_dimension,
default_quadrature_rule_set,
porosity,
DoComputeProcessorWiseLocal2Global::yes); // \todo #820 Check if no is ok.
}
......
......@@ -25,6 +25,7 @@
# include "ModelInstances/UnderDevelopment/Poromechanics/InputParameterList.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/Crtp/Porosity.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/GlobalVariationalOperatorInstances/TransientSource.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/GlobalVariationalOperatorInstances/Mass.hpp"
namespace HappyHeart
......@@ -39,6 +40,9 @@ namespace HappyHeart
{
/*!
* \brief Variational formulation in charge of fluid implicit step.
*/
class VariationalFormulation
: public HappyHeart::VariationalFormulation
<
......@@ -156,12 +160,29 @@ namespace HappyHeart
//! Constant accessor to the inlet pressure (acts as a source).
const GlobalVariationalOperatorNS::TransientSource<>& GetInletPressureSourceOperator() const noexcept;
//! Constant accessor to the mass operator for fluid velocity.
const GlobalVariationalOperatorNS::Mass& GetMassOperator() const noexcept;
//! Constant accessor to the inlet pressure parameter.
const Parameter<ParameterNS::Type::vector, ParameterNS::TimeDependencyNS::None>& GetInletPressure() const noexcept;
//! Constant accessor to the numbering subset associated to fluid velocity.
const NumberingSubset& GetFluidVelocityNumberingSubset() const noexcept;
/*!
* \brief Constant accessor to the matrix into which mass operator is assembled (\todo #820 See if
* really required...).
*/
const GlobalMatrix& GetMassMatrix() const noexcept;
/*!
* \brief Non constant accessor to the matrix into which mass operator is assembled (\todo #820 See if
* really required...).
*/
GlobalMatrix& GetNonCstMassMatrix() noexcept;
///@}
......@@ -174,6 +195,9 @@ namespace HappyHeart
//! Inlet pressure (acts as a source).
GlobalVariationalOperatorNS::TransientSource<>::const_unique_ptr inlet_pressure_source_operator_ = nullptr;
//! Mass operator for fluid velocity.
GlobalVariationalOperatorNS::Mass::const_unique_ptr mass_operator_ = nullptr;
///@}
private:
......@@ -181,6 +205,10 @@ namespace HappyHeart
/// \name Global vectors and matrices specific to the problem.
///@{
//! Matrix into which mass operator is assembled (\todo #820 See if really required...).
GlobalMatrix::unique_ptr mass_matrix_ = nullptr;
///@}
......
......@@ -69,6 +69,28 @@ namespace HappyHeart
return fluid_velocity_numbering_subset_;
}
inline const GlobalVariationalOperatorNS::Mass& VariationalFormulation::GetMassOperator() const noexcept
{
assert(!(!mass_operator_));
return *mass_operator_;
}
inline const GlobalMatrix& VariationalFormulation::GetMassMatrix() const noexcept
{
assert(!(!mass_matrix_));
return *mass_matrix_;
}
inline GlobalMatrix& VariationalFormulation::GetNonCstMassMatrix() noexcept
{
return const_cast<GlobalMatrix&>(GetMassMatrix());
}
} // namespace ImplicitStepFluidNS
......
Markdown is supported
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