OGS
ThermalTwoPhaseFlowWithPPLocalAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <vector>
14
26
27namespace ProcessLib
28{
29namespace ThermalTwoPhaseFlowWithPP
30{
31template <typename NodalRowVectorType, typename GlobalDimNodalMatrixType,
32 typename NodalMatrixType>
34{
35 explicit IntegrationPointData(NodalRowVectorType const& N_,
36 GlobalDimNodalMatrixType const& dNdx_,
37 double const& integration_weight_,
38 NodalMatrixType const mass_operator_,
39 NodalMatrixType const diffusion_operator_)
40 : N(N_),
41 dNdx(dNdx_),
42 integration_weight(integration_weight_),
43 mass_operator(mass_operator_),
44 diffusion_operator(diffusion_operator_)
45 {
46 }
47 NodalRowVectorType const N;
48 GlobalDimNodalMatrixType const dNdx;
49 double const integration_weight;
50 NodalMatrixType const mass_operator;
51 NodalMatrixType const diffusion_operator;
52
54};
55const unsigned NUM_NODAL_DOF = 4;
56
60{
61public:
62 virtual std::vector<double> const& getIntPtSaturation(
63 const double t,
64 std::vector<GlobalVector*> const& x,
65 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
66 std::vector<double>& cache) const = 0;
67
68 virtual std::vector<double> const& getIntPtWettingPressure(
69 const double t,
70 std::vector<GlobalVector*> const& x,
71 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
72 std::vector<double>& cache) const = 0;
73
74 virtual std::vector<double> const& getIntPtLiquidMolFracContaminant(
75 const double t,
76 std::vector<GlobalVector*> const& x,
77 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
78 std::vector<double>& cache) const = 0;
79
80 virtual std::vector<double> const& getIntPtGasMolFracWater(
81 const double t,
82 std::vector<GlobalVector*> const& x,
83 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
84 std::vector<double>& cache) const = 0;
85
86 virtual std::vector<double> const& getIntPtGasMolFracContaminant(
87 const double t,
88 std::vector<GlobalVector*> const& x,
89 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
90 std::vector<double>& cache) const = 0;
91};
92
93template <typename ShapeFunction, int GlobalDim>
96{
99
101 ShapeMatricesType, ShapeFunction::NPOINTS, NUM_NODAL_DOF, GlobalDim>;
103
112
113public:
115 MeshLib::Element const& element,
116 std::size_t const /*local_matrix_size*/,
117 NumLib::GenericIntegrationMethod const& integration_method,
118 bool const is_axially_symmetric,
119 ThermalTwoPhaseFlowWithPPProcessData const& process_data)
120 : _element(element),
121 _integration_method(integration_method),
122 _process_data(process_data),
124 std::vector<double>(_integration_method.getNumberOfPoints())),
126 std::vector<double>(_integration_method.getNumberOfPoints())),
128 std::vector<double>(_integration_method.getNumberOfPoints())),
130 std::vector<double>(_integration_method.getNumberOfPoints())),
132 std::vector<double>(_integration_method.getNumberOfPoints()))
133 {
134 unsigned const n_integration_points =
136 _ip_data.reserve(n_integration_points);
137 auto const shape_matrices =
139 GlobalDim>(element, is_axially_symmetric,
141 for (unsigned ip = 0; ip < n_integration_points; ip++)
142 {
143 auto const& sm = shape_matrices[ip];
144 const double integration_factor = sm.integralMeasure * sm.detJ;
145 _ip_data.emplace_back(
146 sm.N, sm.dNdx,
147 sm.integralMeasure * sm.detJ *
149 sm.N.transpose() * sm.N * integration_factor *
151 sm.dNdx.transpose() * sm.dNdx * integration_factor *
153 }
154 }
155
156 void assemble(double const t, double const dt,
157 std::vector<double> const& local_x,
158 std::vector<double> const& local_x_prev,
159 std::vector<double>& local_M_data,
160 std::vector<double>& local_K_data,
161 std::vector<double>& local_b_data) override;
162
163 Eigen::Map<const Eigen::RowVectorXd> getShapeMatrix(
164 const unsigned integration_point) const override
165 {
166 auto const& N = _ip_data[integration_point].N;
167
168 // assumes N is stored contiguously in memory
169 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
170 }
171
172 std::vector<double> const& getIntPtSaturation(
173 const double /*t*/,
174 std::vector<GlobalVector*> const& /*x*/,
175 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
176 std::vector<double>& /*cache*/) const override
177 {
178 assert(!_saturation.empty());
179 return _saturation;
180 }
181
182 std::vector<double> const& getIntPtWettingPressure(
183 const double /*t*/,
184 std::vector<GlobalVector*> const& /*x*/,
185 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
186 std::vector<double>& /*cache*/) const override
187 {
188 assert(!_pressure_wetting.empty());
189 return _pressure_wetting;
190 }
191
192 std::vector<double> const& getIntPtLiquidMolFracContaminant(
193 const double /*t*/,
194 std::vector<GlobalVector*> const& /*x*/,
195 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
196 std::vector<double>& /*cache*/) const override
197 {
198 assert(!_liquid_molar_fraction_contaminant.empty());
200 }
201
202 std::vector<double> const& getIntPtGasMolFracWater(
203 const double /*t*/,
204 std::vector<GlobalVector*> const& /*x*/,
205 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
206 std::vector<double>& /*cache*/) const override
207 {
208 assert(!_gas_molar_fraction_water.empty());
210 }
211
212 std::vector<double> const& getIntPtGasMolFracContaminant(
213 const double /*t*/,
214 std::vector<GlobalVector*> const& /*x*/,
215 std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
216 std::vector<double>& /*cache*/) const override
217 {
218 assert(!_gas_molar_fraction_contaminant.empty());
220 }
221
222private:
224
226
228 std::vector<
231 Eigen::aligned_allocator<IntegrationPointData<
234
235 std::vector<double> _saturation;
236 std::vector<double> _pressure_wetting;
238 std::vector<double> _gas_molar_fraction_water;
240
241 static const int nonwet_pressure_matrix_index = 0;
242 static const int cap_pressure_matrix_index = ShapeFunction::NPOINTS;
243 static const int contaminant_matrix_index = 2 * ShapeFunction::NPOINTS;
244 static const int temperature_matrix_index = 3 * ShapeFunction::NPOINTS;
245
246 static const int nonwet_pressure_size = ShapeFunction::NPOINTS;
247 static const int cap_pressure_size = ShapeFunction::NPOINTS;
248 static const int contaminant_size = ShapeFunction::NPOINTS;
249 static const int temperature_size = ShapeFunction::NPOINTS;
250};
251
252} // namespace ThermalTwoPhaseFlowWithPP
253} // namespace ProcessLib
254
double getWeight() const
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
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
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)
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