Commit 8cf30352 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1022 Remove Mesh template parameter in FLuidmass::GetDifferenceAsParam()....

#1022 Remove Mesh template parameter in FLuidmass::GetDifferenceAsParam(). Start introducing the possibility to compute current - former rather than new - current.
parent 4ee6c235
......@@ -283,13 +283,9 @@ namespace HappyHeart
/*!
* \brief Get the relevant difference given time label and mesh considered.
* \brief Get the relevant difference given time label; mesh is alwasy solid one here.
*
*/
template
<
MeshIndex MeshIndexT
>
const ParameterAtDof<ParameterNS::Type::scalar>& GetDifferenceAsParam(DataNS::TimeLabel time_label) const noexcept;
......
......@@ -217,42 +217,20 @@ namespace HappyHeart
}
template
<
MeshIndex MeshIndexT
>
const ParameterAtDof<ParameterNS::Type::scalar>& Fluidmass
inline const ParameterAtDof<ParameterNS::Type::scalar>& Fluidmass
::GetDifferenceAsParam(const DataNS::TimeLabel time_label) const noexcept
{
switch(MeshIndexT)
switch(time_label)
{
case MeshIndex::solid:
{
switch(time_label)
{
case DataNS::TimeLabel::new_value:
return GetNewMinusCurrentOnSolidAsParam();
case DataNS::TimeLabel::current:
return GetCurrentMinusFormerOnSolidAsParam();
case DataNS::TimeLabel::former:
assert(false && "Wouldn't make sense ('new_value' gives val{n+1} - val{n} and 'current'val{n} - val{n - 1}).");
exit(EXIT_FAILURE);
}
}
case MeshIndex::fluid:
{
switch(time_label)
{
case DataNS::TimeLabel::new_value:
return GetNewMinusCurrentOnFluidAsParam();
case DataNS::TimeLabel::current:
return GetCurrentMinusFormerOnFluidAsParam();
case DataNS::TimeLabel::former:
assert(false && "Wouldn't make sense ('new_value' gives val{n+1} - val{n} and 'current'val{n} - val{n - 1}).");
exit(EXIT_FAILURE);
}
}
} // switch(MeshIndexT)
case DataNS::TimeLabel::new_value:
return GetNewMinusCurrentOnSolidAsParam();
case DataNS::TimeLabel::current:
return GetCurrentMinusFormerOnSolidAsParam();
case DataNS::TimeLabel::former:
assert(false && "Wouldn't make sense ('new_value' gives val{n+1} - val{n} and 'current'val{n} - val{n - 1}).");
exit(EXIT_FAILURE);
}
assert(false);
exit(EXIT_FAILURE);
}
......
......@@ -86,9 +86,22 @@ namespace HappyHeart
decltype(auto) hyperelastic_law = GetHyperelasticLaw();
decltype(auto) fluid_mass_data = hyperelastic_law.GetFluidmassData();
decltype(auto) difference_fluidmass = fluid_mass_data.GetNewMinusCurrentOnSolidAsParam();
// fluid_mass_data.template GetDifferenceAsParam<MeshIndexT>(DataNS::TimeLabel::new_value);
decltype(auto) difference_fluidmass = fluid_mass_data.template GetDifferenceAsParam(DataNS::TimeLabel::new_value);
static_assert(TimeLabelT != DataNS::TimeLabel::former,
"Wouldn't make sense ('new_value' gives val{n+1} - val{n} and 'current'val{n} - val{n - 1}).");
constexpr auto most_recent_time_label =
TimeLabelT == DataNS::TimeLabel::new_value
? DataNS::TimeLabel::new_value
: DataNS::TimeLabel::current;
constexpr auto oldest_time_label =
TimeLabelT == DataNS::TimeLabel::new_value
? DataNS::TimeLabel::current
: DataNS::TimeLabel::former;
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
decltype(auto) quad_pt = infos_at_quad_pt.GetQuadraturePoint();
......@@ -106,22 +119,23 @@ namespace HappyHeart
new_value = 0.5
* (hyperelastic_law.FirstDerivativeWFluidMass(invariant_holder,
quad_pt,
geom_elt)
geom_elt,
most_recent_time_label)
+ hyperelastic_law.FirstDerivativeWFluidMass(invariant_holder,
quad_pt,
geom_elt,
DataNS::TimeLabel::current));
oldest_time_label));
}
else
{
new_value = (hyperelastic_law.Wbulk(invariant_holder,
quad_pt,
geom_elt,
DataNS::TimeLabel::new_value)
most_recent_time_label)
- hyperelastic_law.Wbulk(invariant_holder,
quad_pt,
geom_elt,
DataNS::TimeLabel::current));
oldest_time_label));
new_value /= diff_value;
}
......
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