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

#820 Poromechanics: add previous fluid velocity in Model and Explicit step varf.

parent ab823523
......@@ -31,6 +31,7 @@ namespace HappyHeart
const ScalarParameter& fluid_density,
const ScalarParameter& fluid_viscosity,
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list,
const GlobalVector& fluid_velocity_previous_time_iteration,
const Private::SolidOnFluidMesh& solid_on_fluid_mesh)
: parent(mpi,
time_manager,
......@@ -41,6 +42,7 @@ namespace HappyHeart
fluid_density_(fluid_density),
fluid_viscosity_(fluid_viscosity),
numbering_subset_(numbering_subset),
fluid_velocity_previous_time_iteration_(fluid_velocity_previous_time_iteration),
solid_on_fluid_mesh_(solid_on_fluid_mesh)
{ }
......@@ -138,11 +140,9 @@ namespace HappyHeart
{
GlobalMatrixWithCoefficient with_coeff_matrix(system_matrix, 1.);
// auto& modified_velocity_previous_iteration = GetNonCstModifiedPreviousFluidVelocity();
// modified_velocity_previous_iteration.Copy(GetPreviousFluidVelocity(),
// __FILE__, __LINE__);
//
// const auto& time_manager = GetTimeManager();
decltype(auto) velocity_previous_time_iteration = GetFluidVelocityPreviousTimeIteration();
const auto& time_manager = GetTimeManager();
//
// Wrappers::Petsc::AXPY(-1. / time_manager.GetTimeStep(),
// GetAleDisplacement(),
......
......@@ -94,6 +94,7 @@ namespace HappyHeart
/*!
* \brief Constructor.
*
* \param[in] fluid_velocity_previous_time_iteration Velocity of the fluid in the previous time iteration.
* \param[in] solid_on_fluid_mesh Object which keeps track on solid displacement and velocity on fluid mesh.
*/
explicit ExplicitStepVariationalFormulation(const Wrappers::Mpi& mpi,
......@@ -105,6 +106,7 @@ namespace HappyHeart
const ScalarParameter& fluid_density,
const ScalarParameter& fluid_viscosity,
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list,
const GlobalVector& fluid_velocity_previous_time_iteration,
const Private::SolidOnFluidMesh& solid_on_fluid_mesh);
//! Destructor.
......@@ -234,6 +236,9 @@ namespace HappyHeart
//! Constant accessor to the object which keeps track on solid displacement and velocity on fluid mesh.
const Private::SolidOnFluidMesh& GetSolidOnFluidMesh() const noexcept;
//! Constant accessor to the velocity of the fluid in the previous time iteration.
const GlobalVector& GetFluidVelocityPreviousTimeIteration() const noexcept;
///@}
......@@ -297,6 +302,9 @@ namespace HappyHeart
///@}
//! Velocity of the fluid in the previous time iteration.
const GlobalVector& fluid_velocity_previous_time_iteration_;
//! Object which keeps track on solid displacement and velocity on fluid mesh.
const Private::SolidOnFluidMesh& solid_on_fluid_mesh_;
......
......@@ -133,6 +133,12 @@ namespace HappyHeart
return solid_on_fluid_mesh_;
}
inline const GlobalVector& ExplicitStepVariationalFormulation
::GetFluidVelocityPreviousTimeIteration() const noexcept
{
return fluid_velocity_previous_time_iteration_;
}
......
......@@ -216,6 +216,11 @@ namespace HappyHeart
//! Non constant accessor to the object which keeps track on solid displacement and velocity on fluid mesh.
Private::SolidOnFluidMesh& GetNonCstSolidOnFluidMesh() noexcept;
//! Constant accessor to the velocity of the fluid in the previous time iteration.
const GlobalVector& GetFluidVelocityPreviousTimeIteration() const noexcept;
//! Non constant accessor to the velocity of the fluid in the previous time iteration.
GlobalVector& GetNonCstFluidVelocityPreviousTimeIteration() noexcept;
///@}
......@@ -320,6 +325,9 @@ namespace HappyHeart
//! Computed solid displacement.
GlobalVector::unique_ptr solid_displacement_ = nullptr;
//! Velocity of the fluid in the previous time iteration.
GlobalVector::unique_ptr fluid_velocity_previous_time_iteration_ = nullptr;
};
......
......@@ -55,9 +55,6 @@ namespace HappyHeart
template<class SolidVariationalFormulationPolicyT>
void Model<SolidVariationalFormulationPolicyT>::UpdateSolidDisplacement()
{
auto& solid_disp = GetNonCstSolidDisplacement();
// \todo #820 Update solid displacement from what has been computed by the dedicated varf!
auto& solid_on_fluid_mesh = GetNonCstSolidOnFluidMesh();
......
......@@ -187,6 +187,21 @@ namespace HappyHeart
{
return const_cast<Private::SolidOnFluidMesh&>(GetSolidOnFluidMesh());
}
template<class SolidVariationalFormulationPolicyT>
inline const GlobalVector& Model<SolidVariationalFormulationPolicyT>::GetFluidVelocityPreviousTimeIteration() const noexcept
{
assert(!(!fluid_velocity_previous_time_iteration_));
return *fluid_velocity_previous_time_iteration_;
}
template<class SolidVariationalFormulationPolicyT>
inline GlobalVector& Model<SolidVariationalFormulationPolicyT>::GetNonCstFluidVelocityPreviousTimeIteration() noexcept
{
return const_cast<GlobalVector&>(GetFluidVelocityPreviousTimeIteration());
}
} // namespace PoromechanicsNS
......
......@@ -57,6 +57,16 @@ namespace HappyHeart
decltype(auto) unknown_manager = UnknownManager::GetInstance();
decltype(auto) time_manager = parent::GetTimeManager();
{
decltype(auto) numbering_subset =
god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_velocity));
fluid_velocity_previous_time_iteration_
= std::make_unique<GlobalVector>(numbering_subset);
::HappyHeart::AllocateGlobalVector(god_of_dof, GetNonCstFluidVelocityPreviousTimeIteration());
}
{
decltype(auto) solid_god_of_dof = parent::GetGodOfDof(EnumUnderlyingType(MeshIndex::solid));
decltype(auto) numbering_subset =
......@@ -213,6 +223,7 @@ namespace HappyHeart
fluid_density,
fluid_viscosity,
std::move(bc_list),
GetFluidVelocityPreviousTimeIteration(),
GetSolidOnFluidMesh());
explicit_step_varf_->Init(input_parameter_data);
......
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