Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MoReFEM
CoreLibrary
MoReFEM
Commits
64f58c20
Commit
64f58c20
authored
Oct 26, 2016
by
GILLES Sebastien
Browse files
#1022
Fluidmass: add former value (i.e. iteration n - 1). Rename others methods.
parent
792e3451
Changes
6
Hide whitespace changes
Inline
Side-by-side
Sources/ModelInstances/UnderDevelopment/Poromechanics/Data/Fluidmass.cpp
View file @
64f58c20
...
...
@@ -54,7 +54,9 @@ namespace HappyHeart
decltype
(
auto
)
new_value
=
from_monolithic_parent
::
GetNew
();
global_vector_temporary_solid_parent
::
InitGlobalVectorTemporary
(
new_value
);
current_value_
=
std
::
make_unique
<
GlobalVector
>
(
new_value
);
difference_on_solid_
=
std
::
make_unique
<
GlobalVector
>
(
new_value
);
former_value_
=
std
::
make_unique
<
GlobalVector
>
(
new_value
);
new_minus_current_on_solid_
=
std
::
make_unique
<
GlobalVector
>
(
new_value
);
current_minus_former_on_solid_
=
std
::
make_unique
<
GlobalVector
>
(
new_value
);
delta_on_solid_
=
std
::
make_unique
<
GlobalVector
>
(
new_value
);
}
...
...
@@ -92,16 +94,29 @@ namespace HappyHeart
fluid_mass_unknown
,
GetCurrent
());
difference_on_solid_as_param_
=
std
::
make_unique
<
scalar_at_dof_type
>
(
"New - current fluid mass"
,
solid_mesh
,
felt_space
,
fluid_mass_unknown
,
GetDifferenceOnSolid
());
former_value_as_param_
=
std
::
make_unique
<
scalar_at_dof_type
>
(
"Former fluid mass"
,
solid_mesh
,
felt_space
,
fluid_mass_unknown
,
GetFormer
());
new_minus_current_on_solid_as_param_
=
std
::
make_unique
<
scalar_at_dof_type
>
(
"New - current fluid mass"
,
solid_mesh
,
felt_space
,
fluid_mass_unknown
,
GetNewMinusCurrentOnSolid
());
current_minus_former_on_solid_as_param_
=
std
::
make_unique
<
scalar_at_dof_type
>
(
"Current - former fluid mass"
,
solid_mesh
,
felt_space
,
fluid_mass_unknown
,
GetCurrentMinusFormerOnSolid
());
decltype
(
auto
)
inlet_border_felt_space
=
solid_god_of_dof
.
GetFEltSpace
(
EnumUnderlyingType
(
FEltSpaceIndex
::
solid_inlet_border
));
=
solid_god_of_dof
.
GetFEltSpace
(
EnumUnderlyingType
(
FEltSpaceIndex
::
solid_inlet_border
));
current_value_on_inlet_border_as_param_
=
std
::
make_unique
<
scalar_at_dof_type
>
(
"Current fluid mass on inlet border"
,
...
...
@@ -123,26 +138,37 @@ namespace HappyHeart
void
Fluidmass
::
SetInitialValue
()
{
#ifndef NDEBUG
static
bool
is_first_call
=
true
;
assert
(
is_first_call
&&
"Should be called only once!"
);
is_first_call
=
false
;
#endif // NDEBUG
decltype
(
auto
)
new_value
=
GetNew
();
// this line actually update the value from monolithic vector!
GetNonCstCurrent
().
Copy
(
new_value
,
__FILE__
,
__LINE__
);
GetNonCstFormer
().
Copy
(
new_value
,
__FILE__
,
__LINE__
);
}
void
Fluidmass
::
PrepareNextTimeIteration
()
{
GetNonCstCurrent
().
Copy
(
GetNew
(),
__FILE__
,
__LINE__
);
decltype
(
auto
)
current
=
GetNonCstCurrent
();
// \todo #963 - #520 Swap!
GetNonCstFormer
().
Copy
(
current
,
__FILE__
,
__LINE__
);
current
.
Copy
(
GetNew
(),
__FILE__
,
__LINE__
);
}
const
GlobalVector
&
Fluidmass
::
GetDifferenceOnSolid
()
const
noexcept
const
GlobalVector
&
Fluidmass
::
GetNewMinusCurrentOnSolid
()
const
noexcept
{
assert
(
!
(
!
diffe
ren
ce
_on_solid_
));
assert
(
!
(
!
new_minus_cur
ren
t
_on_solid_
));
decltype
(
auto
)
new_value
=
GetNew
();
auto
&
ret
=
*
diffe
ren
ce
_on_solid_
;
auto
&
ret
=
*
new_minus_cur
ren
t
_on_solid_
;
if
(
diffe
ren
ce
_on_solid_tag_
!=
GetValueTag
())
if
(
new_minus_cur
ren
t
_on_solid_tag_
!=
GetValueTag
())
{
ret
.
Copy
(
new_value
,
__FILE__
,
__LINE__
,
update_ghost
::
no
);
...
...
@@ -151,10 +177,34 @@ namespace HappyHeart
ret
,
__FILE__
,
__LINE__
);
difference_on_solid_tag_
=
GetValueTag
();
new_minus_current_on_solid_tag_
=
GetValueTag
();
}
return
*
new_minus_current_on_solid_
;
}
const
GlobalVector
&
Fluidmass
::
GetCurrentMinusFormerOnSolid
()
const
noexcept
{
assert
(
!
(
!
current_minus_former_on_solid_
));
decltype
(
auto
)
current_value
=
GetCurrent
();
auto
&
ret
=
*
current_minus_former_on_solid_
;
if
(
current_minus_former_on_solid_tag_
!=
GetValueTag
())
{
ret
.
Copy
(
current_value
,
__FILE__
,
__LINE__
,
update_ghost
::
no
);
Wrappers
::
Petsc
::
AXPY
(
-
1.
,
GetFormer
(),
ret
,
__FILE__
,
__LINE__
);
current_minus_former_on_solid_tag_
=
GetValueTag
();
}
return
*
difference
_on_solid_
;
return
*
current_minus_former
_on_solid_
;
}
...
...
Sources/ModelInstances/UnderDevelopment/Poromechanics/Data/Fluidmass.hpp
View file @
64f58c20
...
...
@@ -120,34 +120,59 @@ namespace HappyHeart
public:
//! Constant accessor to
the current
fluid mass expressed at dofs of the solid mesh.
//! Constant accessor to fluid mass expressed at dofs of the solid mesh
from iteration {n}
.
const
GlobalVector
&
GetCurrent
()
const
noexcept
;
/*!
* \brief Non constant accessor to the current fluid mass expressed at dofs of the solid mesh.
*/
//! Non constant accessor to fluid mass expressed at dofs of the solid mesh from iteration {n}.
GlobalVector
&
GetNonCstCurrent
()
noexcept
;
//! Constant accessor to fluid mass expressed at dofs of the solid mesh from iteration {n - 1}.
const
GlobalVector
&
GetFormer
()
const
noexcept
;
//! Non constant accessor to fluid mass expressed at dofs of the solid mesh from iteration {n - 1}.
GlobalVector
&
GetNonCstFormer
()
noexcept
;
/*!
*\brief Constant accessor to the new minus current fluid mass expressed at dofs of the solid mesh.*
*
* The vector is automatically updated if need be.
*/
const
GlobalVector
&
GetDifferenceOnSolid
()
const
noexcept
;
const
GlobalVector
&
GetNewMinusCurrentOnSolid
()
const
noexcept
;
/*!
*\brief Constant accessor to the current minus former fluid mass expressed at dofs of the solid mesh.*
*
* The vector is automatically updated if need be.
*/
const
GlobalVector
&
GetCurrentMinusFormerOnSolid
()
const
noexcept
;
/*!
* \brief Same as Get
Diffe
ren
ce
OnSolid() except no value returned.
* \brief Same as Get
NewMinusCur
ren
t
OnSolid() except no value returned.
*/
void
ReevaluateDifferenceOnSolid
()
const
noexcept
;
void
ReevaluateNewMinusCurrentOnSolid
()
const
noexcept
;
/*!
* \brief Same as GetCurrentMinusFormerOnSolid() except no value returned.
*/
void
ReevaluateCurrentMinusFormerOnSolid
()
const
noexcept
;
//! Access to new fluid mass parameter.
//! Access to new fluid mass parameter
at iteration {n + 1}
.
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>&
GetNewAsParam
()
const
noexcept
;
//! Access to current fluid mass parameter.
//! Access to current fluid mass parameter
at iteration {n}
.
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>&
GetCurrentAsParam
()
const
noexcept
;
//! Access to former fluid mass parameter at iteration {n - 1}.
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>&
GetFormerAsParam
()
const
noexcept
;
//! Access to new minus current fluid mass parameter.
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>&
GetDifferenceOnSolidAsParam
()
const
noexcept
;
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>&
GetNewMinusCurrentOnSolidAsParam
()
const
noexcept
;
//! Access to current minus former fluid mass parameter.
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>&
GetCurrentMinusFormerOnSolidAsParam
()
const
noexcept
;
/*!
* \brief Parameter that encapsulates current fluid_mass_vector on the inlet border.
...
...
@@ -187,17 +212,20 @@ namespace HappyHeart
GlobalVector
&
GetNonCstDeltaOnSolid
()
noexcept
;
/*!
* \brief Accessor to projection onto fluid mesh value.
*/
//! Accessor to projection onto fluid mesh value at iteration {n}.
const
GlobalVector
&
GetCurrentOnFluid
()
const
noexcept
;
/*!
* \brief Non constant accessor to projection onto fluid mesh.
*/
//! Non constant accessor to projection onto fluid mesh value at iteration {n}.
GlobalVector
&
GetNonCstCurrentOnFluid
()
noexcept
;
//! Accessor to projection onto fluid mesh value at iteration {n - 1}.
const
GlobalVector
&
GetFormerOnFluid
()
const
noexcept
;
//! Non constant accessor to projection onto fluid mesh value at iteration {n - 1}.
GlobalVector
&
GetNonCstFormerOnFluid
()
noexcept
;
///@}
...
...
@@ -227,20 +255,34 @@ namespace HappyHeart
*/
//! Fluid mass expressed at dofs of the solid mesh.
//! Fluid mass expressed at dofs of the solid mesh
from iteration {n}
.
GlobalVector
::
unique_ptr
current_value_
=
nullptr
;
//! Fluid mass expressed at dofs of the solid mesh from iteration {n - 1}.
GlobalVector
::
unique_ptr
former_value_
=
nullptr
;
//! Difference new - current expressed at dofs of the solid mesh.
GlobalVector
::
unique_ptr
new_minus_current_on_solid_
=
nullptr
;
//! Difference current - former expressed at dofs of the solid mesh.
GlobalVector
::
unique_ptr
current_minus_former_on_solid_
=
nullptr
;
//! Difference new - current expressed at dofs of the fluid mesh.
GlobalVector
::
unique_ptr
difference_on_solid_
=
nullptr
;
/*!
* \brief Tag used to check whether the current_minus_former_on_solid_ is up-to-date.
*
* If this tag is equal to GetValueTag(); current_minus_former_on_solid_ already holds the correct value and doesn't
* need to be recomputed.
*/
mutable
unsigned
int
current_minus_former_on_solid_tag_
=
NumericNS
::
UninitializedIndex
<
unsigned
int
>
();
/*!
* \brief Tag used to check whether the
diffe
ren
ce
_on_solid_ is up-to-date.
* \brief Tag used to check whether the
new_minus_cur
ren
t
_on_solid_ is up-to-date.
*
* If this tag is equal to GetValueTag();
diffe
ren
ce
_on_solid_ already holds the correct value and doesn't
* If this tag is equal to GetValueTag();
new_minus_cur
ren
t
_on_solid_ already holds the correct value and doesn't
* need to be recomputed.
*/
mutable
unsigned
int
diffe
ren
ce
_on_solid_tag_
=
NumericNS
::
UninitializedIndex
<
unsigned
int
>
();
mutable
unsigned
int
new_minus_cur
ren
t
_on_solid_tag_
=
NumericNS
::
UninitializedIndex
<
unsigned
int
>
();
//! Delta fluid mass (for dH computation).
...
...
@@ -256,15 +298,20 @@ namespace HappyHeart
*/
///@{
//! Parameter that encapsulates new fluid_mass_vector, expressed on the solid mesh.
//! Parameter that encapsulates new fluid_mass_vector
(i.e. iteration {n + 1})
, expressed on the solid mesh.
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>::
unique_ptr
new_as_param_
=
nullptr
;
//! Parameter that encapsulates current fluid_mass_vector, expressed on the solid mesh.
//! Parameter that encapsulates current fluid_mass_vector
(i.e. iteration {n})
, expressed on the solid mesh.
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>::
unique_ptr
current_value_as_param_
=
nullptr
;
//! Parameter that encapsulates new minus current fluid_mass_vector, expressed on the fluid mesh.
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>::
unique_ptr
difference_on_solid_as_param_
=
nullptr
;
//! Parameter that encapsulates former fluid_mass_vector (i.e. iteration {n - 1}), expressed on the solid mesh.
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>::
unique_ptr
former_value_as_param_
=
nullptr
;
//! Parameter that encapsulates new minus current fluid_mass_vector, expressed on the solid mesh.
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>::
unique_ptr
new_minus_current_on_solid_as_param_
=
nullptr
;
//! Parameter that encapsulates new minus current fluid_mass_vector, expressed on the solid mesh.
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>::
unique_ptr
current_minus_former_on_solid_as_param_
=
nullptr
;
//! Parameter that encapsulates current fluid_mass_vector, expressed on the solid mesh.
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
,
ParameterNS
::
TimeDependencyNS
::
None
>::
unique_ptr
...
...
@@ -285,9 +332,12 @@ namespace HappyHeart
///@{
//! Fluid mass expressed at dofs of the fluid mesh.
//! Fluid mass expressed at dofs of the fluid mesh
for iteration {n}
.
GlobalVector
::
unique_ptr
current_value_on_fluid_
=
nullptr
;
//! Fluid mass expressed at dofs of the fluid mesh for iteration {n - 1}.
GlobalVector
::
unique_ptr
former_value_on_fluid_
=
nullptr
;
///@}
private:
...
...
Sources/ModelInstances/UnderDevelopment/Poromechanics/Data/Fluidmass.hxx
View file @
64f58c20
...
...
@@ -37,6 +37,20 @@ namespace HappyHeart
}
inline
const
GlobalVector
&
Fluidmass
::
GetFormer
()
const
noexcept
{
assert
(
!
(
!
former_value_
));
return
*
former_value_
;
}
inline
GlobalVector
&
Fluidmass
::
GetNonCstFormer
()
noexcept
{
return
const_cast
<
GlobalVector
&>
(
GetFormer
());
}
inline
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
>&
Fluidmass
::
GetNewAsParam
()
const
noexcept
{
...
...
@@ -68,12 +82,32 @@ namespace HappyHeart
inline
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
,
ParameterNS
::
TimeDependencyNS
::
None
>&
Fluidmass
::
GetDifferenceOnSolidAsParam
()
const
noexcept
::
GetFormerAsParam
()
const
noexcept
{
assert
(
!
(
!
former_value_as_param_
));
return
*
former_value_as_param_
;
}
inline
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
,
ParameterNS
::
TimeDependencyNS
::
None
>&
Fluidmass
::
GetNewMinusCurrentOnSolidAsParam
()
const
noexcept
{
Reevaluate
Diffe
ren
ce
OnSolid
();
Reevaluate
NewMinusCur
ren
t
OnSolid
();
assert
(
!
(
!
difference_on_solid_as_param_
));
return
*
difference_on_solid_as_param_
;
assert
(
!
(
!
new_minus_current_on_solid_as_param_
));
return
*
new_minus_current_on_solid_as_param_
;
}
inline
const
ParameterAtDof
<
ParameterNS
::
Type
::
scalar
,
ParameterNS
::
TimeDependencyNS
::
None
>&
Fluidmass
::
GetCurrentMinusFormerOnSolidAsParam
()
const
noexcept
{
ReevaluateCurrentMinusFormerOnSolid
();
assert
(
!
(
!
current_minus_former_on_solid_as_param_
));
return
*
current_minus_former_on_solid_as_param_
;
}
...
...
@@ -104,18 +138,38 @@ namespace HappyHeart
return
*
current_value_on_fluid_
;
}
inline
GlobalVector
&
Fluidmass
::
GetNonCstCurrentOnFluid
()
noexcept
{
return
const_cast
<
GlobalVector
&>
(
GetCurrentOnFluid
());
}
inline
void
Fluidmass
::
Reevaluate
Diffe
ren
ce
OnSolid
()
const
noexcept
inline
void
Fluidmass
::
Reevaluate
NewMinusCur
ren
t
OnSolid
()
const
noexcept
{
decltype
(
auto
)
new_value
=
Get
Diffe
ren
ce
OnSolid
();
// lazy reevaluation may occur here.
decltype
(
auto
)
new_value
=
Get
NewMinusCur
ren
t
OnSolid
();
// lazy reevaluation may occur here.
static_cast
<
void
>
(
new_value
);
}
inline
const
GlobalVector
&
Fluidmass
::
GetFormerOnFluid
()
const
noexcept
{
assert
(
!
(
!
current_value_on_fluid_
));
return
*
current_value_on_fluid_
;
}
inline
GlobalVector
&
Fluidmass
::
GetNonCstFormerOnFluid
()
noexcept
{
return
const_cast
<
GlobalVector
&>
(
GetFormerOnFluid
());
}
inline
void
Fluidmass
::
ReevaluateCurrentMinusFormerOnSolid
()
const
noexcept
{
decltype
(
auto
)
new_value
=
GetCurrentMinusFormerOnSolid
();
// lazy reevaluation may occur here.
static_cast
<
void
>
(
new_value
);
}
}
// namespace DataNS
...
...
Sources/ModelInstances/UnderDevelopment/Poromechanics/ImplicitStep/ImplicitStepFluid/LocalVariationalOperatorInstances/Darcy.hxx
View file @
64f58c20
...
...
@@ -85,7 +85,7 @@ namespace HappyHeart
decltype
(
auto
)
velocity_solution
=
GetVelocitySolution
();
decltype
(
auto
)
velSHalfVhf
=
GetVelSHalfVhf
();
decltype
(
auto
)
pressure_solution
=
GetPressureSolution
();
//
decltype(auto) pressure_solution = GetPressureSolution();
decltype
(
auto
)
velFtr
=
velFtr_
;
const
auto
time_step
=
GetTimeManager
().
GetTimeStep
();
...
...
Sources/ModelInstances/UnderDevelopment/Poromechanics/ImplicitStep/ImplicitStepFluid/NewtonFixedPoint/LocalVariationalOperatorInstances/T21.hxx
View file @
64f58c20
...
...
@@ -83,12 +83,10 @@ namespace HappyHeart
decltype
(
auto
)
hyperelastic_law
=
GetHyperelasticLaw
();
decltype
(
auto
)
fluid_mass_data
=
hyperelastic_law
.
GetFluidmassData
();
//decltype(auto) difference_fluidmass = fluid_mass_data.GetDifferenceAsParam(); \todo #1022 See which one is correct: difference stems from rebase.
decltype
(
auto
)
cauchy_green_tensor
=
this
->
GetCauchyGreenTensor
();
decltype
(
auto
)
difference_fluidmass
=
fluid_mass_data
.
GetDifferenceOnSolidAsParam
();
decltype
(
auto
)
difference_fluidmass
=
fluid_mass_data
.
GetNewMinusCurrentOnSolidAsParam
();
for
(
const
auto
&
infos_at_quad_pt
:
infos_at_quad_pt_list
)
{
...
...
Sources/ModelInstances/UnderDevelopment/Poromechanics/Parameter/Local/UpdatePressureAtQuadPt.hxx
View file @
64f58c20
...
...
@@ -71,7 +71,7 @@ namespace HappyHeart
decltype
(
auto
)
hyperelastic_law
=
GetHyperelasticLaw
();
decltype
(
auto
)
fluid_mass_data
=
hyperelastic_law
.
GetFluidmassData
();
decltype
(
auto
)
difference_fluidmass
=
fluid_mass_data
.
Get
Diffe
ren
ce
OnSolidAsParam
();
decltype
(
auto
)
difference_fluidmass
=
fluid_mass_data
.
Get
NewMinusCur
ren
t
OnSolidAsParam
();
for
(
const
auto
&
infos_at_quad_pt
:
infos_at_quad_pt_list
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment