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

#718 FSI/hyperelasticity: cut references to static iteration.

parent 1cc41e96
......@@ -53,8 +53,6 @@ namespace HappyHeart
}
template
<
class LawPolicyT,
......@@ -92,21 +90,19 @@ namespace HappyHeart
auto& variational_formulation = GetNonCstVariationalFormulation();
const auto& numbering_subset = variational_formulation.GetNumberingSubset();
static bool first = true;
if (first)
{
std::cout << "IMPLICIT SOLID MATRIX = " << std::endl;
variational_formulation.GetSystemMatrix(numbering_subset, numbering_subset).View(variational_formulation.MpiHappyHeart(), "/Users/sebastien/Desktop/ImplicitSolid.m",
__FILE__, __LINE__,
PETSC_VIEWER_ASCII_MATLAB
);
first = false;
}
// static bool first = true;
//
// if (first)
// {
// std::cout << "IMPLICIT SOLID MATRIX = " << std::endl;
// variational_formulation.GetSystemMatrix(numbering_subset, numbering_subset).View(variational_formulation.MpiHappyHeart(), "/Users/sebastien/Desktop/ImplicitSolid.m",
// __FILE__, __LINE__,
// PETSC_VIEWER_ASCII_MATLAB
// );
//
// first = false;
// }
//
variational_formulation.SolveNonLinear(numbering_subset, numbering_subset);
}
......
......@@ -222,15 +222,7 @@ namespace HappyHeart
*/
void ComputeResidual();
void ComputeStaticTangent();
void ComputeStaticResidual();
void ComputeDynamicTangent();
void ComputeDynamicResidual();
//! Prepare vectors and matrices before assembling.
void PrepareMatricesAndVectorsBeforeAssembling();
......
......@@ -304,7 +304,7 @@ namespace HappyHeart
// Assemble stiffness (depends upon the time scheme; vm types is used here to call the proper
// assembling operation(s)).
HyperelasticityNS::Private::AssembleStiffness(this->GetStiffnessOperator(),
this->GetTimeManager().GetStaticOrDynamic() == StaticOrDynamic::static_,
false,
is_first_dynamic_call,
vm);
......@@ -323,123 +323,6 @@ namespace HappyHeart
const auto& numbering_subset = GetNumberingSubset();
this->GetNonCstSystemRhs(numbering_subset).ZeroEntries(__FILE__, __LINE__);
switch(this->GetTimeManager().GetStaticOrDynamic())
{
case StaticOrDynamic::static_:
ComputeStaticResidual();
break;
case StaticOrDynamic::dynamic_:
ComputeDynamicResidual();
break;
}
this->template ApplyEssentialBoundaryCondition<OperatorNS::Nature::linear>(numbering_subset,
numbering_subset);
}
template
<
class LawPolicyT,
HyperelasticityNS::TimeScheme TimeSchemeT
>
inline void VariationalFormulationHyperElasticity<LawPolicyT, TimeSchemeT>
::ComputeTangent()
{
const auto& numbering_subset = GetNumberingSubset();
this->GetNonCstSystemMatrix(numbering_subset, numbering_subset).ZeroEntries(__FILE__, __LINE__);
switch(this->GetTimeManager().GetStaticOrDynamic())
{
case StaticOrDynamic::static_:
ComputeStaticTangent();
break;
case StaticOrDynamic::dynamic_:
ComputeDynamicTangent();
break;
}
this->template ApplyEssentialBoundaryCondition<OperatorNS::Nature::bilinear>(numbering_subset,
numbering_subset);
static bool first = true;
if (first)
{
std::cout << "IMPLICIT SOLID MATRIX = " << std::endl;
this->GetSystemMatrix(numbering_subset, numbering_subset).View(this->MpiHappyHeart(), "/Users/sebastien/Desktop/ImplicitSolid.m",
__FILE__, __LINE__,
PETSC_VIEWER_ASCII_MATLAB
);
first = false;
}
}
template
<
class LawPolicyT,
HyperelasticityNS::TimeScheme TimeSchemeT
>
void VariationalFormulationHyperElasticity<LawPolicyT, TimeSchemeT>
::ComputeStaticResidual()
{
using namespace HyperelasticityNS;
const auto& numbering_subset = this->GetNumberingSubset();
auto& rhs = this->GetNonCstSystemRhs(numbering_subset);
rhs.ZeroEntries(__FILE__, __LINE__);
const auto& vectors_and_matrices = this->GetNonCstVectorsAndMatrices();
Wrappers::Petsc::AXPY(-1.,
vectors_and_matrices.GetForce(),
rhs,
__FILE__, __LINE__);
dof_source_parent::AddToRhs(rhs);
HyperelasticityNS::Private::ComputeStaticTimeSchemeResidualContribution(vectors_and_matrices, rhs);
}
template
<
class LawPolicyT,
HyperelasticityNS::TimeScheme TimeSchemeT
>
void VariationalFormulationHyperElasticity<LawPolicyT, TimeSchemeT>
::ComputeStaticTangent()
{
const auto& numbering_subset = this->GetNumberingSubset();
const auto& vectors_and_matrices = this->GetVectorsAndMatrices();
auto& system_matrix = this->GetNonCstSystemMatrix(numbering_subset, numbering_subset);
system_matrix.Copy(vectors_and_matrices.GetMatrixNewStiffness(),
__FILE__, __LINE__, SAME_NONZERO_PATTERN);
HyperelasticityNS::Private::ComputeStaticTimeSchemeTangentContribution(vectors_and_matrices, system_matrix);
}
template
<
class LawPolicyT,
HyperelasticityNS::TimeScheme TimeSchemeT
>
void VariationalFormulationHyperElasticity<LawPolicyT, TimeSchemeT>
::ComputeDynamicResidual()
{
const auto& numbering_subset = this->GetNumberingSubset();
auto& rhs = this->GetNonCstSystemRhs(numbering_subset);
auto& vectors_and_matrices = this->GetNonCstVectorsAndMatrices();
......@@ -469,6 +352,9 @@ namespace HappyHeart
HyperelasticityNS::Private::ComputeDynamicTimeSchemeResidualContribution(vectors_and_matrices, rhs);
dof_source_parent::AddToRhs(rhs);
this->template ApplyEssentialBoundaryCondition<OperatorNS::Nature::linear>(numbering_subset,
numbering_subset);
}
......@@ -477,27 +363,42 @@ namespace HappyHeart
class LawPolicyT,
HyperelasticityNS::TimeScheme TimeSchemeT
>
void VariationalFormulationHyperElasticity<LawPolicyT, TimeSchemeT>
::ComputeDynamicTangent()
inline void VariationalFormulationHyperElasticity<LawPolicyT, TimeSchemeT>
::ComputeTangent()
{
const auto& numbering_subset = this->GetNumberingSubset();
const auto& numbering_subset = GetNumberingSubset();
this->GetNonCstSystemMatrix(numbering_subset, numbering_subset).ZeroEntries(__FILE__, __LINE__);
auto& system_matrix = this->GetNonCstSystemMatrix(numbering_subset, numbering_subset);
const auto& vectors_and_matrices = this->GetVectorsAndMatrices();
// Now all elements are settled to build the system.
{
// Tangent
system_matrix.Copy(vectors_and_matrices.GetMassPerSquareTime(), __FILE__, __LINE__);
HyperelasticityNS::Private::ComputeDynamicTimeSchemeTangentContribution(vectors_and_matrices, system_matrix);
}
this->template ApplyEssentialBoundaryCondition<OperatorNS::Nature::bilinear>(numbering_subset,
numbering_subset);
static bool first = true;
if (first)
{
std::cout << "IMPLICIT SOLID MATRIX = " << std::endl;
this->GetSystemMatrix(numbering_subset, numbering_subset).View(this->MpiHappyHeart(), "/Users/sebastien/Desktop/ImplicitSolid.m",
__FILE__, __LINE__,
PETSC_VIEWER_ASCII_MATLAB
);
first = false;
}
}
template
<
class LawPolicyT,
......
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