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

#723 FSI/Newton: seems to agree with Freefem's script on some quantities.

parent 1fe1d442
......@@ -21,7 +21,7 @@ transient = {
-- Maximum time, if set to zero run a case.
-- Expected format: VALUE
-- Constraint: v >= 0.
timeMax = .5,
timeMax = .15,
} -- transient
......
......@@ -6,11 +6,11 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
# include "Parameters/InitParameter.hpp"
# include "Parameters/Instances/Private/Configuration.hpp"
#include "Parameters/InitParameter.hpp"
#include "Parameters/Instances/Private/Configuration.hpp"
# include "Operators/GlobalVariationalOperator/DetermineDefaultQuadratureRule.hpp"
#include "Operators/GlobalVariationalOperator/DetermineDefaultQuadratureRule.hpp"
#include "ModelInstances/FSI_EI/ExplicitStepVariationalFormulation.hpp"
......@@ -192,7 +192,7 @@ namespace HappyHeart
const auto& mass_fluid_velocity = GetMassFluidVelocity();
const auto& previous_iteration = GetPreviousFluidVelocity();
Wrappers::Petsc::MatMult(mass_fluid_velocity, previous_iteration, residual_rhs, __FILE__, __LINE__);
auto& system_matrix = GetNonCstSystemMatrix(numbering_subset, numbering_subset);
......
......@@ -300,21 +300,7 @@ namespace HappyHeart
__FILE__, __LINE__);
}
{
const auto& implicit_step_formulation = GetImplicitStepFluidVariationalFormulation();
const auto& implicit_solution = implicit_step_formulation.GetSystemSolution(implicit_step_formulation.GetNumberingSubset());
const auto& interpolation_matrix = implicit_step_formulation.GetTowardVelocityInterpolator().GetInterpolationMatrix();
auto& explicit_step_formulation = GetNonCstExplicitStepVariationalFormulation();
Wrappers::Petsc::MatMult(interpolation_matrix,
implicit_solution,
explicit_step_formulation.GetNonCstPreviousFluidVelocity(),
__FILE__, __LINE__);
}
{
auto& variational_formulation = SolidVariationalFormulationPolicyT::GetNonCstVariationalFormulation();
......@@ -341,13 +327,13 @@ namespace HappyHeart
std::cout << "================ AT THE END OF TIME ITERATION:\n";
std::cout << "End of time iteration:\n";
{
const auto& dispSr = GetVector<Solid::dispSr>();
const PetscReal evaluation_state_min = dispSr.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = dispSr.Max(__FILE__, __LINE__).second;
std::cout << "DISPLACEMENT EXTREMA ARE " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\tdispSr -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << dispSr.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
......@@ -364,13 +350,12 @@ namespace HappyHeart
explicit_step_formulation.GetNonCstPreviousFluidVelocity(),
__FILE__, __LINE__);
std::cout << "================ AT THE END OF TIME ITERATION:\n";
{
const auto& dispSr = explicit_step_formulation.GetNonCstPreviousFluidVelocity();
const PetscReal evaluation_state_min = dispSr.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = dispSr.Max(__FILE__, __LINE__).second;
std::cout << "OLD VEL ARE " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\tprevVel -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << dispSr.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
......
......@@ -16,9 +16,6 @@ namespace HappyHeart
namespace FSI_EINS
{
template<class SolidVariationalFormulationPolicyT>
......@@ -46,6 +43,7 @@ namespace HappyHeart
while (absolute_error > 1.e-10 && relative_error > 1.e-6 && iteration_index < 1000u) // \todo #723 Should not remain hardcoded!
{
std::cout << "\n------------------\nCoupling iteration " << iteration_index << std::endl;
GetNonCstVector<Solid::dispSrk0>().Copy(GetVector<Solid::dispSr>(), __FILE__, __LINE__);
......@@ -73,16 +71,7 @@ namespace HappyHeart
ImplicitFluidStep(differential::no);
{
const auto& fluid_varf = GetImplicitStepFluidVariationalFormulation();
const auto& sol = fluid_varf.GetSystemSolution(fluid_varf.GetNumberingSubset());
const PetscReal evaluation_state_min = sol.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = sol.Max(__FILE__, __LINE__).second;
std::cout << "Implicit fluid solution EXTREMA ARE " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << sol.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
ComputeSolidResidual();
......@@ -107,8 +96,8 @@ namespace HappyHeart
const PetscReal evaluation_state_min = H0.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = H0.Max(__FILE__, __LINE__).second;
std::cout << "H0 EXTREMA ARE " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << H0.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
std::cout << "\t\H0 -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << H0.GetProgramWiseSize(__FILE__, __LINE__) << " elements.\n" << std::endl; // OK
}
......@@ -126,7 +115,7 @@ namespace HappyHeart
const PetscReal evaluation_state_min = dispSdelta.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = dispSdelta.Max(__FILE__, __LINE__).second;
std::cout << "AFTER GMRES EXTREMA ARE " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\tdispSdelta after Gmres -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << dispSdelta.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
......@@ -167,6 +156,15 @@ namespace HappyHeart
void Model<SolidVariationalFormulationPolicyT>::UpdateFluidDirichletCondition()
{
const auto& velFromSr_on_interface = GetVector<Fluid::velFromSr_on_interface>();
{
const PetscReal evaluation_state_min = velFromSr_on_interface.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = velFromSr_on_interface.Max(__FILE__, __LINE__).second;
std::cout << "\tDirichlet velocity -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << velFromSr_on_interface.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
auto& p2_solid_velocity_on_interface = GetNonCstVector<Fluid::p2_vel_on_interface>();
Wrappers::Petsc::MatMult(solid_to_fluid_velocity_on_fsi_interpolator_->GetInterpolationMatrix(),
......@@ -210,10 +208,6 @@ namespace HappyHeart
__FILE__, __LINE__);
velFromSr_on_interface.Copy(dispSr_on_interface, __FILE__, __LINE__);
Wrappers::Petsc::AXPY(-1., // \todo #723 NOT SURE AT ALL IF THIS PART SHOULD BE INTRODUCED here; if so UpdateFluidDirichletCondition() can be improved (take input displacement in parameters).
GetVector<Solid::dispSOldr_on_interface>(),
velFromSr_on_interface,
__FILE__, __LINE__);
const double inv_time_step = 1. / this->GetTimeManager().GetTimeStep();
velFromSr_on_interface.Scale(inv_time_step, __FILE__, __LINE__);
......@@ -274,14 +268,6 @@ namespace HappyHeart
{
const auto& mpi = parent::MpiHappyHeart();
if (mpi.IsRootProcessor())
{
std::cout << "=================\n";
std::cout << "EXPLICIT STEP" << std::endl;
std::cout << "=================\n";
}
auto& explicit_step_formulation = GetNonCstExplicitStepVariationalFormulation();
const auto& numbering_subset = explicit_step_formulation.GetNumberingSubset();
const auto& time_manager = parent::GetTimeManager();
......@@ -300,24 +286,38 @@ namespace HappyHeart
residual.template Print<MpiScale::processor_wise>(mpi, output_dir + "explicit_step_fluid_residual.hhdata",
__FILE__, __LINE__);
std::cout << "Explicit step: " << std::endl;
{
const auto& vector = explicit_step_formulation.GetPreviousFluidVelocity();
const PetscReal min = vector.Min(__FILE__, __LINE__).second;
const PetscReal max = vector.Max(__FILE__, __LINE__).second;
std::cout << "\tVelocity previous iteration = " << min << " and " << max
<< " on " << vector.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
{
const auto& dispSdelta = explicit_step_formulation.GetSystemSolution(numbering_subset);
const PetscReal evaluation_state_min = dispSdelta.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = dispSdelta.Max(__FILE__, __LINE__).second;
const auto& vector = explicit_step_formulation.GetSystemSolution(numbering_subset);
const PetscReal min = vector.Min(__FILE__, __LINE__).second;
const PetscReal max = vector.Max(__FILE__, __LINE__).second;
std::cout << "Explicit solution EXTREMA ARE " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << dispSdelta.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
std::cout << "\tSolution -> " << min << " and " << max
<< " on " << vector.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl;
}
{
const auto& dispSdelta = residual;
const PetscReal evaluation_state_min = dispSdelta.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = dispSdelta.Max(__FILE__, __LINE__).second;
const auto& vector = residual;
const PetscReal min = vector.Min(__FILE__, __LINE__).second;
const PetscReal max = vector.Max(__FILE__, __LINE__).second;
std::cout << "Explicit residual EXTREMA ARE " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << dispSdelta.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
std::cout << "\tResidual -> " << min << " and " << max
<< " on " << vector.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl;
}
std::cout << std::endl;
}
......@@ -336,6 +336,8 @@ namespace HappyHeart
// std::cout << "=================\n";
// }
std::cout << "\tImplicit fluid step: " << std::endl;
{
auto& implicit_step_fluid_formulation = this->GetNonCstImplicitStepFluidVariationalFormulation();
const auto& numbering_subset = implicit_step_fluid_formulation.GetNumberingSubset();
......@@ -358,18 +360,21 @@ namespace HappyHeart
if (is_differential == differential::no)
{
std::cout << "SIZES = " << GetNonCstVector<Fluid::vel_last_implicit_solution>().GetProgramWiseSize(__FILE__, __LINE__)
<< "\t"
<< implicit_step_fluid_formulation.GetSystemSolution(numbering_subset).GetProgramWiseSize(__FILE__, __LINE__)
<< std::endl;
GetNonCstVector<Fluid::vel_last_implicit_solution>().Copy(implicit_step_fluid_formulation.GetSystemSolution(numbering_subset),
__FILE__, __LINE__);
}
else
std::cout << "DIFFERENTIAL CASE" << std::endl;
}
{
const auto& fluid_varf = GetImplicitStepFluidVariationalFormulation();
const auto& sol = fluid_varf.GetSystemSolution(fluid_varf.GetNumberingSubset());
const PetscReal evaluation_state_min = sol.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = sol.Max(__FILE__, __LINE__).second;
std::cout << "\t\tSolution -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << sol.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
}
......@@ -399,7 +404,7 @@ namespace HappyHeart
const PetscReal evaluation_state_min = solid_residual.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = solid_residual.Max(__FILE__, __LINE__).second;
std::cout << "Solid residual EXTREMA ARE " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\n\tSolid residual -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << solid_residual.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
......@@ -420,12 +425,14 @@ namespace HappyHeart
// std::cout << "=================\n";
// }
std::cout << "\tImplicit solid step" << std::endl;
{
const auto& foo = GetVector<Solid::dispSdelta>();
const PetscReal evaluation_state_min = foo.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = foo.Max(__FILE__, __LINE__).second;
std::cout << "DISP DELTA " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\t\tdispDelta -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << foo.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
......@@ -435,7 +442,7 @@ namespace HappyHeart
const PetscReal evaluation_state_min = foo.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = foo.Max(__FILE__, __LINE__).second;
std::cout << "DISPSR " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\t\tdispR -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << foo.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
......@@ -445,7 +452,7 @@ namespace HappyHeart
const PetscReal evaluation_state_min = foo.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = foo.Max(__FILE__, __LINE__).second;
std::cout << "DISPSR_old " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\t\tdispR_old -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << foo.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
......@@ -458,7 +465,7 @@ namespace HappyHeart
const PetscReal evaluation_state_min = foo.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = foo.Max(__FILE__, __LINE__).second;
std::cout << "DISPSR_old in varf " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\t\tdispR_old in varf-> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << foo.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
......@@ -467,7 +474,7 @@ namespace HappyHeart
const PetscReal evaluation_state_min = foo.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = foo.Max(__FILE__, __LINE__).second;
std::cout << "VelS_old " << evaluation_state_min << " and " << evaluation_state_max
std::cout << "\t\tVelS_old -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << foo.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
}
......
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