OGS
TwoPhaseFlowWithPPLocalAssembler.h
Go to the documentation of this file.
1 
11 #pragma once
12 
13 #include <vector>
14 
20 #include "ParameterLib/Parameter.h"
24 
25 namespace ProcessLib
26 {
27 namespace TwoPhaseFlowWithPP
28 {
29 template <typename NodalRowVectorType, typename GlobalDimNodalMatrixType,
30  typename NodalMatrixType>
32 {
33  explicit IntegrationPointData(NodalRowVectorType N_,
34  GlobalDimNodalMatrixType dNdx_,
35  double const& integration_weight_,
36  NodalMatrixType const massOperator_)
37  : N(std::move(N_)),
38  dNdx(std::move(dNdx_)),
39  integration_weight(integration_weight_),
40  massOperator(massOperator_)
41 
42  {
43  }
44  NodalRowVectorType const N;
45  GlobalDimNodalMatrixType const dNdx;
46  const double integration_weight;
47  NodalMatrixType const massOperator;
48 
50 };
51 const unsigned NUM_NODAL_DOF = 2;
52 
56 {
57 public:
58  virtual std::vector<double> const& getIntPtSaturation(
59  const double t,
60  std::vector<GlobalVector*> const& x,
61  std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
62  std::vector<double>& cache) const = 0;
63 
64  virtual std::vector<double> const& getIntPtWetPressure(
65  const double t,
66  std::vector<GlobalVector*> const& x,
67  std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
68  std::vector<double>& cache) const = 0;
69 };
70 
71 template <typename ShapeFunction, typename IntegrationMethod, int GlobalDim>
74 {
77 
79  ShapeMatricesType, ShapeFunction::NPOINTS, NUM_NODAL_DOF, GlobalDim>;
81 
90 
91 public:
93  MeshLib::Element const& element,
94  std::size_t const /*local_matrix_size*/,
95  bool const is_axially_symmetric,
96  unsigned const integration_order,
97  TwoPhaseFlowWithPPProcessData const& process_data)
98  : _element(element),
99  _integration_method(integration_order),
100  _process_data(process_data),
101  _saturation(
102  std::vector<double>(_integration_method.getNumberOfPoints())),
104  std::vector<double>(_integration_method.getNumberOfPoints()))
105  {
106  unsigned const n_integration_points =
107  _integration_method.getNumberOfPoints();
108  _ip_data.reserve(n_integration_points);
109  auto const shape_matrices =
111  GlobalDim>(element, is_axially_symmetric,
113  for (unsigned ip = 0; ip < n_integration_points; ip++)
114  {
115  auto const& sm = shape_matrices[ip];
116  _ip_data.emplace_back(
117  sm.N, sm.dNdx,
118  sm.integralMeasure * sm.detJ *
119  _integration_method.getWeightedPoint(ip).getWeight(),
120  sm.N.transpose() * sm.N * sm.integralMeasure * sm.detJ *
121  _integration_method.getWeightedPoint(ip).getWeight());
122  }
123  }
124 
125  void assemble(double const t, double const dt,
126  std::vector<double> const& local_x,
127  std::vector<double> const& local_xdot,
128  std::vector<double>& local_M_data,
129  std::vector<double>& local_K_data,
130  std::vector<double>& local_b_data) override;
131 
132  Eigen::Map<const Eigen::RowVectorXd> getShapeMatrix(
133  const unsigned integration_point) const override
134  {
135  auto const& N = _ip_data[integration_point].N;
136 
137  // assumes N is stored contiguously in memory
138  return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
139  }
140 
141  std::vector<double> const& getIntPtSaturation(
142  const double /*t*/,
143  std::vector<GlobalVector*> const& /*x*/,
144  std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
145  std::vector<double>& /*cache*/) const override
146  {
147  assert(!_saturation.empty());
148  return _saturation;
149  }
150 
151  std::vector<double> const& getIntPtWetPressure(
152  const double /*t*/,
153  std::vector<GlobalVector*> const& /*x*/,
154  std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
155  std::vector<double>& /*cache*/) const override
156  {
157  assert(!_pressure_wet.empty());
158  return _pressure_wet;
159  }
160 
161 private:
163 
164  IntegrationMethod const _integration_method;
165 
167  std::vector<
170  Eigen::aligned_allocator<IntegrationPointData<
173 
174  // output vector for wetting phase saturation with
175  // respect to each integration point
176  std::vector<double> _saturation;
177  // output vector for wetting phase pressure with respect
178  // to each integration point
179  std::vector<double> _pressure_wet;
180  static const int nonwet_pressure_coeff_index = 0;
181  static const int cap_pressure_coeff_index = 1;
182 
183  static const int nonwet_pressure_matrix_index = 0;
184  static const int cap_pressure_matrix_index = ShapeFunction::NPOINTS;
185 
186  static const int nonwet_pressure_size = ShapeFunction::NPOINTS;
187  static const int cap_pressure_size = ShapeFunction::NPOINTS;
188 };
189 
190 } // namespace TwoPhaseFlowWithPP
191 } // namespace ProcessLib
192 
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 & getIntPtWetPressure(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
std::vector< double > const & getIntPtSaturation(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &) const override
TwoPhaseFlowWithPPLocalAssembler(MeshLib::Element const &element, std::size_t const, bool const is_axially_symmetric, unsigned const integration_order, TwoPhaseFlowWithPPProcessData const &process_data)
std::vector< IntegrationPointData< NodalRowVectorType, GlobalDimNodalMatrixType, NodalMatrixType >, Eigen::aligned_allocator< IntegrationPointData< NodalRowVectorType, GlobalDimNodalMatrixType, NodalMatrixType > > > _ip_data
std::vector< double > const & getIntPtWetPressure(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &) const override
void assemble(double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_xdot, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data) override
typename ShapeMatricesType::GlobalDimNodalMatrixType GlobalDimNodalMatrixType
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix(const unsigned integration_point) const override
Provides the shape matrix at the given integration point.
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)
MatrixType< ShapeFunction::NPOINTS, ShapeFunction::NPOINTS > NodalMatrixType
NumLib::ShapeMatrices< NodalRowVectorType, DimNodalMatrixType, DimMatrixType, GlobalDimNodalMatrixType > ShapeMatrices
MatrixType< GlobalDim, ShapeFunction::NPOINTS > GlobalDimNodalMatrixType
MatrixType< GlobalDim, GlobalDim > GlobalDimMatrixType
VectorType< GlobalDim > GlobalDimVectorType
VectorType< ShapeFunction::NPOINTS > NodalVectorType
RowVectorType< ShapeFunction::NPOINTS > NodalRowVectorType
IntegrationPointData(NodalRowVectorType N_, GlobalDimNodalMatrixType dNdx_, double const &integration_weight_, NodalMatrixType const massOperator_)
Matrix< NNodes *NodalDOF, NNodes *NodalDOF > LocalMatrix