34template <
int DisplacementDim>
38 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
39 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
40 unsigned const integration_order,
41 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
45 bool const use_monolithic_scheme)
46 :
Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
47 integration_order, std::move(process_variables),
48 std::move(secondary_variables), use_monolithic_scheme),
50 _process_data(std::move(process_data))
55 _integration_point_writer, integration_order, local_assemblers_);
58template <
int DisplacementDim>
64template <
int DisplacementDim>
67 const int process_id)
const
71 if (_use_monolithic_scheme || process_id == deformation_process_id)
73 auto const& l = *_local_to_global_index_map;
74 return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
75 &l.getGhostIndices(), &this->_sparsity_pattern};
79 auto const& l = *_local_to_global_index_map_with_base_nodes;
80 return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
81 &l.getGhostIndices(), &_sparsity_pattern_with_linear_element};
84template <
int DisplacementDim>
88 _mesh_subset_all_nodes = std::make_unique<MeshLib::MeshSubset>(
89 _mesh, _mesh.getNodes(), _process_data.use_TaylorHood_elements);
92 _mesh_subset_base_nodes = std::make_unique<MeshLib::MeshSubset>(
93 _mesh, _base_nodes, _process_data.use_TaylorHood_elements);
97 std::vector<MeshLib::MeshSubset> all_mesh_subsets_single_component{
98 *_mesh_subset_all_nodes};
99 _local_to_global_index_map_single_component =
100 std::make_unique<NumLib::LocalToGlobalIndexMap>(
101 std::move(all_mesh_subsets_single_component),
105 if (_use_monolithic_scheme)
108 std::vector<MeshLib::MeshSubset> all_mesh_subsets{
109 *_mesh_subset_base_nodes};
112 all_mesh_subsets.push_back(*_mesh_subset_base_nodes);
115 all_mesh_subsets.push_back(*_mesh_subset_base_nodes);
119 std::back_inserter(all_mesh_subsets),
120 getProcessVariables(monolithic_process_id)[deformation_process_id]
122 .getNumberOfGlobalComponents(),
123 [&]() {
return *_mesh_subset_all_nodes; });
125 std::vector<int>
const vec_n_components{
126 n_gas_pressure_components, n_capillary_pressure_components,
127 n_temperature_components, n_displacement_components};
129 _local_to_global_index_map =
130 std::make_unique<NumLib::LocalToGlobalIndexMap>(
131 std::move(all_mesh_subsets), vec_n_components,
133 assert(_local_to_global_index_map);
137 OGS_FATAL(
"A Staggered version of TH2M is not implemented.");
141template <
int DisplacementDim>
145 unsigned const integration_order)
152 auto add_secondary_variable = [&](std::string
const& name,
153 int const num_components,
154 auto get_ip_values_function)
156 _secondary_variables.addSecondaryVariable(
160 std::move(get_ip_values_function)));
165 _secondary_variables, getExtrapolator(), local_assemblers_);
172 add_secondary_variable);
176 _process_data.solid_materials, local_assemblers_,
177 _integration_point_writer, integration_order);
179 _process_data.gas_pressure_interpolated =
181 const_cast<MeshLib::Mesh&
>(mesh),
"gas_pressure_interpolated",
184 _process_data.capillary_pressure_interpolated =
186 const_cast<MeshLib::Mesh&
>(mesh),
"capillary_pressure_interpolated",
189 _process_data.liquid_pressure_interpolated =
191 const_cast<MeshLib::Mesh&
>(mesh),
"liquid_pressure_interpolated",
194 _process_data.temperature_interpolated =
196 const_cast<MeshLib::Mesh&
>(mesh),
"temperature_interpolated",
205 local_assemblers_, *_local_to_global_index_map);
208template <
int DisplacementDim>
210 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
212 if (_use_monolithic_scheme)
214 initializeProcessBoundaryConditionsAndSourceTerms(
215 *_local_to_global_index_map, monolithic_process_id, media);
220 OGS_FATAL(
"A Staggered version of TH2M is not implemented.");
223template <
int DisplacementDim>
225 std::vector<GlobalVector*>& x,
double const t,
int const process_id)
232 DBUG(
"Set initial conditions of TH2MProcess.");
236 local_assemblers_, getDOFTables(x.size()), x, t, process_id);
239template <
int DisplacementDim>
241 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
242 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
245 DBUG(
"Assemble the equations for TH2M");
248 process_id, M, K, b);
251template <
int DisplacementDim>
253 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
254 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
257 if (!_use_monolithic_scheme)
259 OGS_FATAL(
"A Staggered version of TH2M is not implemented.");
263 t, dt, x, x_prev, process_id, b, Jac);
266template <
int DisplacementDim>
268 std::vector<GlobalVector*>
const& x,
double const t,
double const dt,
269 const int process_id)
271 DBUG(
"PreTimestep TH2MProcess.");
273 if (hasMechanicalProcess(process_id))
277 local_assemblers_, getActiveElementIDs(),
278 *_local_to_global_index_map, *x[process_id], t, dt);
284template <
int DisplacementDim>
286 std::vector<GlobalVector*>
const& x,
287 std::vector<GlobalVector*>
const& x_prev,
double const t,
double const dt,
288 const int process_id)
290 DBUG(
"PostTimestep TH2MProcess.");
294 local_assemblers_, getActiveElementIDs(), getDOFTables(x.size()), x,
295 x_prev, t, dt, process_id);
298template <
int DisplacementDim>
300 double const t,
double const dt, std::vector<GlobalVector*>
const& x,
308 DBUG(
"Compute the secondary variables for TH2MProcess.");
312 local_assemblers_, getActiveElementIDs(), getDOFTables(x.size()), t, dt,
313 x, x_prev, process_id);
318template <
int DisplacementDim>
319std::vector<std::vector<std::string>>
321 std::vector<std::reference_wrapper<MeshLib::Mesh>>
const& meshes)
323 INFO(
"TH2M process initializeSubmeshOutput().");
324 std::vector<std::vector<std::string>> residuum_names{
325 {
"GasMassFlowRate",
"LiquidMassFlowRate",
"HeatFlowRate",
329 meshes, residuum_names);
331 return residuum_names;
334template <
int DisplacementDim>
335std::tuple<NumLib::LocalToGlobalIndexMap*, bool>
338 const bool manage_storage =
false;
339 return std::make_tuple(_local_to_global_index_map_single_component.get(),
343template <
int DisplacementDim>
345 const int process_id)
const
347 if (hasMechanicalProcess(process_id))
349 return *_local_to_global_index_map;
353 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.
Properties & getProperties()
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 assembleWithJacobianConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalVector &b, GlobalMatrix &Jac) 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)
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 constructDofTable() override
NumLib::LocalToGlobalIndexMap const & getDOFTable(const int process_id) const override
std::vector< std::vector< std::string > > initializeAssemblyOnSubmeshes(std::vector< std::reference_wrapper< MeshLib::Mesh > > const &meshes) override
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)
@ BY_LOCATION
Ordering data by spatial location.
void addReflectedSecondaryVariables(ReflData const &reflection_data, SecondaryVariableCollection &secondary_variables, NumLib::Extrapolator &extrapolator, std::vector< std::unique_ptr< LocAsmIF > > const &local_assemblers)
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)
void createLocalAssemblers(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface< DisplacementDim > > > &local_assemblers, NumLib::IntegrationOrder const integration_order, bool const is_axially_symmetric, TH2MProcessData< DisplacementDim > &process_data)
void computeCellAverages(CellAverageData &cell_average_data, std::vector< std::unique_ptr< LAIntf > > 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()