OGS 6.1.0-1699-ge946d4c5f
SmallDeformationLocalAssemblerInterface.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <utility>
13 #include <vector>
14 
15 #include "BaseLib/Error.h"
16 
19 
20 namespace ProcessLib
21 {
22 namespace LIE
23 {
24 namespace SmallDeformation
25 {
29 {
30 public:
33  std::size_t n_local_size, std::vector<unsigned> dofIndex_to_localIndex)
34  : _dofIndex_to_localIndex(std::move(dofIndex_to_localIndex))
35  {
36  _local_u.resize(n_local_size);
37  _local_b.resize(_local_u.size());
38  _local_J.resize(_local_u.size(), _local_u.size());
39  }
40 
41  void assembleWithJacobian(double const t,
42  std::vector<double> const& local_x_,
43  std::vector<double> const& /*local_xdot*/,
44  const double /*dxdot_dx*/, const double /*dx_dx*/,
45  std::vector<double>& /*local_M_data*/,
46  std::vector<double>& /*local_K_data*/,
47  std::vector<double>& local_b_data,
48  std::vector<double>& local_Jac_data) override
49  {
50  auto const local_dof_size = local_x_.size();
51 
52  _local_u.setZero();
53  for (unsigned i = 0; i < local_dof_size; i++)
54  {
55  _local_u[_dofIndex_to_localIndex[i]] = local_x_[i];
56  }
57  _local_b.setZero();
58  _local_J.setZero();
59 
61 
62  local_b_data.resize(local_dof_size);
63  for (unsigned i = 0; i < local_dof_size; i++)
64  {
65  local_b_data[i] = _local_b[_dofIndex_to_localIndex[i]];
66  }
67 
68  local_Jac_data.resize(local_dof_size * local_dof_size);
69  for (unsigned i = 0; i < local_dof_size; i++)
70  {
71  for (unsigned j = 0; j < local_dof_size; j++)
72  {
73  local_Jac_data[i * local_dof_size + j] = _local_J(
75  }
76  }
77  }
78 
79  virtual void assembleWithJacobian(double const t,
80  Eigen::VectorXd const& local_u,
81  Eigen::VectorXd& local_b,
82  Eigen::MatrixXd& local_J)
83  {
84  (void)t;
85  (void)local_u;
86  (void)local_b;
87  (void)local_J;
88  OGS_FATAL(
89  "SmallDeformationLocalAssemblerInterface::assembleWithJacobian() "
90  "is not implemented");
91  }
92 
94  const double t, std::vector<double> const& local_x_) override
95  {
96  if (!_dofIndex_to_localIndex.empty())
97  {
98  _local_u.setZero();
99  for (std::size_t i = 0; i < local_x_.size(); i++)
100  {
101  _local_u[_dofIndex_to_localIndex[i]] = local_x_[i];
102  }
103  }
104 
106  }
107 
108  virtual 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 = 0;
113 
114  virtual 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 = 0;
119 
120  virtual std::vector<double> const& getIntPtSigmaZZ(
121  const double /*t*/,
122  GlobalVector const& /*current_solution*/,
123  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
124  std::vector<double>& cache) const = 0;
125 
126  virtual std::vector<double> const& getIntPtSigmaXY(
127  const double /*t*/,
128  GlobalVector const& /*current_solution*/,
129  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
130  std::vector<double>& cache) const = 0;
131 
132  virtual std::vector<double> const& getIntPtSigmaXZ(
133  const double /*t*/,
134  GlobalVector const& /*current_solution*/,
135  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
136  std::vector<double>& cache) const = 0;
137 
138  virtual std::vector<double> const& getIntPtSigmaYZ(
139  const double /*t*/,
140  GlobalVector const& /*current_solution*/,
141  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
142  std::vector<double>& cache) const = 0;
143 
144  virtual std::vector<double> const& getIntPtEpsilonXX(
145  const double /*t*/,
146  GlobalVector const& /*current_solution*/,
147  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
148  std::vector<double>& cache) const = 0;
149 
150  virtual std::vector<double> const& getIntPtEpsilonYY(
151  const double /*t*/,
152  GlobalVector const& /*current_solution*/,
153  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
154  std::vector<double>& cache) const = 0;
155 
156  virtual std::vector<double> const& getIntPtEpsilonZZ(
157  const double /*t*/,
158  GlobalVector const& /*current_solution*/,
159  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
160  std::vector<double>& cache) const = 0;
161 
162  virtual std::vector<double> const& getIntPtEpsilonXY(
163  const double /*t*/,
164  GlobalVector const& /*current_solution*/,
165  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
166  std::vector<double>& cache) const = 0;
167 
168  virtual std::vector<double> const& getIntPtEpsilonXZ(
169  const double /*t*/,
170  GlobalVector const& /*current_solution*/,
171  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
172  std::vector<double>& cache) const = 0;
173 
174  virtual std::vector<double> const& getIntPtEpsilonYZ(
175  const double /*t*/,
176  GlobalVector const& /*current_solution*/,
177  NumLib::LocalToGlobalIndexMap const& /*dof_table*/,
178  std::vector<double>& cache) const = 0;
179 
180 protected:
182  double const t, Eigen::VectorXd const& local_u) = 0;
183 
184 private:
185  Eigen::VectorXd _local_u;
186  Eigen::VectorXd _local_b;
187  Eigen::MatrixXd _local_J;
188  std::vector<unsigned> const _dofIndex_to_localIndex;
189 };
190 
191 } // namespace SmallDeformation
192 } // namespace LIE
193 } // namespace ProcessLib
virtual std::vector< double > const & getIntPtSigmaZZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSigmaYY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtEpsilonYZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtEpsilonYY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtEpsilonXX(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
SmallDeformationLocalAssemblerInterface(std::size_t n_local_size, std::vector< unsigned > dofIndex_to_localIndex)
virtual std::vector< double > const & getIntPtSigmaXY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSigmaYZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSigmaXZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
void computeSecondaryVariableConcrete(const double t, std::vector< double > const &local_x_) override
virtual std::vector< double > const & getIntPtEpsilonZZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtEpsilonXZ(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSigmaXX(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual void assembleWithJacobian(double const t, Eigen::VectorXd const &local_u, Eigen::VectorXd &local_b, Eigen::MatrixXd &local_J)
virtual std::vector< double > const & getIntPtEpsilonXY(const double, GlobalVector const &, NumLib::LocalToGlobalIndexMap const &, std::vector< double > &cache) const =0
virtual void computeSecondaryVariableConcreteWithVector(double const t, Eigen::VectorXd const &local_u)=0
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
#define OGS_FATAL(fmt,...)
Definition: Error.h:71