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

#780 FSI: introduce FEltSpace, numbering subset and unknown for the ALE variational formulation.

parent ec2019a1
......@@ -114,6 +114,26 @@ NumberingSubset9 = {
} -- NumberingSubset9
NumberingSubset10 = {
-- Name of the numbering subset (not really used; at the moment I just need one input parameter to ground
-- the possible values to choose elsewhere).
-- Expected format: "VALUE"
name = "fluid_displacement"
} -- NumberingSubset10
NumberingSubset11 = {
-- Name of the numbering subset (not really used; at the moment I just need one input parameter to ground
-- the possible values to choose elsewhere).
-- Expected format: "VALUE"
name = "fluid_displacement_on_interface"
} -- NumberingSubset11
-- Unknown1
Unknown1 = {
-- Name of the unknown (used for displays in output).
......@@ -163,6 +183,19 @@ Unknown4 = {
nature = "vectorial"
}
-- Unknown5
Unknown5 = {
-- Name of the unknown (used for displays in output).
-- Expected format: "VALUE"
name = "fluid_displacement",
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {'scalar', 'vectorial'})
nature = "vectorial"
}
-- EssentialBoundaryCondition 10 : foir the fluid on the no robin interface. This condition is modified afterwards
-- at each time step.
......@@ -232,7 +265,7 @@ EssentialBoundaryCondition12 = {
-- Name of the unknown addressed by the boundary condition.
-- Expected format: "VALUE"
unknown = 'fluid_velocity',
unknown = 'fluid_displacement',
-- Values at each of the relevant component.
-- Expected format: {VALUE1, VALUE2, ...}
......@@ -259,7 +292,7 @@ EssentialBoundaryCondition13 = {
-- Name of the unknown addressed by the boundary condition.
-- Expected format: "VALUE"
unknown = 'fluid_velocity',
unknown = 'fluid_displacement',
-- Values at each of the relevant component.
-- Expected format: {VALUE1, VALUE2, ...}
......@@ -272,8 +305,7 @@ EssentialBoundaryCondition13 = {
} -- EssentialBoundaryCondition13
-- EssentialBoundaryCondition 14: nullify velocity on fluid axis domain.
-- Different from BC 11 which nullifies only the first component.
-- EssentialBoundaryCondition 14: nullify displacement on fluid axis domain.
EssentialBoundaryCondition14 = {
-- Name of the boundary condition (must be unique).
......@@ -287,7 +319,7 @@ EssentialBoundaryCondition14 = {
-- Name of the unknown addressed by the boundary condition.
-- Expected format: "VALUE"
unknown = 'fluid_velocity',
unknown = 'fluid_displacement',
-- Values at each of the relevant component.
-- Expected format: {VALUE1, VALUE2, ...}
......@@ -314,7 +346,7 @@ EssentialBoundaryCondition15 = {
-- Name of the unknown addressed by the boundary condition.
-- Expected format: "VALUE"
unknown = 'fluid_velocity',
unknown = 'fluid_displacement',
-- Values at each of the relevant component.
-- Expected format: {VALUE1, VALUE2, ...}
......@@ -862,6 +894,57 @@ FiniteElementSpace7 = {
}
-- FiniteElementSpace8 -- Fluid displacement (for ALE).
FiniteElementSpace8 = {
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: VALUE
god_of_dof_index = 1,
-- Index of the domain onto which the finite element space is defined. This domain must be unidimensional.
-- Expected format: VALUE
domain_index = 10,
-- List of all unknowns defined in the finite element space. Unknowns here must be defined in this file as
-- an 'Unknown' block; expected name/identifier is the name given there.
-- Expected format: {"VALUE1", "VALUE2", ...}
unknown_list = { 'fluid_displacement' },
-- List of the shape function to use for each unknown;
-- Expected format: {"VALUE1", "VALUE2", ...}
-- shape_function_list = { 'P2', 'P1', 'P1' },
shape_function_list = { 'P1' },
-- List of the numbering subset to use for each unknown;
-- Expected format: {VALUE1, VALUE2, ...}
numbering_subset_list = { 10 }
}
-- FiniteElementSpace9 -- Fluid displacement on interface (for ALE).
FiniteElementSpace9 = {
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: VALUE
god_of_dof_index = 1,
-- Index of the domain onto which the finite element space is defined. This domain must be unidimensional.
-- Expected format: VALUE
domain_index = 11,
-- List of all unknowns defined in the finite element space. Unknowns here must be defined in this file as
-- an 'Unknown' block; expected name/identifier is the name given there.
-- Expected format: {"VALUE1", "VALUE2", ...}
unknown_list = { 'fluid_displacement' },
-- List of the shape function to use for each unknown;
-- Expected format: {"VALUE1", "VALUE2", ...}
-- shape_function_list = { 'P2', 'P1', 'P1' },
shape_function_list = { 'P1' },
-- List of the numbering subset to use for each unknown;
-- Expected format: {VALUE1, VALUE2, ...}
numbering_subset_list = { 11 }
}
-- Solid
InitVertexMatchingInterpolator1 = {
......
......@@ -55,7 +55,8 @@ namespace HappyHeart
* This class is still relatively close to its counterpart in Felisce; a move heavy refactoring is not excluded at all.
*
*/
class DirichletBoundaryCondition final : public Crtp::UniqueId<DirichletBoundaryCondition, UniqueIdNS::AssignationMode::manual>
class DirichletBoundaryCondition final
: public Crtp::UniqueId<DirichletBoundaryCondition, UniqueIdNS::AssignationMode::manual>
{
public:
......
......@@ -41,7 +41,6 @@ namespace HappyHeart
void BoundaryConditionDofStorage::UpdateValueList(std::vector<PetscScalar>&& new_values)
{
std::cout << "SIZS -> " << new_values.size() << '\t' << dof_value_list_.size() << std::endl;
assert(new_values.size() == dof_value_list_.size());
std::swap(dof_value_list_, new_values);
}
......
......@@ -121,9 +121,6 @@ namespace HappyHeart
private:
//! Get the list of all dof program-wise index (within the numbering subset for which current class exists).
std::vector<PetscInt>& GetNonCstDofIndexList() noexcept;
//! Get the list of all dof values.
std::vector<PetscScalar>& GetNonCstDofValueList() noexcept;
......
......@@ -38,19 +38,12 @@ namespace HappyHeart
}
inline std::vector<PetscInt>& BoundaryConditionDofStorage::GetNonCstDofIndexList() noexcept
{
return const_cast<std::vector<PetscInt>&>(GetDofIndexList());
}
inline std::vector<PetscScalar>& BoundaryConditionDofStorage::GetNonCstDofValueList() noexcept
{
return const_cast<std::vector<PetscScalar>&>(GetDofValueList());
}
} // namespace Private
......
......@@ -657,13 +657,16 @@ namespace HappyHeart
}
// Fill appropriately the storage of dofs related to the pair boundary condition/numbering subset.
if (!relevant_dof_list.empty())
const bool is_not_empty = !(relevant_dof_list.empty());
if (is_not_empty)
{
boundary_condition.SetDofListForNumberingSubset(numbering_subset,
std::move(relevant_dof_list));
}
// Inform the other processors of whether there is a boundary condition or not, and take note
// of theirs sending of the same information.
if (mpi.AllReduce(relevant_dof_list.empty(), Wrappers::MpiNS::Op::Sum))
if (mpi.AllReduce(is_not_empty, Wrappers::MpiNS::Op::LogicalOr))
boundary_condition.ConsiderNumberingSubset(numbering_subset);
}
......@@ -672,8 +675,8 @@ namespace HappyHeart
Utilities::EliminateDuplicate(complete_dof_list);
if (complete_dof_list.size() != Nbc_dof_in_numbering_subset)
std::cout << "[WARNING] Two different boundary conditions deal with the same dof in the same "
"numbering subset!" << std::endl;
std::cout << "[WARNING] At least two different boundary conditions deal with the same dof in the same "
"numbering subset (namely " << numbering_subset.GetUniqueId() << ")! " << std::endl;
}
......
......@@ -64,7 +64,9 @@ namespace HappyHeart
fluid_velocity_pressure = 4,
inlet_border = 5,
fluid_pressure = 6, // For dev purposes only
fsi_solid = 7
fsi_solid = 7,
fluid_displacement = 8, // For ALE.
fluid_displacement_on_interface = 9 // For ALE.
};
......@@ -73,7 +75,9 @@ namespace HappyHeart
fluid_velocity = 1,
fluid_pressure = 2,
solid_displacement = 3,
solid_velocity = 4
solid_velocity = 4,
fluid_displacement = 5
};
......@@ -87,14 +91,16 @@ namespace HappyHeart
enum class NumberingSubsetIndex
{
monolithic = 1,
fluid = 2,
fluid_velocity = 2,
fluid_velocity_pressure = 3,
solid_displacement = 4,
solid_velocity = 5,
fluid_on_interface = 6,
solid_velocity_on_interface = 7,
solid_displacement_on_interface = 8,
fluid_pressure = 9
fluid_pressure = 9,
fluid_displacement = 10, // for ALE variational formulation.
fluid_displacement_on_interface = 11, // for ALE variational formulation.
};
......@@ -128,7 +134,7 @@ namespace HappyHeart
InputParameter::TimeManager,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::monolithic)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::fluid)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::fluid_velocity)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::fluid_velocity_pressure)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::solid_displacement)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::solid_velocity)>,
......@@ -136,12 +142,15 @@ namespace HappyHeart
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::solid_velocity_on_interface)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::solid_displacement_on_interface)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::fluid_pressure)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::fluid_displacement)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::fluid_displacement_on_interface)>,
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::fluid_velocity)>,
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::fluid_pressure)>,
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::solid_displacement)>,
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::solid_velocity)>,
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::fluid_displacement)>,
InputParameter::DirichletBoundaryCondition<EnumUnderlyingType(BoundaryConditionIndex::fluid_no_robin_interface)>,
InputParameter::DirichletBoundaryCondition<EnumUnderlyingType(BoundaryConditionIndex::fluid_vertical_axis)>,
InputParameter::DirichletBoundaryCondition<EnumUnderlyingType(BoundaryConditionIndex::solid)>,
......@@ -171,6 +180,8 @@ namespace HappyHeart
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::inlet_border)>,
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::fluid_pressure)>,
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::fsi_solid)>,
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::fluid_displacement)>,
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::fluid_displacement_on_interface)>,
InputParameter::InitVertexMatchingInterpolator<EnumUnderlyingType(InitVertexMatchingInterpolator::solid)>,
InputParameter::InitVertexMatchingInterpolator<EnumUnderlyingType(InitVertexMatchingInterpolator::fluid)>,
......
......@@ -245,6 +245,7 @@ namespace HappyHeart
displacement_prev_time_it,
displacement_prev_time_it_on_interface,
displacement_on_interface,
moved_displacement_on_interface,
H0,
work_var_full_numbering_subset,
work_var_full_numbering_subset_2,
......@@ -262,6 +263,7 @@ namespace HappyHeart
vel_last_implicit_solution,
work_velocity,
work_pressure,
displacement_from_moved_solid,
Nvector
};
......
......@@ -46,7 +46,7 @@ namespace HappyHeart
{
const auto& numbering_subset =
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid));
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_velocity));
auto&& bc_list =
{
......@@ -138,13 +138,25 @@ namespace HappyHeart
GetNonCstVectorPtr<Solid::residual>() = std::make_unique<GlobalVector>(displacement);
GetNonCstVectorPtr<Solid::delta_displacement>() = std::make_unique<GlobalVector>(displacement);
GetNonCstVectorPtr<Solid::displacement_on_interface>() = std::make_unique<GlobalVector>(solid_numbering_subset_on_interface);
HappyHeart::AllocateGlobalVector(solid_god_of_dof, GetNonCstVector<Solid::displacement_on_interface>() );
const auto& displacement_on_interface = GetVector<Solid::displacement_on_interface>();
GetNonCstVectorPtr<Solid::displacement_prev_time_it_on_interface>() = std::make_unique<GlobalVector>(displacement_on_interface);
GetNonCstVectorPtr<Solid::work_var_interface_numbering_subset>() = std::make_unique<GlobalVector>(displacement_on_interface);
GetNonCstVectorPtr<Fluid::velFromSr_on_interface>() = std::make_unique<GlobalVector>(displacement_on_interface);
GetNonCstVectorPtr<Solid::moved_displacement_on_interface>() = std::make_unique<GlobalVector>(displacement_on_interface);
{
const auto& fluid_disp_numbering_subset =
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_displacement_on_interface));
auto& vector = GetNonCstVectorPtr<Fluid::displacement_from_moved_solid>();
vector = std::make_unique<GlobalVector>(fluid_disp_numbering_subset);
HappyHeart::AllocateGlobalVector(fluid_god_of_dof, *vector);
}
{
const auto& fsi_fluid_numbering_subset =
......@@ -157,7 +169,7 @@ namespace HappyHeart
{
// \todo For dev purposes only!
GetNonCstVectorPtr<Fluid::work_velocity>() = std::make_unique<GlobalVector>(Private::NumberingSubsetManager::GetInstance().GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid)));
GetNonCstVectorPtr<Fluid::work_velocity>() = std::make_unique<GlobalVector>(Private::NumberingSubsetManager::GetInstance().GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_velocity)));
HappyHeart::AllocateGlobalVector(fluid_god_of_dof, GetNonCstVector<Fluid::work_velocity>());
GetNonCstVectorPtr<Fluid::work_pressure>() = std::make_unique<GlobalVector>(Private::NumberingSubsetManager::GetInstance().GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_pressure)));
......@@ -170,7 +182,7 @@ namespace HappyHeart
{
const auto& numbering_subset =
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid));
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_displacement));
auto&& bc_list =
{
......@@ -180,22 +192,20 @@ namespace HappyHeart
bc_manager.GetDirichletBoundaryConditionPtr(EnumUnderlyingType(BoundaryConditionIndex::fluid_ale_on_interface))
};
const auto& felt_space = fluid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::fluid));
const auto& felt_space = fluid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::fluid_displacement));
// \todo #780 Trick here; see if it remains that way or not (if so extensive comment is really required...).
// No should not: a call to WriteSOlution() would lead to an overwriting of genuine velocity outputs...
const auto& fluid_displacement =
UnknownManager::GetInstance().GetUnknown(EnumUnderlyingType(UnknownIndex::fluid_velocity));
UnknownManager::GetInstance().GetUnknown(EnumUnderlyingType(UnknownIndex::fluid_displacement));
ale_variational_formulation_ =
std::make_unique<AleElasticVariationalFormulation>(mpi,
felt_space,
fluid_displacement,
numbering_subset,
time_manager,
fluid_god_of_dof,
this->GetVector<Solid::delta_displacement>(),
std::move(bc_list));
std::make_unique<AleElasticVariationalFormulation>(mpi,
felt_space,
fluid_displacement,
numbering_subset,
time_manager,
fluid_god_of_dof,
this->GetVector<Fluid::displacement_from_moved_solid>(),
std::move(bc_list));
auto& formulation = this->GetNonCstAleElasticVariationalFormulation();
formulation.Init(input_parameter_data);
......@@ -234,7 +244,7 @@ namespace HappyHeart
solid_2_fsi.Init();
const auto& fluid_felt_space = fluid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::fluid));
const auto& fluid_numbering_subset = fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid));
const auto& fluid_numbering_subset = fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_velocity));
const auto& fluid_on_interface_numbering_subset =
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_on_interface));
......
......@@ -342,15 +342,25 @@ namespace HappyHeart
auto& variational_formulation = GetNonCstAleElasticVariationalFormulation();
const auto& numbering_subset = variational_formulation.GetNumberingSubset();
variational_formulation.UpdateEssentialBoundaryCondition();
auto& bc_vector = this->GetNonCstVector<Fluid::displacement_from_moved_solid>();
bc_vector.Copy(this->GetVector<Solid::moved_displacement_on_interface>(), __FILE__, __LINE__);
variational_formulation.UpdateEssentialBoundaryCondition();
variational_formulation.template ApplyEssentialBoundaryCondition<OperatorNS::Nature::nonlinear>(numbering_subset,
numbering_subset);
numbering_subset);
variational_formulation.template SolveLinear<IsFactorized::no>(numbering_subset, numbering_subset);
{
const auto& vector = variational_formulation.GetSystemSolution(numbering_subset);
const PetscReal min = vector.Min(__FILE__, __LINE__).second;
const PetscReal max = vector.Max(__FILE__, __LINE__).second;
std::cout << "ALE STEP -> " << min << " and " << max
<< " on " << vector.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl;
}
// \todo #780 Do not do that until fluid displacement gets its own numbering subset, to avoid overriding...
// variational_formulation.WriteSolution(time_manager, numbering_subset);
}
......
......@@ -279,7 +279,8 @@ namespace HappyHeart
void Vector::Copy(const Vector& source, const char* invoking_file, int invoking_line)
{
int error_code = VecCopy(source.Internal(), Internal());
int error_code = VecCopy(source.Internal(),
Internal());
if (error_code)
throw ExceptionNS::Exception(error_code, "VecCopy", invoking_file, invoking_line);
}
......
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