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