Commit 79d1b077 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#723 FSI/Newton: adapt first steps of Forward.

parent 4b4b35c9
......@@ -21,7 +21,7 @@ transient = {
-- Maximum time, if set to zero run a case.
-- Expected format: VALUE
-- Constraint: v >= 0.
timeMax = 5.5e-4
timeMax = 1.5e-4
} -- transient
......@@ -1021,7 +1021,7 @@ Result = {
-- Directory in which all the results will be written.
-- Expected format: "VALUE"
output_directory = "/Volumes/Data/${USER}/HappyHeart/Results/FSI_EI"
output_directory = "/Volumes/Data/${USER}/HappyHeart/Results/FSI_EI/Newton"
} -- Result
......
......@@ -207,6 +207,13 @@ namespace HappyHeart
//! Solid displacement before SoF is applied (in Aitken loop). See Bruno's note for more details about Aitken.
GlobalVector& GetNonCstSolidDisplacementBeforeSoF() noexcept;
//! Solid displacement before SoF is applied (in Aitken loop). See Bruno's note for more details about Aitken.
const GlobalVector& GetSolidDisplacementBeforeSoFOnInterface() const noexcept;
//! Solid displacement before SoF is applied (in Aitken loop). See Bruno's note for more details about Aitken.
GlobalVector& GetNonCstSolidDisplacementBeforeSoFOnInterface() noexcept;
private:
......@@ -225,6 +232,7 @@ namespace HappyHeart
//! Solid displacement before SoF is applied (in Aitken loop). See Bruno's note for more details about Aitken.
GlobalVector::unique_ptr solid_displacement_before_SoF_ = nullptr;
GlobalVector::unique_ptr solid_displacement_before_SoF_on_interface_ = nullptr;
GlobalVector::unique_ptr solid_displacement_after_SoF_ = nullptr;
......
......@@ -117,9 +117,15 @@ namespace HappyHeart
std::make_unique<GlobalVector>(numbering_subset);
auto& solid_displacement_before_SoF = GetNonCstSolidDisplacementBeforeSoF();
HappyHeart::AllocateGlobalVector(god_of_dof, solid_displacement_before_SoF);
solid_displacement_before_SoF_on_interface_ =
std::make_unique<GlobalVector>(solid_numbering_subset_on_interface);
{
auto& solid_displacement_before_SoF_on_interface = GetNonCstSolidDisplacementBeforeSoFOnInterface();
HappyHeart::AllocateGlobalVector(god_of_dof, solid_displacement_before_SoF_on_interface);
}
solid_displacement_after_SoF_ =
std::make_unique<GlobalVector>(solid_displacement_before_SoF);
......@@ -314,10 +320,11 @@ namespace HappyHeart
template<class SolidVariationalFormulationPolicyT>
void Model<SolidVariationalFormulationPolicyT>::InterpolateSolidDisplacementToInterface(const GlobalVector& source,
GlobalVector& target,
const char* invoking_file,
int invoking_line)
void Model<SolidVariationalFormulationPolicyT>
::InterpolateSolidDisplacementToInterface(const GlobalVector& source,
GlobalVector& target,
const char* invoking_file,
int invoking_line)
{
assert(!(!solid_to_fsi_interpolator_)); // \todo #608 Waiting for the accessor...
......
......@@ -99,7 +99,20 @@ namespace HappyHeart
}
template<class SolidVariationalFormulationPolicyT>
const GlobalVector& Model<SolidVariationalFormulationPolicyT>::GetSolidDisplacementBeforeSoFOnInterface() const noexcept
{
assert(!(!solid_displacement_before_SoF_on_interface_));
return *solid_displacement_before_SoF_on_interface_;
}
template<class SolidVariationalFormulationPolicyT>
GlobalVector& Model<SolidVariationalFormulationPolicyT>::GetNonCstSolidDisplacementBeforeSoFOnInterface() noexcept
{
return const_cast<GlobalVector&>(GetSolidDisplacementBeforeSoFOnInterface());
}
} // namespace FSI_EINS
......
......@@ -34,6 +34,10 @@ namespace HappyHeart
ExplicitFluidStep(output_dir);
UpdateSolidDisplacementBeforeSoF();
UpdateFluidDirichletCondition();
// do
// {
// const std::string aitken_output_dir = output_dir + "/aitken_" + std::to_string(aitken_index) + "/";
......@@ -42,7 +46,7 @@ namespace HappyHeart
//
// mpi.Barrier();
//
// UpdateSolidDisplacementBeforeSoF(aitken_output_dir);
// (aitken_output_dir);
//
// UpdateFluidDirichletCondition(aitken_output_dir);
//
......@@ -114,23 +118,17 @@ namespace HappyHeart
auto& p2_solid_velocity_on_interface = *p2_solid_velocity_on_interface_; // \todo #608 Proper accessor!
auto& implicit_fluid_boundary_condition =
Private::DirichletBoundaryConditionManager::GetInstance().GetNonCstDirichletBoundaryCondition(EnumUnderlyingType(BoundaryConditionIndex::fluid_first));
// \todo #723 Update solid velocity!
// solid_velocity_on_interface.Copy(solid_displacement_end_of_aitken_on_interface,
// __FILE__, __LINE__);
// Wrappers::Petsc::AXPY(-1.,
// solid_displacement_previous_time_iteration_on_interface,
// solid_velocity_on_interface,
// __FILE__, __LINE__);
solid_velocity_on_interface.Copy(GetSolidDisplacementBeforeSoFOnInterface(),
__FILE__, __LINE__);
solid_velocity_on_interface.Scale(inv_time_step, __FILE__, __LINE__);
// solid_velocity_on_interface.template Print<MpiScale::processor_wise>(parent::MpiHappyHeart(),
// aitken_output_dir + "dirichlet_solid_velocity.hhdata",
// __FILE__, __LINE__);
//
Wrappers::Petsc::AXPY(-1.,
solid_displacement_previous_time_iteration_on_interface,
solid_velocity_on_interface,
__FILE__, __LINE__);
solid_velocity_on_interface.Scale(inv_time_step, __FILE__, __LINE__);
// Then interpolate it to P2 space.
Wrappers::Petsc::MatMult(p1_2_p2_interpolation_matrix,
solid_velocity_on_interface,
......@@ -232,15 +230,25 @@ namespace HappyHeart
// solid_variational_formulation.GetSystemSolution(solid_variational_formulation.GetNumberingSubset()).template
// Print<MpiScale::processor_wise>(mpi, aitken_output_dir + "implicit_step_solid_solution.hhdata", __FILE__, __LINE__);
}
template<class SolidVariationalFormulationPolicyT>
void Model<SolidVariationalFormulationPolicyT>
::UpdateSolidDisplacementBeforeSoF()
{ }
{
const auto& solid_varf = SolidVariationalFormulationPolicyT::GetVariationalFormulation();
auto& solid_disp = GetNonCstSolidDisplacementBeforeSoF();
GetNonCstSolidDisplacementBeforeSoF().Copy(solid_varf.GetSystemSolution(solid_varf.GetNumberingSubset()),
__FILE__, __LINE__);
auto& solid_disp_on_interface = GetNonCstSolidDisplacementBeforeSoFOnInterface();
InterpolateSolidDisplacementToInterface(solid_disp,
solid_disp_on_interface,
__FILE__, __LINE__);
}
template<class SolidVariationalFormulationPolicyT>
......
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