Commit 7e28eca0 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#820 Poromechanics: add the time dependency parameters to the TransientSource...

#820 Poromechanics: add the time dependency parameters to the TransientSource operator (even if it is not currently in use).
parent fa9196f7
......@@ -464,8 +464,6 @@
BE50E9021C903BDF0038D16E /* None.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE50E9001C903BDF0038D16E /* None.cpp */; };
BE50E9031C903BDF0038D16E /* Viscoelasticity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE50E9011C903BDF0038D16E /* Viscoelasticity.cpp */; };
BE51CDB41CA3FE9400B66D2A /* ImplicitStepFluidVariationalFormulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE51CDB11CA3FE9400B66D2A /* ImplicitStepFluidVariationalFormulation.cpp */; };
BE51CDE01CA4560100B66D2A /* TransientSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE51CDDD1CA4560100B66D2A /* TransientSource.cpp */; };
BE51CDE51CA4560F00B66D2A /* TransientSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE51CDE21CA4560F00B66D2A /* TransientSource.cpp */; };
BE5389FD1C897FE400D80749 /* Mpi.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE5389FB1C897FE400D80749 /* Mpi.hpp */; };
BE5389FE1C897FE400D80749 /* Mpi.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE5389FC1C897FE400D80749 /* Mpi.hxx */; };
BE538A041C89B97800D80749 /* CoordIndexes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE538A011C89B97800D80749 /* CoordIndexes.cpp */; };
......@@ -4544,10 +4542,8 @@
BE51CDB11CA3FE9400B66D2A /* ImplicitStepFluidVariationalFormulation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImplicitStepFluidVariationalFormulation.cpp; sourceTree = "<group>"; };
BE51CDB21CA3FE9400B66D2A /* ImplicitStepFluidVariationalFormulation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ImplicitStepFluidVariationalFormulation.hpp; sourceTree = "<group>"; };
BE51CDB31CA3FE9400B66D2A /* ImplicitStepFluidVariationalFormulation.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ImplicitStepFluidVariationalFormulation.hxx; sourceTree = "<group>"; };
BE51CDDD1CA4560100B66D2A /* TransientSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransientSource.cpp; sourceTree = "<group>"; };
BE51CDDE1CA4560100B66D2A /* TransientSource.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TransientSource.hpp; sourceTree = "<group>"; };
BE51CDDF1CA4560100B66D2A /* TransientSource.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TransientSource.hxx; sourceTree = "<group>"; };
BE51CDE21CA4560F00B66D2A /* TransientSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransientSource.cpp; sourceTree = "<group>"; };
BE51CDE31CA4560F00B66D2A /* TransientSource.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TransientSource.hpp; sourceTree = "<group>"; };
BE51CDE41CA4560F00B66D2A /* TransientSource.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TransientSource.hxx; sourceTree = "<group>"; };
BE52B1A71C8DDC9A009B7857 /* ModelInitialize.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ModelInitialize.hxx; sourceTree = "<group>"; };
......@@ -7232,7 +7228,6 @@
BE60DBFB1C7F417C007B334C /* Porosity.cpp */,
BE60DBFC1C7F417C007B334C /* Porosity.hpp */,
BE60DBFD1C7F417C007B334C /* Porosity.hxx */,
BE51CDDD1CA4560100B66D2A /* TransientSource.cpp */,
BE51CDDE1CA4560100B66D2A /* TransientSource.hpp */,
BE51CDDF1CA4560100B66D2A /* TransientSource.hxx */,
);
......@@ -7251,7 +7246,6 @@
BE669E1B1C7C9FDE00C521CA /* GradOnGradientBasedElasticityTensor.cpp */,
BE669E1C1C7C9FDE00C521CA /* GradOnGradientBasedElasticityTensor.hpp */,
BE669E1D1C7C9FDE00C521CA /* GradOnGradientBasedElasticityTensor.hxx */,
BE51CDE21CA4560F00B66D2A /* TransientSource.cpp */,
BE51CDE31CA4560F00B66D2A /* TransientSource.hpp */,
BE51CDE41CA4560F00B66D2A /* TransientSource.hxx */,
BE60DBFF1C7F4222007B334C /* Porosity.cpp */,
......@@ -12305,7 +12299,6 @@
BEF1832C1C6DE3B2008A6F1E /* Ale.cpp in Sources */,
BE83AF341C733EAD002C6FA3 /* StVenantKirchhoff.cpp in Sources */,
BE9BE1B51C96D02B0065BEFE /* SolidOnFluidMesh.cpp in Sources */,
BE51CDE51CA4560F00B66D2A /* TransientSource.cpp in Sources */,
BE5842131C6B8C920040C694 /* Mass.cpp in Sources */,
BEAEA8C71C71DFD30054FEF9 /* Porosity.cpp in Sources */,
BE669E1E1C7C9FDE00C521CA /* GradOnGradientBasedElasticityTensor.cpp in Sources */,
......@@ -12316,7 +12309,6 @@
BE669E1A1C7C9FCE00C521CA /* GradOnGradientBasedElasticityTensor.cpp in Sources */,
BEF183281C6DE3A3008A6F1E /* Ale.cpp in Sources */,
BE60DBFE1C7F417C007B334C /* Porosity.cpp in Sources */,
BE51CDE01CA4560100B66D2A /* TransientSource.cpp in Sources */,
BE83AF3F1C73669D002C6FA3 /* BulkSolid.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -167,7 +167,6 @@ namespace HappyHeart
* within a Model or a VariationalFormulation solely for the purpose of populating the local2global during
* the initialisation of the program.
*
* \return Local -> Global array.
*/
void ComputeLocal2Global(const ExtendedUnknown::vector_const_shared_ptr& unknown_list) const;
......
//! \file
//
//
// TransientSource.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 03/02/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#include "ModelInstances/UnderDevelopment/Poromechanics/GlobalVariationalOperatorInstances/TransientSource.hpp"
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace GlobalVariationalOperatorNS
{
TransientSource::TransientSource(const FEltSpace& felt_space,
const Unknown& unknown,
const unsigned int geom_mesh_region_dimension,
const quadrature_rule_per_topology_type& quadrature_rule_per_topology,
const ParameterAtDof<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None, 2u>::type& porosity,
DoComputeProcessorWiseLocal2Global do_consider_processor_wise_local_2_global,
const Parameter<ParameterNS::Type::vector, ParameterNS::TimeDependencyNS::None>& source)
: parent(felt_space,
unknown,
geom_mesh_region_dimension,
quadrature_rule_per_topology,
AllocateGradientFEltPhi::no,
do_consider_processor_wise_local_2_global,
porosity,
source)
{ }
const std::string& TransientSource::ClassName()
{
static std::string name("Transient source with porosity");
return name;
}
} //namespace PoromechanicsNS
} // namespace GlobalVariationalOperatorNS
} // namespace HappyHeart
......@@ -37,19 +37,26 @@ namespace HappyHeart
*
* \todo Improve the comment by writing its mathematical definition!
*/
template
<
template<ParameterNS::Type> class TimeDependencyT = ParameterNS::TimeDependencyNS::None
>
class TransientSource final
: public GlobalVariationalOperator
<
TransientSource,
LocalVariationalOperatorNS::TransientSource
TransientSource<TimeDependencyT>,
LocalVariationalOperatorNS::TransientSource<TimeDependencyT>
>
{
public:
//! Alias to self.
using self = TransientSource<TimeDependencyT>;
//! Alias to unique pointer.
using const_unique_ptr = std::unique_ptr<const TransientSource>;
using const_unique_ptr = std::unique_ptr<const self>;
//! Returns the name of the operator.
static const std::string& ClassName();
......@@ -57,8 +64,8 @@ namespace HappyHeart
//! Convenient alias to pinpoint the GlobalVariationalOperator parent.
using parent = GlobalVariationalOperator
<
TransientSource,
LocalVariationalOperatorNS::TransientSource
self,
LocalVariationalOperatorNS::TransientSource<TimeDependencyT>
>;
//! Friendship to the parent class so that the CRTP can reach private methods defined below.
......
......@@ -19,38 +19,82 @@ namespace HappyHeart
namespace PoromechanicsNS
{
namespace GlobalVariationalOperatorNS
{
template<class LinearAlgebraTupleT>
inline void TransientSource::Assemble(LinearAlgebraTupleT&& global_vector_with_coeff_tuple,
double time,
const Domain& domain) const
namespace GlobalVariationalOperatorNS
{
return parent::AssembleImpl(std::move(global_vector_with_coeff_tuple),
domain,
time);
}
template
<
template<ParameterNS::Type> class TimeDependencyT
>
TransientSource<TimeDependencyT>
::TransientSource(const FEltSpace& felt_space,
const Unknown& unknown,
const unsigned int geom_mesh_region_dimension,
const quadrature_rule_per_topology_type& quadrature_rule_per_topology,
const ParameterAtDof<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None, 2u>::type& porosity,
DoComputeProcessorWiseLocal2Global do_consider_processor_wise_local_2_global,
const Parameter<ParameterNS::Type::vector, ParameterNS::TimeDependencyNS::None>& source)
: parent(felt_space,
unknown,
geom_mesh_region_dimension,
quadrature_rule_per_topology,
AllocateGradientFEltPhi::no,
do_consider_processor_wise_local_2_global,
porosity,
source)
{ }
template
<
template<ParameterNS::Type> class TimeDependencyT
>
const std::string& TransientSource<TimeDependencyT>::ClassName()
{
static std::string name("Transient source with porosity");
return name;
}
template
<
template<ParameterNS::Type> class TimeDependencyT
>
template<class LinearAlgebraTupleT>
inline void TransientSource<TimeDependencyT>
::Assemble(LinearAlgebraTupleT&& global_vector_with_coeff_tuple,
double time,
const Domain& domain) const
{
return parent::AssembleImpl(std::move(global_vector_with_coeff_tuple),
domain,
time);
}
template
<
template<ParameterNS::Type> class TimeDependencyT
>
inline void
TransientSource<TimeDependencyT>
::SetComputeEltArrayArguments(const LocalFEltSpace& local_felt_space,
typename parent::local_variational_operator& local_operator,
std::tuple<double>&& additional_arguments) const
{
static_cast<void>(local_felt_space);
inline void
TransientSource
::SetComputeEltArrayArguments(const LocalFEltSpace& local_felt_space,
typename parent::local_variational_operator& local_operator,
std::tuple<double>&& additional_arguments) const
{
static_cast<void>(local_felt_space);
local_operator.SetTime(std::get<0>(additional_arguments));
}
local_operator.SetTime(std::get<0>(additional_arguments));
}
} // namespace GlobalVariationalOperatorNS
} // namespace GlobalVariationalOperatorNS
} //namespace PoromechanicsNS
} //namespace PoromechanicsNS
} // namespace HappyHeart
......
......@@ -103,15 +103,13 @@ namespace HappyHeart
namespace GVO = GlobalVariationalOperatorNS;
inlet_pressure_source_operator_ =
std::make_unique<GVO::TransientSource>(inlet_border_felt_space,
fluid_velocity,
mesh_dimension,
default_quadrature_rule_set,
GetPorosity(),
DoComputeProcessorWiseLocal2Global::yes,
GetInletPressure());
std::make_unique<GVO::TransientSource<>>(inlet_border_felt_space,
fluid_velocity,
mesh_dimension,
default_quadrature_rule_set,
GetPorosity(),
DoComputeProcessorWiseLocal2Global::yes,
GetInletPressure());
}
......
......@@ -154,7 +154,7 @@ namespace HappyHeart
///@{
//! Constant accessor to the inlet pressure (acts as a source).
const GlobalVariationalOperatorNS::TransientSource& GetInletPressureSourceOperator() const noexcept;
const GlobalVariationalOperatorNS::TransientSource<>& GetInletPressureSourceOperator() const noexcept;
//! Constant accessor to the inlet pressure parameter.
const Parameter<ParameterNS::Type::vector, ParameterNS::TimeDependencyNS::None>& GetInletPressure() const noexcept;
......
......@@ -48,7 +48,7 @@ namespace HappyHeart
}
inline const GlobalVariationalOperatorNS::TransientSource& VariationalFormulation
inline const GlobalVariationalOperatorNS::TransientSource<>& VariationalFormulation
::GetInletPressureSourceOperator() const noexcept
{
assert(!(!inlet_pressure_source_operator_));
......
//! \file
//
//
// TransientSource.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 03/02/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#include "Utilities/Numeric/Numeric.hpp"
#include "Geometry/GeometricElt_free_functions.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/LocalVariationalOperatorInstances/TransientSource.hpp"
namespace HappyHeart
{
namespace PoromechanicsNS
{
namespace LocalVariationalOperatorNS
{
TransientSource::TransientSource(const ExtendedUnknown::vector_const_shared_ptr& unknown_list,
typename parent::elementary_data_type&& a_elementary_data,
const ParameterAtDof<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None, 2u>::type& porosity,
const Parameter<ParameterNS::Type::vector, ParameterNS::TimeDependencyNS::None>& source)
: parent(unknown_list, std::move(a_elementary_data)),
porosity_parent(porosity),
source_(source)
{ }
TransientSource::~TransientSource() = default;
const std::string& TransientSource::ClassName()
{
static std::string name("TransientSourceWithPorosity");
return name;
}
void TransientSource::ComputeEltArray() // \todo #559 Reintroduce time dependancy (time_ argument for that...)!
{
auto& elementary_data = GetNonCstElementaryData();
const auto& infos_at_quad_pt_list = elementary_data.GetInformationsAtQuadraturePointList();
auto& vector_result = elementary_data.GetNonCstVectorResult();
const auto& current_geom_elt = elementary_data.GetCurrentGeomElt();
const auto& ref_felt = elementary_data.GetRefFElt(GetNthUnknown());
const int Ncomponent = static_cast<int>(ref_felt.Ncomponent());
const auto Nnode = static_cast<int>(ref_felt.Nnode());
decltype(auto) porosity = porosity_parent::GetPorosity();
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
const auto& phi = infos_at_quad_pt.GetRefFEltPhi();
const auto& quad_pt = infos_at_quad_pt.GetQuadraturePoint();
const double quad_pt_factor = quad_pt.GetWeight()
* infos_at_quad_pt.GetAbsoluteValueJacobianDeterminant()
* porosity.GetValue(quad_pt, current_geom_elt);
const auto& force_value = GetSource().GetValue(quad_pt, current_geom_elt);
for (int node_index = 0; node_index < Nnode; ++node_index)
{
int dof_index = node_index;
assert(force_value.GetSize() >= Ncomponent);
const auto factor = quad_pt_factor * phi(node_index);
for (int component = 0; component < Ncomponent; ++component, dof_index += Nnode)
vector_result(dof_index) += factor * force_value(component);
}
}
}
} // namespace LocalVariationalOperatorNS
} //namespace PoromechanicsNS
} // namespace HappyHeart
......@@ -41,21 +41,28 @@ namespace HappyHeart
* \todo Improve the comment by writing its mathematical definition!
* \todo #559 Time dependency has been momentarily dropped.
*/
template
<
template<ParameterNS::Type> class TimeDependencyT = ParameterNS::TimeDependencyNS::None
>
class TransientSource final
: public LinearLocalVariationalOperator<LocalVector>,
private Crtp::Porosity<TransientSource>
private Crtp::Porosity<TransientSource<TimeDependencyT>>
{
public:
//! Alias to self.
using self = TransientSource<TimeDependencyT>;
//! Alias to unique pointer.
using unique_ptr = std::unique_ptr<TransientSource>;
using unique_ptr = std::unique_ptr<self>;
//! Alias to parent.
using parent = LinearLocalVariationalOperator<LocalVector>;
//! Alias to porosity parent.
using porosity_parent = Crtp::Porosity<TransientSource>;
using porosity_parent = Crtp::Porosity<self>;
//! Returns the name of the operator.
static const std::string& ClassName();
......@@ -84,7 +91,7 @@ namespace HappyHeart
//! Destructor.
~TransientSource();
~TransientSource() = default;
//! Copy constructor.
TransientSource(const TransientSource&) = delete;
......
......@@ -24,14 +24,99 @@ namespace HappyHeart
{
template
<
template<ParameterNS::Type> class TimeDependencyT
>
TransientSource<TimeDependencyT>
::TransientSource(const ExtendedUnknown::vector_const_shared_ptr& unknown_list,
typename parent::elementary_data_type&& a_elementary_data,
const ParameterAtDof<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None, 2u>::type& porosity,
const Parameter<ParameterNS::Type::vector, ParameterNS::TimeDependencyNS::None>& source)
: parent(unknown_list, std::move(a_elementary_data)),
porosity_parent(porosity),
source_(source)
{ }
template
<
template<ParameterNS::Type> class TimeDependencyT
>
const std::string& TransientSource<TimeDependencyT>::ClassName()
{
static std::string name("TransientSourceWithPorosity");
return name;
}
template
<
template<ParameterNS::Type> class TimeDependencyT
>
void TransientSource<TimeDependencyT>::ComputeEltArray() // \todo #559 Reintroduce time dependancy (time_ argument for that...)!
{
auto& elementary_data = GetNonCstElementaryData();
const auto& infos_at_quad_pt_list = elementary_data.GetInformationsAtQuadraturePointList();
auto& vector_result = elementary_data.GetNonCstVectorResult();
const auto& current_geom_elt = elementary_data.GetCurrentGeomElt();
const auto& ref_felt = elementary_data.GetRefFElt(GetNthUnknown());
const int Ncomponent = static_cast<int>(ref_felt.Ncomponent());
const auto Nnode = static_cast<int>(ref_felt.Nnode());
decltype(auto) porosity = porosity_parent::GetPorosity();
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
const auto& phi = infos_at_quad_pt.GetRefFEltPhi();
const auto& quad_pt = infos_at_quad_pt.GetQuadraturePoint();
const double quad_pt_factor = quad_pt.GetWeight()
* infos_at_quad_pt.GetAbsoluteValueJacobianDeterminant()
* porosity.GetValue(quad_pt, current_geom_elt);
const auto& force_value = GetSource().GetValue(quad_pt, current_geom_elt);
for (int node_index = 0; node_index < Nnode; ++node_index)
{
int dof_index = node_index;
assert(force_value.GetSize() >= Ncomponent);
const auto factor = quad_pt_factor * phi(node_index);
for (int component = 0; component < Ncomponent; ++component, dof_index += Nnode)
vector_result(dof_index) += factor * force_value(component);
}
}
}
template
<
template<ParameterNS::Type> class TimeDependencyT
>
inline const Parameter<ParameterNS::Type::vector, ParameterNS::TimeDependencyNS::None>&
TransientSource::GetSource() const
TransientSource<TimeDependencyT>::GetSource() const
{
return source_;
}
inline void TransientSource::SetTime(double time) noexcept
template
<
template<ParameterNS::Type> class TimeDependencyT
>
inline void TransientSource<TimeDependencyT>::SetTime(double time) noexcept
{
time_ = time;