25namespace ThermoRichardsMechanics
27template <
int DisplacementDim>
31 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
32 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
33 unsigned const integration_order,
34 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
38 bool const use_monolithic_scheme)
39 :
Process(std::move(
name), mesh, std::move(jacobian_assembler), parameters,
40 integration_order, std::move(process_variables),
41 std::move(secondary_variables), use_monolithic_scheme),
42 process_data_(std::move(process_data))
50 heat_flux_ = MeshLib::getOrCreateMeshProperty<double>(
57 std::make_unique<IntegrationPointWriter>(
63 std::make_unique<IntegrationPointWriter>(
64 "saturation_ip", 1 , integration_order,
68 std::make_unique<IntegrationPointWriter>(
69 "porosity_ip", 1 , integration_order,
73 std::make_unique<IntegrationPointWriter>(
74 "transport_porosity_ip", 1 , integration_order,
78 std::make_unique<IntegrationPointWriter>(
85 std::make_unique<IntegrationPointWriter>(
92template <
int DisplacementDim>
98template <
int DisplacementDim>
103 auto const& l = *_local_to_global_index_map;
104 return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
105 &l.getGhostIndices(), &this->_sparsity_pattern};
108template <
int DisplacementDim>
112 _mesh_subset_all_nodes = std::make_unique<MeshLib::MeshSubset>(
113 _mesh, _mesh.getNodes(), process_data_.use_TaylorHood_elements);
116 mesh_subset_base_nodes_ = std::make_unique<MeshLib::MeshSubset>(
117 _mesh, base_nodes_, process_data_.use_TaylorHood_elements);
121 std::vector<MeshLib::MeshSubset> all__meshsubsets_single_component{
122 *_mesh_subset_all_nodes};
123 local_to_global_index_map_single_component_ =
124 std::make_unique<NumLib::LocalToGlobalIndexMap>(
125 std::move(all__meshsubsets_single_component),
130 std::vector<MeshLib::MeshSubset> all__meshsubsets{*mesh_subset_base_nodes_};
133 all__meshsubsets.push_back(*mesh_subset_base_nodes_);
136 const int monolithic_process_id = 0;
137 std::generate_n(std::back_inserter(all__meshsubsets),
138 getProcessVariables(monolithic_process_id)[2]
140 .getNumberOfGlobalComponents(),
141 [&]() {
return *_mesh_subset_all_nodes; });
143 std::vector<int>
const vec_n_components{1, 1, DisplacementDim};
144 _local_to_global_index_map =
145 std::make_unique<NumLib::LocalToGlobalIndexMap>(
146 std::move(all__meshsubsets), vec_n_components,
148 assert(_local_to_global_index_map);
151template <
int DisplacementDim>
155 unsigned const integration_order)
162 auto add_secondary_variable = [&](std::string
const&
name,
163 int const num_components,
164 auto get_ip_values_function)
166 _secondary_variables.addSecondaryVariable(
170 std::move(get_ip_values_function)));
173 add_secondary_variable(
"sigma",
175 DisplacementDim>::RowsAtCompileTime,
176 &LocalAssemblerIF::getIntPtSigma);
178 add_secondary_variable(
"swelling_stress",
180 DisplacementDim>::RowsAtCompileTime,
181 &LocalAssemblerIF::getIntPtSwellingStress);
183 add_secondary_variable(
"epsilon",
185 DisplacementDim>::RowsAtCompileTime,
186 &LocalAssemblerIF::getIntPtEpsilon);
188 add_secondary_variable(
"velocity", DisplacementDim,
189 &LocalAssemblerIF::getIntPtDarcyVelocity);
191 add_secondary_variable(
"saturation", 1,
192 &LocalAssemblerIF::getIntPtSaturation);
194 add_secondary_variable(
"porosity", 1, &LocalAssemblerIF::getIntPtPorosity);
196 add_secondary_variable(
"transport_porosity", 1,
197 &LocalAssemblerIF::getIntPtTransportPorosity);
199 add_secondary_variable(
"dry_density_solid", 1,
200 &LocalAssemblerIF::getIntPtDryDensitySolid);
202 add_secondary_variable(
"liquid_density", 1,
203 &LocalAssemblerIF::getIntPtLiquidDensity);
205 add_secondary_variable(
"viscosity", 1,
206 &LocalAssemblerIF::getIntPtViscosity);
213 add_secondary_variable);
215 process_data_.element_saturation = MeshLib::getOrCreateMeshProperty<double>(
219 process_data_.element_porosity = MeshLib::getOrCreateMeshProperty<double>(
223 process_data_.element_liquid_density =
224 MeshLib::getOrCreateMeshProperty<double>(
228 process_data_.element_viscosity = MeshLib::getOrCreateMeshProperty<double>(
232 process_data_.element_stresses = MeshLib::getOrCreateMeshProperty<double>(
236 DisplacementDim>::RowsAtCompileTime);
238 process_data_.pressure_interpolated =
239 MeshLib::getOrCreateMeshProperty<double>(
242 process_data_.temperature_interpolated =
243 MeshLib::getOrCreateMeshProperty<double>(
244 const_cast<MeshLib::Mesh&
>(mesh),
"temperature_interpolated",
248 for (
auto const& ip_writer : _integration_point_writer)
251 auto const&
name = ip_writer->name();
256 auto const& _meshproperty =
260 if (_meshproperty.getMeshItemType() !=
266 auto const ip_meta_data =
270 if (ip_meta_data.n_components !=
271 _meshproperty.getNumberOfGlobalComponents())
274 "Different number of components in meta data ({:d}) than in "
275 "the integration point field data for '{:s}': {:d}.",
276 ip_meta_data.n_components,
name,
277 _meshproperty.getNumberOfGlobalComponents());
282 std::size_t position = 0;
283 for (
auto& local_asm : local_assemblers_)
285 std::size_t
const integration_points_read =
286 local_asm->setIPDataInitialConditions(
287 name, &_meshproperty[position],
288 ip_meta_data.integration_order);
289 if (integration_points_read == 0)
292 "No integration points read in the integration point "
293 "initial conditions set function.");
295 position += integration_points_read * ip_meta_data.n_components;
302 *_local_to_global_index_map);
305template <
int DisplacementDim>
307 DisplacementDim>::initializeBoundaryConditions()
309 const int process_id = 0;
310 initializeProcessBoundaryConditionsAndSourceTerms(
311 *_local_to_global_index_map, process_id);
314template <
int DisplacementDim>
318 int const process_id)
320 DBUG(
"SetInitialConditions ThermoRichardsMechanicsProcess.");
324 *_local_to_global_index_map, *x[process_id],
t, _use_monolithic_scheme,
328template <
int DisplacementDim>
330 const double ,
double const ,
331 std::vector<GlobalVector*>
const& ,
332 std::vector<GlobalVector*>
const& ,
int const ,
336 "The Picard method or the Newton-Raphson method with numerical "
337 "Jacobian is not implemented for ThermoRichardsMechanics with the full "
338 "monolithic coupling scheme");
341template <
int DisplacementDim>
344 std::vector<GlobalVector*>
const& x,
345 std::vector<GlobalVector*>
const& xdot,
350 std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
354 "Assemble the Jacobian of ThermoRichardsMechanics for the monolithic "
356 dof_tables.emplace_back(*_local_to_global_index_map);
363 process_id, M, K, b, Jac);
365 auto copyRhs = [&](
int const variable_id,
auto& output_vector)
368 output_vector, std::negate<double>());
371 copyRhs(0, *heat_flux_);
372 copyRhs(1, *hydraulic_flow_);
373 copyRhs(2, *nodal_forces_);
376template <
int DisplacementDim>
379 double const t,
double const dt,
380 const int process_id)
382 DBUG(
"PostTimestep ThermoRichardsMechanicsProcess.");
384 auto const dof_tables = getDOFTables(x.size());
388 &LocalAssemblerIF::postTimestep, local_assemblers_,
392template <
int DisplacementDim>
395 std::vector<GlobalVector*>
const& x,
397 int const process_id)
399 DBUG(
"Compute the secondary variables for ThermoRichardsMechanicsProcess.");
401 auto const dof_tables = getDOFTables(x.size());
406 &LocalAssemblerIF::computeSecondaryVariable, local_assemblers_,
410template <
int DisplacementDim>
412 DisplacementDim>::getDOFTableForExtrapolatorData()
const
414 const bool manage_storage =
false;
415 return std::make_tuple(local_to_global_index_map_single_component_.get(),
419template <
int DisplacementDim>
424 return *_local_to_global_index_map;
427template <
int DisplacementDim>
428std::vector<NumLib::LocalToGlobalIndexMap const*>
430 int const number_of_processes)
const
432 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
433 dof_tables.reserve(number_of_processes);
434 std::generate_n(std::back_inserter(dof_tables), number_of_processes,
435 [&]() {
return &getDOFTable(dof_tables.size()); });
void DBUG(char const *fmt, Args const &... args)
Global vector based on Eigen vector.
bool isAxiallySymmetric() const
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Properties & getProperties()
bool existsPropertyVector(std::string const &name) const
std::vector< std::size_t > const & getActiveElementIDs() const
std::vector< std::unique_ptr< IntegrationPointWriter > > _integration_point_writer
Handles configuration of several secondary variables from the project file.
Global assembler for the monolithic scheme of the non-isothermal Richards flow coupled with mechanics...
void assembleWithJacobianConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) override
void computeSecondaryVariableConcrete(double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id) override
bool isLinear() const override
void constructDofTable() override
ThermoRichardsMechanicsProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > &&process_variables, ThermoRichardsMechanicsProcessData< DisplacementDim > &&process_data, SecondaryVariableCollection &&secondary_variables, bool const use_monolithic_scheme)
MeshLib::PropertyVector< double > * nodal_forces_
MeshLib::PropertyVector< double > * heat_flux_
void assembleConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
MeshLib::PropertyVector< double > * hydraulic_flow_
MathLib::MatrixSpecifications getMatrixSpecifications(const int process_id) const override
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
void postTimestepConcreteProcess(std::vector< GlobalVector * > const &x, double const t, double const dt, const int process_id) override
std::vector< NumLib::LocalToGlobalIndexMap const * > getDOFTables(const int number_of_processes) const
void setInitialConditionsConcreteProcess(std::vector< GlobalVector * > &x, double const t, int const process_id) override
std::vector< std::unique_ptr< LocalAssemblerIF > > local_assemblers_
NumLib::LocalToGlobalIndexMap const & getDOFTable(const int process_id) const override
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< std::reference_wrapper< NumLib::LocalToGlobalIndexMap > > const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac)
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)
@ BY_LOCATION
Ordering data by spatial location.
void transformVariableFromGlobalVector(GlobalVector const &input_vector, int const variable_id, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, MeshLib::PropertyVector< double > &output_vector, Functor mapFunction)
IntegrationPointMetaData getIntegrationPointMetaData(MeshLib::Properties const &properties, std::string const &name)
void createLocalAssemblersHM(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
std::pair< std::vector< GlobalVector * >, std::vector< GlobalVector * > > setInitialConditions(double const t0, std::vector< std::unique_ptr< ProcessData > > const &per_process_data)
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)
virtual std::vector< double > getEpsilon() const =0
virtual std::vector< double > getTransportPorosity() const =0
virtual std::vector< double > getSwellingStress() const =0
virtual std::vector< double > getPorosity() const =0
virtual std::vector< double > getSaturation() const =0
virtual std::vector< double > getSigma() const =0