OGS 6.2.0-97-g4a610c866
SmallDeformationLocalAssemblerMatrix.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <vector>
13 
18 
20 
22 #include "SecondaryData.h"
24 
25 namespace ProcessLib
26 {
27 namespace LIE
28 {
29 namespace SmallDeformation
30 {
31 template <typename ShapeFunction, typename IntegrationMethod,
32  int DisplacementDim>
35 {
36 public:
37  using ShapeMatricesType =
43 
48 
50  SmallDeformationLocalAssemblerMatrix const&) = delete;
53 
55  MeshLib::Element const& e,
56  std::size_t const local_matrix_size,
57  bool is_axially_symmetric,
58  unsigned const integration_order,
60 
61  void assemble(double const /*t*/, std::vector<double> const& /*local_x*/,
62  std::vector<double>& /*local_M_data*/,
63  std::vector<double>& /*local_K_data*/,
64  std::vector<double>& /*local_b_data*/) override
65  {
66  OGS_FATAL(
67  "SmallDeformationLocalAssembler: assembly without jacobian is not "
68  "implemented.");
69  }
70 
71  void assembleWithJacobian(double const t,
72  std::vector<double> const& local_x,
73  std::vector<double> const& /*local_xdot*/,
74  const double /*dxdot_dx*/, const double /*dx_dx*/,
75  std::vector<double>& /*local_M_data*/,
76  std::vector<double>& /*local_K_data*/,
77  std::vector<double>& local_b_data,
78  std::vector<double>& local_Jac_data) override;
79 
80  void preTimestepConcrete(std::vector<double> const& /*local_x*/,
81  double const /*t*/,
82  double const /*delta_t*/) override
83  {
84  unsigned const n_integration_points =
85  _integration_method.getNumberOfPoints();
86 
87  for (unsigned ip = 0; ip < n_integration_points; ip++)
88  {
89  _ip_data[ip].pushBackState();
90  }
91  }
92 
94  double const t, Eigen::VectorXd const& local_x) override;
95 
96  Eigen::Map<const Eigen::RowVectorXd> getShapeMatrix(
97  const unsigned integration_point) const override
98  {
99  auto const& N = _secondary_data.N[integration_point];
100 
101  // assumes N is stored contiguously in memory
102  return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
103  }
104 
105  std::vector<double> const& getIntPtSigmaXX(
106  const double /*t*/,
107  GlobalVector const& /*current_solution*/,
108  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
109  std::vector<double>& cache) const override
110  {
111  return getIntPtSigma(cache, 0);
112  }
113 
114  std::vector<double> const& getIntPtSigmaYY(
115  const double /*t*/,
116  GlobalVector const& /*current_solution*/,
117  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
118  std::vector<double>& cache) const override
119  {
120  return getIntPtSigma(cache, 1);
121  }
122 
123  std::vector<double> const& getIntPtSigmaZZ(
124  const double /*t*/,
125  GlobalVector const& /*current_solution*/,
126  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
127  std::vector<double>& cache) const override
128  {
129  return getIntPtSigma(cache, 2);
130  }
131 
132  std::vector<double> const& getIntPtSigmaXY(
133  const double /*t*/,
134  GlobalVector const& /*current_solution*/,
135  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
136  std::vector<double>& cache) const override
137  {
138  return getIntPtSigma(cache, 3);
139  }
140 
141  std::vector<double> const& getIntPtSigmaXZ(
142  const double /*t*/,
143  GlobalVector const& /*current_solution*/,
144  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
145  std::vector<double>& cache) const override
146  {
147  assert(DisplacementDim == 3);
148  return getIntPtSigma(cache, 4);
149  }
150 
151  std::vector<double> const& getIntPtSigmaYZ(
152  const double /*t*/,
153  GlobalVector const& /*current_solution*/,
154  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
155  std::vector<double>& cache) const override
156  {
157  assert(DisplacementDim == 3);
158  return getIntPtSigma(cache, 5);
159  }
160 
161  std::vector<double> const& getIntPtEpsilonXX(
162  const double /*t*/,
163  GlobalVector const& /*current_solution*/,
164  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
165  std::vector<double>& cache) const override
166  {
167  return getIntPtEpsilon(cache, 0);
168  }
169 
170  std::vector<double> const& getIntPtEpsilonYY(
171  const double /*t*/,
172  GlobalVector const& /*current_solution*/,
173  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
174  std::vector<double>& cache) const override
175  {
176  return getIntPtEpsilon(cache, 1);
177  }
178 
179  std::vector<double> const& getIntPtEpsilonZZ(
180  const double /*t*/,
181  GlobalVector const& /*current_solution*/,
182  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
183  std::vector<double>& cache) const override
184  {
185  return getIntPtEpsilon(cache, 2);
186  }
187 
188  std::vector<double> const& getIntPtEpsilonXY(
189  const double /*t*/,
190  GlobalVector const& /*current_solution*/,
191  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
192  std::vector<double>& cache) const override
193  {
194  return getIntPtEpsilon(cache, 3);
195  }
196 
197  std::vector<double> const& getIntPtEpsilonXZ(
198  const double /*t*/,
199  GlobalVector const& /*current_solution*/,
200  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
201  std::vector<double>& cache) const override
202  {
203  assert(DisplacementDim == 3);
204  return getIntPtEpsilon(cache, 4);
205  }
206 
207  std::vector<double> const& getIntPtEpsilonYZ(
208  const double /*t*/,
209  GlobalVector const& /*current_solution*/,
210  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
211  std::vector<double>& cache) const override
212  {
213  assert(DisplacementDim == 3);
214  return getIntPtEpsilon(cache, 5);
215  }
216 
217 private:
218  std::vector<double> const& getIntPtSigma(std::vector<double>& cache,
219  std::size_t const component) const
220  {
221  cache.clear();
222  cache.reserve(_ip_data.size());
223 
224  for (auto const& ip_data : _ip_data)
225  {
226  if (component < 3)
227  { // xx, yy, zz components
228  cache.push_back(ip_data._sigma[component]);
229  }
230  else
231  { // mixed xy, yz, xz components
232  cache.push_back(ip_data._sigma[component] / std::sqrt(2));
233  }
234  }
235 
236  return cache;
237  }
238 
239  std::vector<double> const& getIntPtEpsilon(
240  std::vector<double>& cache, std::size_t const component) const
241  {
242  cache.clear();
243  cache.reserve(_ip_data.size());
244 
245  for (auto const& ip_data : _ip_data)
246  {
247  if (component < 3)
248  { // xx, yy, zz components
249  cache.push_back(ip_data._eps[component]);
250  }
251  else
252  { // mixed xy, yz, xz components
253  cache.push_back(ip_data._eps[component] / std::sqrt(2));
254  }
255  }
256 
257  return cache;
258  }
259 
261 
263  DisplacementDim>,
264  Eigen::aligned_allocator<IntegrationPointDataMatrix<
265  ShapeMatricesType, BMatricesType, DisplacementDim>>>
267 
268  IntegrationMethod _integration_method;
272 };
273 
274 } // namespace SmallDeformation
275 } // namespace LIE
276 } // namespace ProcessLib
277 
std::vector< double > const & getIntPtEpsilonXY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
std::vector< ShapeMatrixType, Eigen::aligned_allocator< ShapeMatrixType > > N
Definition: SecondaryData.h:29
MatrixType< _number_of_dof, _number_of_dof > StiffnessMatrixType
Definition: BMatrixPolicy.h:40
std::vector< double > const & getIntPtSigmaXX(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
VectorType< _number_of_dof > NodalForceVectorType
Rhs residual.
Definition: BMatrixPolicy.h:43
std::vector< double > const & getIntPtSigmaXY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
void computeSecondaryVariableConcreteWithVector(double const t, Eigen::VectorXd const &local_x) override
std::vector< double > const & getIntPtEpsilonXX(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
std::vector< double > const & getIntPtEpsilonZZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
std::vector< IntegrationPointDataMatrix< ShapeMatricesType, BMatricesType, DisplacementDim >, Eigen::aligned_allocator< IntegrationPointDataMatrix< ShapeMatricesType, BMatricesType, DisplacementDim > > > _ip_data
std::vector< double > const & getIntPtSigmaXZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
NumLib::ShapeMatrices< NodalRowVectorType, DimNodalMatrixType, DimMatrixType, GlobalDimNodalMatrixType > ShapeMatrices
void assemble(double const, std::vector< double > const &, std::vector< double > &, std::vector< double > &, std::vector< double > &) override
void preTimestepConcrete(std::vector< double > const &, double const, double const) override
std::vector< double > const & getIntPtEpsilonYZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
std::vector< double > const & getIntPtEpsilonYY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
VectorType< ShapeFunction::NPOINTS > NodalVectorType
std::vector< double > const & getIntPtSigmaYZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
void assembleWithJacobian(double const t, std::vector< double > const &local_x, std::vector< double > const &, const double, const double, std::vector< double > &, std::vector< double > &, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data) override
std::vector< double > const & getIntPtEpsilon(std::vector< double > &cache, std::size_t const component) const
SmallDeformationLocalAssemblerMatrix(SmallDeformationLocalAssemblerMatrix const &)=delete
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
MatrixType< ShapeFunction::NPOINTS, ShapeFunction::NPOINTS > NodalMatrixType
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix(const unsigned integration_point) const override
Provides the shape matrix at the given integration point.
std::vector< double > const & getIntPtSigma(std::vector< double > &cache, std::size_t const component) const
std::vector< double > const & getIntPtSigmaYY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
std::vector< double > const & getIntPtSigmaZZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override
std::vector< double > const & getIntPtEpsilonXZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const override