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

#820 Poromechanics: add inlet pressure.

parent 2871d6f7
......@@ -1039,6 +1039,63 @@ bulk_solid = {
-- inlet pressure
TransientSource1 = {
-- How is given the transient source value (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: {"VALUE1", "VALUE2", ...}
-- Constraint: ops_in(v, {'ignore', 'constant', 'lua_function'})
nature = {"constant", "constant", "constant"},
-- Value of the transient source in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: {VALUE1, VALUE2, ...}
scalar_value = { 0. , 1.e4, 0.},
-- Value of the transient source in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Function expects as arguments global coordinates (coordinates in the mesh).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function_x = none,
-- Value of the transient source in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Function expects as arguments global coordinates (coordinates in the mesh).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function_y = none,
-- Value of the transient source in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Function expects as arguments global coordinates (coordinates in the mesh).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function_z = none
} -- TransientSource1
-- Initial value of porosity at each dof.
-- Expected format: VALUE
porosity = 0.1
......
......@@ -66,6 +66,7 @@ namespace HappyHeart
return ret;
}
const std::string& Scalar::Constraint()
{
return Utilities::EmptyString();
......
......@@ -28,47 +28,42 @@ namespace HappyHeart
const TimeManager& time_manager,
const GodOfDof& god_of_dof,
const ParameterAtDof<ParameterNS::Type::scalar>& porosity,
const Parameter<ParameterNS::Type::vector>& inlet_pressure,
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list)
: parent(mpi,
time_manager,
god_of_dof,
std::move(boundary_condition_list)),
porosity_parent(porosity)
porosity_parent(porosity),
inlet_pressure_(inlet_pressure)
{ }
void VariationalFormulation::AllocateMatricesAndVectors()
{
// TODO Set here the pattern of all global matrices and vectors.
// Typically it should be something like:
//
// \code
// const auto& numbering_subset1 = GetNumberingSubset1(); // accessor you have to defined in new class; name it as appropriate!
// const auto& numbering_subset2 = GetNumberingSubset2();
//
// // Allocate the relevant block matrix. Below an example for Stokes model, in which only upper blocks
// // in the matrix need to be allocated.
// parent::AllocateSystemMatrix(numbering_subset1, numbering_subset1);
// parent::AllocateSystemMatrix(numbering_subset1, numbering_subset2);
//
// // Same for vector; system_rhs and system_solution are allocated here.
// parent::AllocateSystemVector(numbering_subset);
//
// Access to the newly allocated matrix and vectors.
// const auto& system_matrix = GetSystemMatrix(numbering_subset1, numbering_subset1);
// const auto& system_rhs = GetSystemRhs(numbering_subset1);
//
// // Allocate your problem specific matrices and vectors, by coping structure of the ones allocated above.
// GetNonCstVectorCurrentVolumicSource().CompleteCopy(system_rhs, __FILE__, __LINE__);
// ...
//
// \endcode
}
void VariationalFormulation::SupplInit(const InputParameterList& input_parameter_data)
{
/*
const auto& inlet_border_felt_space = god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::inlet_border));
inlet_pressure_source_operator_ =
std::make_unique<GVO::TransientSource>(inlet_border_felt_space,
fluid_velocity,
mesh_dimension,
default_quadrature_rule_set,
DoComputeProcessorWiseLocal2Global::yes,
*inlet_pressure_);
*/
}
......
......@@ -18,6 +18,8 @@
# include "Geometry/Domain.hpp"
# include "Operators/GlobalVariationalOperatorInstances/LinearForm/TransientSource.hpp"
# include "FormulationSolver/VariationalFormulation.hpp"
# include "ModelInstances/UnderDevelopment/Poromechanics/InputParameterList.hpp"
......@@ -77,6 +79,7 @@ namespace HappyHeart
const TimeManager& time_manager,
const GodOfDof& god_of_dof,
const ParameterAtDof<ParameterNS::Type::scalar>& porosity,
const Parameter<ParameterNS::Type::vector>& inlet_pressure,
DirichletBoundaryCondition::vector_shared_ptr&& boundary_condition_list);
//! Destructor.
......@@ -126,12 +129,30 @@ namespace HappyHeart
///@}
private:
/// \name Accessors.
///@{
//! Constant accessor to the inlet pressure (acts as a source).
const ::HappyHeart::GlobalVariationalOperatorNS::TransientSource&
GetInletPressureSourceOperator() const noexcept;
//! Constant accessor to the inlet pressure parameter.
const Parameter<ParameterNS::Type::vector>& GetInletPressure() const noexcept;
///@}
private:
/// \name Global variational operators.
///@{
//! Inlet pressure (acts as a source).
::HappyHeart::GlobalVariationalOperatorNS::TransientSource::const_unique_ptr
inlet_pressure_source_operator_ = nullptr;
///@}
......@@ -145,6 +166,8 @@ namespace HappyHeart
private:
//! Inlet pressure parameter.
const Parameter<ParameterNS::Type::vector>& inlet_pressure_;
};
......
......@@ -48,6 +48,22 @@ namespace HappyHeart
}
inline const ::HappyHeart::GlobalVariationalOperatorNS::TransientSource&
ImplicitStepFluidNS::VariationalFormulation
::GetInletPressureSourceOperator() const noexcept
{
assert(!(!inlet_pressure_source_operator_));
return *inlet_pressure_source_operator_;
}
inline const Parameter<ParameterNS::Type::vector>& VariationalFormulation
::GetInletPressure() const noexcept
{
return inlet_pressure_;
}
} // namespace ImplicitStepFluidNS
......
......@@ -23,6 +23,7 @@
# include "Core/InputParameter/DirichletBoundaryCondition/DirichletBoundaryCondition.hpp"
# include "Core/InputParameter/Parameter/Fluid/Fluid.hpp"
# include "Core/InputParameter/Parameter/Solid/Solid.hpp"
# include "Core/InputParameter/Parameter/Source/TransientSource.hpp"
# include "Core/InputParameter/Interpolator/InitVertexMatching.hpp"
# include "Core/InputParameter/Solver/Petsc.hpp"
......@@ -87,6 +88,11 @@ namespace HappyHeart
solid = 20
};
enum class SourceIndex : unsigned int
{
inlet_pressure = 1
};
......@@ -154,7 +160,9 @@ namespace HappyHeart
// \todo #820 This parameter probably won't remain; keep it at the moment until it's completely sure...
InputParameter::PoromechanicsNS::Porosity,
InputParameter::PoromechanicsNS::BulkSolid
InputParameter::PoromechanicsNS::BulkSolid,
InputParameter::TransientSource<EnumUnderlyingType(SourceIndex::inlet_pressure)>
>;
......
......@@ -228,6 +228,12 @@ namespace HappyHeart
//! Non constant accessor to the velocity of the fluid in the previous time iteration.
GlobalVector& GetNonCstFluidVelocityPreviousTimeIteration() noexcept;
//! Constant accessor to the inlet pressure parameter.
const Parameter<ParameterNS::Type::vector>& GetInletPressure() const noexcept;
//! Non constant accessor to the inlet pressure parameter.
Parameter<ParameterNS::Type::vector>& GetNonCstInletPressure() noexcept;
///@}
......@@ -337,6 +343,10 @@ namespace HappyHeart
//! Velocity of the fluid in the previous time iteration.
GlobalVector::unique_ptr fluid_velocity_previous_time_iteration_ = nullptr;
//! Inlet pressure parameter.
Parameter<ParameterNS::Type::vector>::unique_ptr inlet_pressure_ = nullptr;
};
......
......@@ -220,6 +220,21 @@ namespace HappyHeart
return const_cast<GlobalVector&>(GetFluidVelocityPreviousTimeIteration());
}
template<class SolidVariationalFormulationPolicyT>
inline const Parameter<ParameterNS::Type::vector>& Model<SolidVariationalFormulationPolicyT>::GetInletPressure() const noexcept
{
assert(!(!inlet_pressure_));
return *inlet_pressure_;
}
template<class SolidVariationalFormulationPolicyT>
inline Parameter<ParameterNS::Type::vector>& Model<SolidVariationalFormulationPolicyT>::GetNonCstInletPressure() noexcept
{
return const_cast<Parameter<ParameterNS::Type::vector>&>(GetInletPressure());
}
} // namespace PoromechanicsNS
......
......@@ -125,7 +125,19 @@ namespace HappyHeart
GetFluidMassVector());
}
InitPorosity(input_parameter_data);
InitPorosity(input_parameter_data);
{
using parameter_type = InputParameter::TransientSource<EnumUnderlyingType(SourceIndex::inlet_pressure)>;
inlet_pressure_ =
InitThreeDimensionalParameter<parameter_type>("inlet_pressure",
mesh,
input_parameter_data);
}
}
......@@ -238,6 +250,7 @@ namespace HappyHeart
time_manager,
fluid_god_of_dof,
porosity,
GetInletPressure(),
std::move(bc_list));
implicit_step_fluid_varf_->Init(input_parameter_data);
......@@ -253,7 +266,10 @@ namespace HappyHeart
template<class SolidVariationalFormulationPolicyT>
void Model<SolidVariationalFormulationPolicyT>::SupplInitializeStep()
{ }
{
}
......
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