OGS
ThermalTwoPhaseFlowWithPPLocalAssembler.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vector>
7
19
20namespace ProcessLib
21{
23{
24template <typename NodalRowVectorType, typename GlobalDimNodalMatrixType,
25 typename NodalMatrixType>
27{
28 explicit IntegrationPointData(NodalRowVectorType const& N_,
29 GlobalDimNodalMatrixType const& dNdx_,
30 double const& integration_weight_,
31 NodalMatrixType const mass_operator_,
32 NodalMatrixType const diffusion_operator_)
33 : N(N_),
34 dNdx(dNdx_),
35 integration_weight(integration_weight_),
36 mass_operator(mass_operator_),
37 diffusion_operator(diffusion_operator_)
38 {
39 }
40 NodalRowVectorType const N;
41 GlobalDimNodalMatrixType const dNdx;
42 double const integration_weight;
43 NodalMatrixType const mass_operator;
44 NodalMatrixType const diffusion_operator;
45
47};
48const unsigned NUM_NODAL_DOF = 4;
49
53{
54public:
55 virtual std::vector<double> const& getIntPtSaturation(
56 const double t,
57 std::vector<GlobalVector*> const& x,
58 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
59 std::vector<double>& cache) const = 0;
60
61 virtual std::vector<double> const& getIntPtWettingPressure(
62 const double t,
63 std::vector<GlobalVector*> const& x,
64 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
65 std::vector<double>& cache) const = 0;
66
67 virtual std::vector<double> const& getIntPtLiquidMolFracContaminant(
68 const double t,
69 std::vector<GlobalVector*> const& x,
70 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
71 std::vector<double>& cache) const = 0;
72
73 virtual std::vector<double> const& getIntPtGasMolFracWater(
74 const double t,
75 std::vector<GlobalVector*> const& x,
76 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
77 std::vector<double>& cache) const = 0;
78
79 virtual std::vector<double> const& getIntPtGasMolFracContaminant(
80 const double t,
81 std::vector<GlobalVector*> const& x,
82 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
83 std::vector<double>& cache) const = 0;
84};
85
86template <typename ShapeFunction, int GlobalDim>
89{
92
94 ShapeMatricesType, ShapeFunction::NPOINTS, NUM_NODAL_DOF, GlobalDim>;
96
105
106public:
108 MeshLib::Element const& element,
109 std::size_t const /*local_matrix_size*/,
110 NumLib::GenericIntegrationMethod const& integration_method,
111 bool const is_axially_symmetric,
112 ThermalTwoPhaseFlowWithPPProcessData const& process_data)
113 : _element(element),
114 _integration_method(integration_method),
115 _process_data(process_data),
117 std::vector<double>(_integration_method.getNumberOfPoints())),
119 std::vector<double>(_integration_method.getNumberOfPoints())),
121 std::vector<double>(_integration_method.getNumberOfPoints())),
123 std::vector<double>(_integration_method.getNumberOfPoints())),
125 std::vector<double>(_integration_method.getNumberOfPoints()))
126 {
127 unsigned const n_integration_points =
128 _integration_method.getNumberOfPoints();
129 _ip_data.reserve(n_integration_points);
130 auto const shape_matrices =
132 GlobalDim>(element, is_axially_symmetric,
134 for (unsigned ip = 0; ip < n_integration_points; ip++)
135 {
136 auto const& sm = shape_matrices[ip];
137 const double integration_factor = sm.integralMeasure * sm.detJ;
138 _ip_data.emplace_back(
139 sm.N, sm.dNdx,
140 sm.integralMeasure * sm.detJ *
141 _integration_method.getWeightedPoint(ip).getWeight(),
142 sm.N.transpose() * sm.N * integration_factor *
143 _integration_method.getWeightedPoint(ip).getWeight(),
144 sm.dNdx.transpose() * sm.dNdx * integration_factor *
145 _integration_method.getWeightedPoint(ip).getWeight());
146 }
147 }
148
149 void assemble(double const t, double const dt,
150 std::vector<double> const& local_x,
151 std::vector<double> const& local_x_prev,
152 std::vector<double>& local_M_data,
153 std::vector<double>& local_K_data,
154 std::vector<double>& local_b_data) override;
155
156 Eigen::Map<const Eigen::RowVectorXd> getShapeMatrix(
157 const unsigned integration_point) const override
158 {
159 auto const& N = _ip_data[integration_point].N;
160
161 // assumes N is stored contiguously in memory
162 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
163 }
164
165 std::vector<double> const& getIntPtSaturation(
166 const double /*t*/,
167 std::vector<GlobalVector*> const& /*x*/,
168 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
169 std::vector<double>& /*cache*/) const override
170 {
171 assert(!_saturation.empty());
172 return _saturation;
173 }
174
175 std::vector<double> const& getIntPtWettingPressure(
176 const double /*t*/,
177 std::vector<GlobalVector*> const& /*x*/,
178 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
179 std::vector<double>& /*cache*/) const override
180 {
181 assert(!_pressure_wetting.empty());
182 return _pressure_wetting;
183 }
184
185 std::vector<double> const& getIntPtLiquidMolFracContaminant(
186 const double /*t*/,
187 std::vector<GlobalVector*> const& /*x*/,
188 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
189 std::vector<double>& /*cache*/) const override
190 {
191 assert(!_liquid_molar_fraction_contaminant.empty());
193 }
194
195 std::vector<double> const& getIntPtGasMolFracWater(
196 const double /*t*/,
197 std::vector<GlobalVector*> const& /*x*/,
198 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
199 std::vector<double>& /*cache*/) const override
200 {
201 assert(!_gas_molar_fraction_water.empty());
203 }
204
205 std::vector<double> const& getIntPtGasMolFracContaminant(
206 const double /*t*/,
207 std::vector<GlobalVector*> const& /*x*/,
208 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
209 std::vector<double>& /*cache*/) const override
210 {
211 assert(!_gas_molar_fraction_contaminant.empty());
213 }
214
215private:
217
219
221 std::vector<
224 Eigen::aligned_allocator<IntegrationPointData<
227
228 std::vector<double> _saturation;
229 std::vector<double> _pressure_wetting;
231 std::vector<double> _gas_molar_fraction_water;
233
234 static const int nonwet_pressure_matrix_index = 0;
235 static const int cap_pressure_matrix_index = ShapeFunction::NPOINTS;
236 static const int contaminant_matrix_index = 2 * ShapeFunction::NPOINTS;
237 static const int temperature_matrix_index = 3 * ShapeFunction::NPOINTS;
238
239 static const int nonwet_pressure_size = ShapeFunction::NPOINTS;
240 static const int cap_pressure_size = ShapeFunction::NPOINTS;
241 static const int contaminant_size = ShapeFunction::NPOINTS;
242 static const int temperature_size = ShapeFunction::NPOINTS;
243};
244
245} // namespace ThermalTwoPhaseFlowWithPP
246} // namespace ProcessLib
247
EigenFixedShapeMatrixPolicy< ShapeFunction, GlobalDim > ShapeMatrixPolicyType
virtual std::vector< double > const & getIntPtGasMolFracContaminant(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtLiquidMolFracContaminant(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtWettingPressure(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSaturation(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtGasMolFracWater(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix(const unsigned integration_point) const override
Provides the shape matrix at the given integration point.
void assemble(double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data) override
std::vector< double > const & getIntPtSaturation(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &) const override
ThermalTwoPhaseFlowWithPPLocalAssembler(MeshLib::Element const &element, std::size_t const, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, ThermalTwoPhaseFlowWithPPProcessData const &process_data)
std::vector< double > const & getIntPtWettingPressure(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &) const override
std::vector< IntegrationPointData< NodalRowVectorType, GlobalDimNodalMatrixType, NodalMatrixType >, Eigen::aligned_allocator< IntegrationPointData< NodalRowVectorType, GlobalDimNodalMatrixType, NodalMatrixType > > > _ip_data
std::vector< double > const & getIntPtGasMolFracWater(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &) const override
std::vector< double > const & getIntPtLiquidMolFracContaminant(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &) const override
ProcessLib::LocalAssemblerTraits< ShapeMatricesType, ShapeFunction::NPOINTS, NUM_NODAL_DOF, GlobalDim > LocalAssemblerTraits
std::vector< double > const & getIntPtGasMolFracContaminant(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &) const override
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, IntegrationMethod const &integration_method)
detail::LocalAssemblerTraitsFixed< ShpPol, NNodes, NodalDOF, Dim > LocalAssemblerTraits
NumLib::ShapeMatrices< NodalRowVectorType, DimNodalMatrixType, DimMatrixType, GlobalDimNodalMatrixType > ShapeMatrices
MatrixType< ShapeFunction::NPOINTS, ShapeFunction::NPOINTS > NodalMatrixType
MatrixType< GlobalDim, ShapeFunction::NPOINTS > GlobalDimNodalMatrixType
MatrixType< GlobalDim, GlobalDim > GlobalDimMatrixType
VectorType< GlobalDim > GlobalDimVectorType
VectorType< ShapeFunction::NPOINTS > NodalVectorType
RowVectorType< ShapeFunction::NPOINTS > NodalRowVectorType
IntegrationPointData(NodalRowVectorType const &N_, GlobalDimNodalMatrixType const &dNdx_, double const &integration_weight_, NodalMatrixType const mass_operator_, NodalMatrixType const diffusion_operator_)
Matrix< NNodes *NodalDOF, NNodes *NodalDOF > LocalMatrix