33template <
int DisplacementDim>
37 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
38 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
39 unsigned const integration_order,
40 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
44 bool const use_monolithic_scheme)
45 :
Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
46 integration_order, std::move(process_variables),
47 std::move(secondary_variables), use_monolithic_scheme),
49 _process_data(std::move(process_data))
54 _integration_point_writer, integration_order, local_assemblers_);
57template <
int DisplacementDim>
63template <
int DisplacementDim>
66 const int process_id)
const
70 if (_use_monolithic_scheme || process_id == deformation_process_id)
72 auto const& l = *_local_to_global_index_map;
73 return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
74 &l.getGhostIndices(), &this->_sparsity_pattern};
78 auto const& l = *_local_to_global_index_map_with_base_nodes;
79 return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
80 &l.getGhostIndices(), &_sparsity_pattern_with_linear_element};
83template <
int DisplacementDim>
87 _mesh_subset_all_nodes = std::make_unique<MeshLib::MeshSubset>(
88 _mesh, _mesh.getNodes(), _process_data.use_TaylorHood_elements);
91 _mesh_subset_base_nodes = std::make_unique<MeshLib::MeshSubset>(
92 _mesh, _base_nodes, _process_data.use_TaylorHood_elements);
96 std::vector<MeshLib::MeshSubset> all_mesh_subsets_single_component{
97 *_mesh_subset_all_nodes};
98 _local_to_global_index_map_single_component =
99 std::make_unique<NumLib::LocalToGlobalIndexMap>(
100 std::move(all_mesh_subsets_single_component),
104 if (_use_monolithic_scheme)
107 std::vector<MeshLib::MeshSubset> all_mesh_subsets{
108 *_mesh_subset_base_nodes};
111 all_mesh_subsets.push_back(*_mesh_subset_base_nodes);
114 all_mesh_subsets.push_back(*_mesh_subset_base_nodes);
118 std::back_inserter(all_mesh_subsets),
119 getProcessVariables(monolithic_process_id)[deformation_process_id]
121 .getNumberOfGlobalComponents(),
122 [&]() {
return *_mesh_subset_all_nodes; });
124 std::vector<int>
const vec_n_components{
125 n_gas_pressure_components, n_capillary_pressure_components,
126 n_temperature_components, n_displacement_components};
128 _local_to_global_index_map =
129 std::make_unique<NumLib::LocalToGlobalIndexMap>(
130 std::move(all_mesh_subsets), vec_n_components,
132 assert(_local_to_global_index_map);
136 OGS_FATAL(
"A Staggered version of TH2M is not implemented.");
140template <
int DisplacementDim>
144 unsigned const integration_order)
146 createLocalAssemblers<DisplacementDim>(
151 auto add_secondary_variable = [&](std::string
const& name,
152 int const num_components,
153 auto get_ip_values_function)
155 _secondary_variables.addSecondaryVariable(
159 std::move(get_ip_values_function)));
162 ProcessLib::Reflection::addReflectedSecondaryVariables<DisplacementDim>(
164 _secondary_variables, getExtrapolator(), local_assemblers_);
166 add_secondary_variable(
169 add_secondary_variable(
172 add_secondary_variable(
175 DisplacementDim>::getIntPtDiffusionVelocityVapourGas);
176 add_secondary_variable(
179 DisplacementDim>::getIntPtDiffusionVelocityGasGas);
180 add_secondary_variable(
181 "diffusion_velocity_solute_liquid", mesh.
getDimension(),
183 DisplacementDim>::getIntPtDiffusionVelocitySoluteLiquid);
184 add_secondary_variable(
185 "diffusion_velocity_liquid_liquid", mesh.
getDimension(),
187 DisplacementDim>::getIntPtDiffusionVelocityLiquidLiquid);
189 add_secondary_variable(
198 add_secondary_variable);
202 _process_data.solid_materials, local_assemblers_,
203 _integration_point_writer, integration_order);
205 _process_data.element_saturation = MeshLib::getOrCreateMeshProperty<double>(
209 _process_data.gas_pressure_interpolated =
210 MeshLib::getOrCreateMeshProperty<double>(
211 const_cast<MeshLib::Mesh&
>(mesh),
"gas_pressure_interpolated",
214 _process_data.capillary_pressure_interpolated =
215 MeshLib::getOrCreateMeshProperty<double>(
216 const_cast<MeshLib::Mesh&
>(mesh),
"capillary_pressure_interpolated",
219 _process_data.liquid_pressure_interpolated =
220 MeshLib::getOrCreateMeshProperty<double>(
221 const_cast<MeshLib::Mesh&
>(mesh),
"liquid_pressure_interpolated",
224 _process_data.temperature_interpolated =
225 MeshLib::getOrCreateMeshProperty<double>(
226 const_cast<MeshLib::Mesh&
>(mesh),
"temperature_interpolated",
235 local_assemblers_, *_local_to_global_index_map);
238template <
int DisplacementDim>
240 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
242 if (_use_monolithic_scheme)
244 initializeProcessBoundaryConditionsAndSourceTerms(
245 *_local_to_global_index_map, monolithic_process_id, media);
250 OGS_FATAL(
"A Staggered version of TH2M is not implemented.");
253template <
int DisplacementDim>
255 std::vector<GlobalVector*>& x,
double const t,
int const process_id)
262 DBUG(
"Set initial conditions of TH2MProcess.");
266 local_assemblers_, getDOFTables(x.size()), x, t, process_id);
269template <
int DisplacementDim>
271 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
272 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
275 DBUG(
"Assemble the equations for TH2M");
278 process_id, M, K, b);
281template <
int DisplacementDim>
283 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
284 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
287 if (!_use_monolithic_scheme)
289 OGS_FATAL(
"A Staggered version of TH2M is not implemented.");
293 t, dt, x, x_prev, process_id, M, K, b, Jac);
296template <
int DisplacementDim>
298 std::vector<GlobalVector*>
const& x,
double const t,
double const dt,
299 const int process_id)
301 DBUG(
"PreTimestep TH2MProcess.");
303 if (hasMechanicalProcess(process_id))
306 getProcessVariables(process_id)[0];
311 *_local_to_global_index_map, *x[process_id], t, dt);
318template <
int DisplacementDim>
320 std::vector<GlobalVector*>
const& x,
321 std::vector<GlobalVector*>
const& x_prev,
double const t,
double const dt,
322 const int process_id)
324 DBUG(
"PostTimestep TH2MProcess.");
330 x_prev, t, dt, process_id);
333template <
int DisplacementDim>
335 double const t,
double const dt, std::vector<GlobalVector*>
const& x,
343 DBUG(
"Compute the secondary variables for TH2MProcess.");
349 dt, x, x_prev, process_id);
352template <
int DisplacementDim>
353std::vector<std::string>
355 std::vector<std::reference_wrapper<MeshLib::Mesh>>
const& meshes)
357 INFO(
"TH2M process initializeSubmeshOutput().");
358 const int process_id = 0;
359 std::vector<std::string> residuum_names{
360 "GasMassFlowRate",
"LiquidMassFlowRate",
"HeatFlowRate",
"NodalForces"};
363 process_id, meshes, residuum_names);
365 return residuum_names;
368template <
int DisplacementDim>
369std::tuple<NumLib::LocalToGlobalIndexMap*, bool>
372 const bool manage_storage =
false;
373 return std::make_tuple(_local_to_global_index_map_single_component.get(),
377template <
int DisplacementDim>
379 const int process_id)
const
381 if (hasMechanicalProcess(process_id))
383 return *_local_to_global_index_map;
387 return *_local_to_global_index_map_with_base_nodes;
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void DBUG(fmt::format_string< Args... > fmt, Args &&... 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()
std::vector< std::size_t > const & getActiveElementIDs() const
std::unique_ptr< ProcessLib::AbstractJacobianAssembler > _jacobian_assembler
Handles configuration of several secondary variables from the project file.
void postTimestepConcreteProcess(std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, const double t, const double dt, int const) override
bool isLinear() const override
std::tuple< NumLib::LocalToGlobalIndexMap *, bool > getDOFTableForExtrapolatorData() const override
void setInitialConditionsConcreteProcess(std::vector< GlobalVector * > &x, double const t, int const process_id) override
TH2MProcess(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, TH2MProcessData< DisplacementDim > &&process_data, SecondaryVariableCollection &&secondary_variables, bool const use_monolithic_scheme)
std::vector< std::string > initializeAssemblyOnSubmeshes(std::vector< std::reference_wrapper< MeshLib::Mesh > > const &meshes) override
void preTimestepConcreteProcess(std::vector< GlobalVector * > const &x, double const t, double const dt, const int process_id) override
MathLib::MatrixSpecifications getMatrixSpecifications(const int process_id) const override
void initializeBoundaryConditions(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media) override
void computeSecondaryVariableConcrete(double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, const int process_id) override
void assembleConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
void assembleWithJacobianConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) override
void constructDofTable() override
NumLib::LocalToGlobalIndexMap const & getDOFTable(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().
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)
@ BY_LOCATION
Ordering data by spatial location.
void addReflectedIntegrationPointWriters(ReflData const &reflection_data, std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter > > &integration_point_writers, unsigned const integration_order, std::vector< std::unique_ptr< LocAsmIF > > const &local_assemblers)
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
void setIPDataInitialConditions(std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter > > const &_integration_point_writer, MeshLib::Properties const &mesh_properties, LocalAssemblersVector &local_assemblers)
static void executeSelectedMemberOnDereferenced(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)
static auto getReflectionDataForOutput()