Commit 4d671de6 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1022 Remove entirely fluid pressure data (some convenient aliases defined...

#1022 Remove entirely fluid pressure data (some convenient aliases defined there have been moved top NewFluidPressureData).
parent eea86157
......@@ -454,7 +454,6 @@
BE17E7C51D7EA9E300A1AE6A /* SolidVelocity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8B86C91D6AEFF100F48E88 /* SolidVelocity.cpp */; };
BE17E7C61D7EA9E300A1AE6A /* GradOnGradientBasedElasticityTensor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE669E171C7C9FCE00C521CA /* GradOnGradientBasedElasticityTensor.cpp */; };
BE17E7C71D7EA9E300A1AE6A /* LoadOnSolid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEDAF9CF1D17F51600D5AA0D /* LoadOnSolid.cpp */; };
BE17E7C81D7EA9E300A1AE6A /* FluidPressure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE15E40E1D6DC67E0046E1B2 /* FluidPressure.cpp */; };
BE17E7CA1D7EA9E300A1AE6A /* Monolithic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE3266651D6765CB0073E7BB /* Monolithic.cpp */; };
BE17E7CB1D7EA9E300A1AE6A /* Ale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF183251C6DE3A3008A6F1E /* Ale.cpp */; };
BE17E7CC1D7EA9E300A1AE6A /* VariationalFormulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA78BB31CE092CA00A6A185 /* VariationalFormulation.cpp */; };
......@@ -1187,7 +1186,6 @@
BE6FB20F1D8C3BD800B9F0FB /* FluidVelocity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE91D7291D67248C00EFD107 /* FluidVelocity.cpp */; };
BE6FB2101D8C3BD800B9F0FB /* SolidVelocity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8B86C91D6AEFF100F48E88 /* SolidVelocity.cpp */; };
BE6FB2111D8C3BD800B9F0FB /* Porosity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8B86CD1D6B47B400F48E88 /* Porosity.cpp */; };
BE6FB2121D8C3BD800B9F0FB /* FluidPressure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE15E40E1D6DC67E0046E1B2 /* FluidPressure.cpp */; };
BE6FB2131D8C3BF300B9F0FB /* VariationalFormulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA78BB31CE092CA00A6A185 /* VariationalFormulation.cpp */; };
BE6FB2201D8C3BF300B9F0FB /* Ale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF183251C6DE3A3008A6F1E /* Ale.cpp */; };
BE6FB2211D8C3BF300B9F0FB /* GradOnGradientBasedElasticityTensor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE669E171C7C9FCE00C521CA /* GradOnGradientBasedElasticityTensor.cpp */; };
......@@ -5155,9 +5153,6 @@
BE15AE0E1DC373BA00BA5D6B /* UpdateCauchyGreenTensor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UpdateCauchyGreenTensor.cpp; sourceTree = "<group>"; };
BE15AE0F1DC373BA00BA5D6B /* UpdateCauchyGreenTensor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = UpdateCauchyGreenTensor.hpp; sourceTree = "<group>"; };
BE15AE101DC373BA00BA5D6B /* UpdateCauchyGreenTensor.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = UpdateCauchyGreenTensor.hxx; sourceTree = "<group>"; };
BE15E40E1D6DC67E0046E1B2 /* FluidPressure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FluidPressure.cpp; path = Data/FluidPressure.cpp; sourceTree = "<group>"; };
BE15E40F1D6DC67E0046E1B2 /* FluidPressure.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = FluidPressure.hpp; path = Data/FluidPressure.hpp; sourceTree = "<group>"; };
BE15E4101D6DC67E0046E1B2 /* FluidPressure.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = FluidPressure.hxx; path = Data/FluidPressure.hxx; sourceTree = "<group>"; };
BE15E41D1D6DE6540046E1B2 /* FromMonolithic.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = FromMonolithic.hpp; path = Data/Crtp/FromMonolithic.hpp; sourceTree = "<group>"; };
BE15E41E1D6DE6540046E1B2 /* FromMonolithic.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = FromMonolithic.hxx; path = Data/Crtp/FromMonolithic.hxx; sourceTree = "<group>"; };
BE163C871A16121000E05845 /* FEltSpaceStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = FEltSpaceStorage.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
......@@ -9467,9 +9462,6 @@
BE8B86CD1D6B47B400F48E88 /* Porosity.cpp */,
BE8B86CE1D6B47B400F48E88 /* Porosity.hpp */,
BE8B86CF1D6B47B400F48E88 /* Porosity.hxx */,
BE15E40E1D6DC67E0046E1B2 /* FluidPressure.cpp */,
BE15E40F1D6DC67E0046E1B2 /* FluidPressure.hpp */,
BE15E4101D6DC67E0046E1B2 /* FluidPressure.hxx */,
BE99AAC91DBF62F400ADBB1A /* NewFluidPressure.hpp */,
BE99AACA1DBF62F400ADBB1A /* NewFluidPressure.hxx */,
BE15E4161D6DE6310046E1B2 /* Crtp */,
......@@ -15473,7 +15465,6 @@
BE71B9371DB75AE5005DCB59 /* T33.cpp in Sources */,
BE17E7C61D7EA9E300A1AE6A /* GradOnGradientBasedElasticityTensor.cpp in Sources */,
BE17E7C71D7EA9E300A1AE6A /* LoadOnSolid.cpp in Sources */,
BE17E7C81D7EA9E300A1AE6A /* FluidPressure.cpp in Sources */,
BE71B90B1DB75AE5005DCB59 /* HybridVector.cpp in Sources */,
BE17E7CA1D7EA9E300A1AE6A /* Monolithic.cpp in Sources */,
BE71B9131DB75AE5005DCB59 /* HybridVector.cpp in Sources */,
......@@ -15826,7 +15817,6 @@
BE6FB2291D8C3BF300B9F0FB /* LoadOnSolid.cpp in Sources */,
BE71B90E1DB75AE5005DCB59 /* DifferentialDarcy.cpp in Sources */,
BE6FB2241D8C3BF300B9F0FB /* LoadOnSolid.cpp in Sources */,
BE6FB2121D8C3BD800B9F0FB /* FluidPressure.cpp in Sources */,
BE71B9121DB75AE5005DCB59 /* HybridVector.cpp in Sources */,
BE6FB20A1D8C3BCD00B9F0FB /* VariableHolder.cpp in Sources */,
BE6FB2111D8C3BD800B9F0FB /* Porosity.cpp in Sources */,
//! \file
//
//
// FluidPressureData.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 01/09/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_CRTP_x_FLUID_PRESSURE_DATA_HPP_
# define HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_CRTP_x_FLUID_PRESSURE_DATA_HPP_
# include <type_traits>
# include "Utilities/Miscellaneous.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/Data/FluidPressure.hpp"
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace Crtp
{
/*!
* \brief Crtp to give FluidPressure data access to a class (typically a VariationalFormulation).
*/
template
<
class DerivedT,
Utilities::Access AccessT
>
class FluidPressureData
{
public:
//! \copydoc doxygen_hide_alias_self
using self = FluidPressureData<DerivedT, AccessT>;
//! Alias to the class which access is provided.
using data = DataNS::FluidPressure;
//! Alias to fluid mass reference.
using data_reference =
std::conditional_t
<
AccessT == Utilities::Access::read_and_write,
data&,
const data&
>;
public:
/// \name Special members.
///@{
//! Constructor.
explicit FluidPressureData(data_reference data);
//! Destructor.
~FluidPressureData() = default;
//! Copy constructor.
FluidPressureData(const FluidPressureData&) = delete;
//! Move constructor.
FluidPressureData(FluidPressureData&&) = delete;
//! Copy affectation.
FluidPressureData& operator=(const FluidPressureData&) = delete;
//! Move affectation.
FluidPressureData& operator=(FluidPressureData&&) = delete;
///@}
//! Constant accessor to data.
const data& GetFluidPressureData() const noexcept;
//! Non constant accessor to data.
template<Utilities::Access BogusAccessT = AccessT>
std::enable_if_t
<
BogusAccessT == Utilities::Access::read_and_write,
data&
>
GetNonCstFluidPressureData() noexcept;
private:
/*!
* \brief Reference to the data object to which present Crtp gives access.
*
* This reference is non constant if AccessT == Utilities::Access::read_and_write.
*
* The object is managed by Model.
*/
data_reference data_;
};
} // namespace Crtp
} // namespace PoromechanicsNS
} // namespace HappyHeart
# include "ModelInstances/UnderDevelopment/Poromechanics/Crtp/FluidPressureData.hxx"
#endif // HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_CRTP_x_FLUID_PRESSURE_DATA_HPP_
//! \file
//
//
// FluidPressureData.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 01/09/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_CRTP_x_FLUID_PRESSURE_DATA_HXX_
# define HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_CRTP_x_FLUID_PRESSURE_DATA_HXX_
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace Crtp
{
template
<
class DerivedT,
Utilities::Access AccessT
>
FluidPressureData<DerivedT, AccessT>::FluidPressureData(data_reference data)
: data_(data)
{ }
template
<
class DerivedT,
Utilities::Access AccessT
>
const typename FluidPressureData<DerivedT, AccessT>::data&
FluidPressureData<DerivedT, AccessT>::GetFluidPressureData() const noexcept
{
return data_;
}
template
<
class DerivedT,
Utilities::Access AccessT
>
template<Utilities::Access BogusAccessT>
std::enable_if_t
<
BogusAccessT == Utilities::Access::read_and_write,
typename FluidPressureData<DerivedT, AccessT>::data&
>
FluidPressureData<DerivedT, AccessT>::GetNonCstFluidPressureData() noexcept
{
return const_cast<data&>(GetFluidPressureData());
}
} // namespace Crtp
} // namespace PoromechanicsNS
} // namespace HappyHeart
#endif // HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_CRTP_x_FLUID_PRESSURE_DATA_HXX_
//! \file
//
//
// FluidPressure.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 24/08/16.
// Copyright © 2016 Inria. All rights reserved.
//
#include "FiniteElement/FiniteElementSpace/GodOfDofManager.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/InputParameterList.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/Data/FluidPressure.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/Data/Monolithic.hpp"
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace DataNS
{
const std::string& FluidPressure::ClassName()
{
static std::string ret("FluidPressure");
return ret;
}
FluidPressure::FluidPressure(const Monolithic& monolithic_data,
const GlobalMatrix& interpolation_monolithic_2_pressure,
const GlobalMatrix& interpolation_fluid_2_solid)
: from_monolithic_parent(monolithic_data, interpolation_monolithic_2_pressure),
interpolation_fluid_2_solid_(interpolation_fluid_2_solid)
{
decltype(auto) god_of_dof_manager = GodOfDofManager::GetInstance();
decltype(auto) fluid_god_of_dof = god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::fluid));
{
decltype(auto) numbering_subset =
fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_pressure));
from_monolithic_parent::Init(fluid_god_of_dof, numbering_subset);
decltype(auto) new_value = from_monolithic_parent::GetNew();
current_value_ = std::make_unique<GlobalVector>(new_value);
global_vector_temporary_fluid_parent::InitGlobalVectorTemporary(new_value);
}
decltype(auto) unknown_manager = UnknownManager::GetInstance();
decltype(auto) fluid_pressure_unknown =
unknown_manager.GetUnknown(EnumUnderlyingType(UnknownIndex::fluid_pressure));
{
decltype(auto) solid_god_of_dof =
god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::solid));
decltype(auto) numbering_subset =
solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::fluid_pressure_on_solid));
on_solid_ = std::make_unique<GlobalVector>(numbering_subset);
decltype(auto) on_solid = *on_solid_;
AllocateGlobalVector(solid_god_of_dof, on_solid);
global_vector_temporary_solid_parent::InitGlobalVectorTemporary(on_solid);
decltype(auto) felt_space =
solid_god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::solid));
using scalar_at_dof_type = ParameterAtDof<ParameterNS::Type::scalar>;
new_on_solid_as_param_ = std::make_unique<scalar_at_dof_type>("Fluid pressure on solid mesh",
solid_god_of_dof.GetGeometricMeshRegion(),
felt_space,
fluid_pressure_unknown,
GetOnSolid());
}
}
void FluidPressure::PrepareNextTimeIteration()
{
GetNonCstCurrent().Copy(GetNew(), __FILE__, __LINE__);
}
const GlobalVector& FluidPressure::GetOnSolid() const noexcept
{
assert(!(!on_solid_));
// First line lazy evaluates current pressure: if not up-to-date with monolithic data it updates it.
decltype(auto) new_value = GetNew();
auto& ret = *on_solid_;
if (on_solid_tag_ != GetValueTag())
{
// Project current onto solid mesh.
Wrappers::Petsc::MatMult(GetInterpolationFluidToSolid(),
new_value,
ret,
__FILE__, __LINE__);
on_solid_tag_ = GetValueTag();
}
return ret;
}
} // namespace DataNS
} // namespace PoromechanicsNS
} // namespace HappyHeart
//! \file
//
//
// FluidPressure.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 24/08/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_DATA_x_FLUID_PRESSURE_HPP_
# define HAPPY_HEART_x_MODEL_INSTANCES_x_UNDER_DEVELOPMENT_x_POROMECHANICS_x_DATA_x_FLUID_PRESSURE_HPP_
# include <memory>
# include <vector>
# include "Utilities/LinearAlgebra/Storage/Global/Crtp/GlobalVectorTemporary.hpp"
# include "Core/LinearAlgebra/GlobalVector.hpp"
# include "Parameters/ParameterAtDof.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/Data/Crtp/FromMonolithic.hpp"
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace DataNS
{
// ============================
//! \cond IGNORE_BLOCK_IN_DOXYGEN
// Forward declarations.
// ============================
class Monolithic;
// ============================
// End of forward declarations.
//! \endcond IGNORE_BLOCK_IN_DOXYGEN
// ============================
class FluidPressure
: public Crtp::FromMonolithic<FluidPressure>,
public GlobalLinearAlgebraNS::GlobalVectorTemporary<FluidPressure, GlobalVector, 2ul, EnumUnderlyingType(MeshIndex::solid)>,
public GlobalLinearAlgebraNS::GlobalVectorTemporary<FluidPressure, GlobalVector, 1ul, EnumUnderlyingType(MeshIndex::fluid)>
{
public:
//! \copydoc doxygen_hide_alias_self
using self = FluidPressure;
//! Alias to unique pointer.
using unique_ptr = std::unique_ptr<self>;
//! Alias to from_monolithic_parent.
using from_monolithic_parent = Crtp::FromMonolithic<self>;
//! Class name.
static const std::string& ClassName();
private:
//! Alias to GlobalVectorTemporary parent related to solid mesh.
using global_vector_temporary_solid_parent =
GlobalLinearAlgebraNS::GlobalVectorTemporary<self, GlobalVector, 2ul, EnumUnderlyingType(MeshIndex::solid)>;
//! Alias to GlobalVectorTemporary parent related to fluid mesh.
using global_vector_temporary_fluid_parent =
GlobalLinearAlgebraNS::GlobalVectorTemporary<self, GlobalVector, 1ul, EnumUnderlyingType(MeshIndex::fluid)>;
public:
using global_vector_temporary_solid_parent::GetNonCstTemporaryGlobalVectorManager;
using global_vector_temporary_fluid_parent::GetNonCstTemporaryGlobalVectorManager;
//! Alias to GlobalVectorTemporary manager related to solid mesh.
using global_vector_temporary_solid_manager =
global_vector_temporary_solid_parent::global_vector_temporary_manager;
//! Alias to GlobalVectorTemporary manager related to fluid mesh.
using global_vector_temporary_fluid_manager =
global_vector_temporary_fluid_parent::global_vector_temporary_manager;
public:
/// \name Special members.
///@{
//! Constructor.
explicit FluidPressure(const Monolithic& monolithic_data,
const GlobalMatrix& interpolation_monolithic_2_pressure,
const GlobalMatrix& interpolation_fluid_2_solid);
//! Destructor.
~FluidPressure() = default;
//! Copy constructor.
FluidPressure(const FluidPressure&) = delete;
//! Move constructor.
FluidPressure(FluidPressure&&) = delete;
//! Copy affectation.
FluidPressure& operator=(const FluidPressure&) = delete;
//! Move affectation.
FluidPressure& operator=(FluidPressure&&) = delete;
///@}
/*!
* \brief Prepare next time iteration.
*
* For instance new pressure -> current pressure.
*/
void PrepareNextTimeIteration();
private:
/*!
* \name Accessors to pressure vectors defined on \a NumberingSubset NumberingSubsetIndex::fluid_pressure.
*/
///@{
//! Constant accessor to the current fluid pressure.
const GlobalVector& GetCurrent() const noexcept;
//! Non constant accessor to the current fluid velocity.
GlobalVector& GetNonCstCurrent() noexcept;
///@}
/*!
* \name Accessors to pressure vectors defined on solid mesh.
*/
///@{
/*!
* \brief Returns the fluid pressure projected on the solid mesh.
*
* This accessor is based on lazy evaluation and might recompute on the fly the projection if the value
* of the pressure has changed.
*/
const GlobalVector& GetOnSolid() const noexcept;
public:
/*!
* \brief Same as GetOnSolid(), except return value is not used.
*/
void ReevaluateOnSolid() const noexcept;
//! \todo #820 Document.
const ParameterAtDof<ParameterNS::Type::scalar>& GetNewOnSolidAsParam() const noexcept;
///@}
public:
private:
//! Interpolator fluid pressure fluid -> solid.
const GlobalMatrix& GetInterpolationFluidToSolid() const noexcept;
private:
/*!
* \name Fluid pressure vectors.
*
* Defined on \a NumberingSubset NumberingSubsetIndex::fluid_pressure.
*/
///@{
//! Value of current fluid pressure.
GlobalVector::unique_ptr current_value_ = nullptr;
///@}
/*!