Commit 7258c849 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#723 FSi/Newton: expand a bit interface of implicit fluid formulation, to be...

#723 FSi/Newton: expand a bit interface of implicit fluid formulation, to be able to reuse it for its differential computation.
parent 302e85a3
......@@ -7494,8 +7494,8 @@
BEBEBC1C1BDFB4F10011D835 /* main_newton.cpp */,
BEBEBC1D1BDFB4F10011D835 /* Model.hpp */,
BEBEBC1E1BDFB4F10011D835 /* Model.hxx */,
BEBEBC1F1BDFB4F10011D835 /* ModelAccessors.hxx */,
BEBEBC201BDFB4F10011D835 /* ModelForward.hxx */,
BEBEBC1F1BDFB4F10011D835 /* ModelAccessors.hxx */,
);
name = Newton;
sourceTree = "<group>";
......
......@@ -147,7 +147,7 @@ namespace HappyHeart
}
void ImplicitStepFluidVariationalFormulation::DefineFormulation()
void ImplicitStepFluidVariationalFormulation::DefineFormulation(differential is_differential)
{
const auto& numbering_subset = GetNumberingSubset();
......@@ -177,26 +177,35 @@ namespace HappyHeart
GetScalarDivVectorialOperator().Assemble(std::make_tuple(std::ref(matrix)));
}
switch (is_differential)
{
const auto& interpolation_matrix = GetTowardVelocityPressureInterpolator().GetInterpolationMatrix();
auto& explicit_step_fluid_velocity = GetNonCstExplicitStepFluidVelocity();
Wrappers::Petsc::MatMult(interpolation_matrix,
explicit_variational_formulation.GetSystemSolution(explicit_variational_formulation.GetNumberingSubset()),
explicit_step_fluid_velocity,
__FILE__, __LINE__);
Wrappers::Petsc::MatMult(mass_fluid_velocity, explicit_step_fluid_velocity, rhs, __FILE__, __LINE__);
case differential::yes:
break;
case differential::no:
{
{
const auto& interpolation_matrix = GetTowardVelocityPressureInterpolator().GetInterpolationMatrix();
auto& explicit_step_fluid_velocity = GetNonCstExplicitStepFluidVelocity();
Wrappers::Petsc::MatMult(interpolation_matrix,
explicit_variational_formulation.GetSystemSolution(explicit_variational_formulation.GetNumberingSubset()),
explicit_step_fluid_velocity,
__FILE__, __LINE__);
Wrappers::Petsc::MatMult(mass_fluid_velocity, explicit_step_fluid_velocity, rhs, __FILE__, __LINE__);
}
{
const auto time = GetTimeManager().GetTime();
GlobalVectorWithCoefficient vector(rhs, 1.);
GetInletPressureOperator().Assemble(std::make_tuple(std::ref(vector)), time);
}
}
}
{
const auto time = GetTimeManager().GetTime();
GlobalVectorWithCoefficient vector(rhs, 1.);
GetInletPressureOperator().Assemble(std::make_tuple(std::ref(vector)), time);
}
SetResidualLinearAlgebra();
......
......@@ -48,6 +48,9 @@ namespace HappyHeart
namespace FSI_EINS
{
enum class differential { no, yes };
class ImplicitStepFluidVariationalFormulation
......@@ -105,7 +108,7 @@ namespace HappyHeart
const NumberingSubset& GetNumberingSubset() const noexcept;
//! Assemble the matrix and the vector.
void DefineFormulation();
void DefineFormulation(differential is_differential);
//! Compute the residual after the resolution of the system and return it.
......
......@@ -154,7 +154,7 @@ namespace HappyHeart
void ExplicitFluidStep(const std::string& output_dir);
//! Implicit fluid step.
void ImplicitFluidStep();
void ImplicitFluidStep(differential is_differential);
//! Update fluid Dirichlet condition.
void UpdateFluidDirichletCondition();
......
......@@ -38,7 +38,7 @@ namespace HappyHeart
UpdateFluidDirichletCondition();
ImplicitFluidStep();
ImplicitFluidStep(differential::no);
ComputeSolidResidual();
......@@ -149,7 +149,7 @@ namespace HappyHeart
template<class SolidVariationalFormulationPolicyT>
void Model<SolidVariationalFormulationPolicyT>::ImplicitFluidStep()
void Model<SolidVariationalFormulationPolicyT>::ImplicitFluidStep(differential is_differential)
{
const auto& mpi = parent::MpiHappyHeart();
const auto& time_manager = parent::GetTimeManager();
......@@ -168,7 +168,7 @@ namespace HappyHeart
if (mpi.IsRootProcessor())
std::cout << "Numbering = " << numbering_subset.GetUniqueId() << std::endl;
implicit_step_fluid_formulation.DefineFormulation();
implicit_step_fluid_formulation.DefineFormulation(is_differential);
implicit_step_fluid_formulation.template ApplyEssentialBoundaryCondition<OperatorNS::Nature::nonlinear>(numbering_subset,
numbering_subset);
......
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