OGS
SmallDeformationLocalAssemblerInterface.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <utility>
14#include <vector>
15
16#include "BaseLib/Error.h"
19
20namespace ProcessLib
21{
22namespace LIE
23{
24namespace SmallDeformation
25{
29{
30public:
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, double const dt,
42 std::vector<double> const& local_x_,
43 std::vector<double> const& /*local_x_prev*/,
44 std::vector<double>& local_b_data,
45 std::vector<double>& local_Jac_data) override
46 {
47 auto const local_dof_size = local_x_.size();
48
49 _local_u.setZero();
50 for (unsigned i = 0; i < local_dof_size; i++)
51 {
52 _local_u[_dofIndex_to_localIndex[i]] = local_x_[i];
53 }
54 _local_b.setZero();
55 _local_J.setZero();
56
58
59 local_b_data.resize(local_dof_size);
60 for (unsigned i = 0; i < local_dof_size; i++)
61 {
62 local_b_data[i] = _local_b[_dofIndex_to_localIndex[i]];
63 }
64
65 local_Jac_data.resize(local_dof_size * local_dof_size);
66 for (unsigned i = 0; i < local_dof_size; i++)
67 {
68 for (unsigned j = 0; j < local_dof_size; j++)
69 {
70 local_Jac_data[i * local_dof_size + j] = _local_J(
72 }
73 }
74 }
75
76 virtual void assembleWithJacobian(double const /*t*/, double const /*dt*/,
77 Eigen::VectorXd const& /*local_u*/,
78 Eigen::VectorXd& /*local_b*/,
79 Eigen::MatrixXd& /*local_J*/)
80 {
82 "SmallDeformationLocalAssemblerInterface::assembleWithJacobian() "
83 "is not implemented");
84 }
85
87 double const t, double const /*dt*/, Eigen::VectorXd const& local_x,
88 Eigen::VectorXd const& /*local_x_prev*/) override
89 {
90 if (!_dofIndex_to_localIndex.empty())
91 {
92 _local_u.setZero();
93 for (auto i = 0; i < local_x.rows(); i++)
94 {
95 _local_u[_dofIndex_to_localIndex[i]] = local_x[i];
96 }
97 }
98
100 }
101
102 virtual std::vector<double> const& getIntPtSigma(
103 const double t,
104 std::vector<GlobalVector*> const& x,
105 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
106 std::vector<double>& cache) const = 0;
107
108 virtual std::vector<double> const& getIntPtEpsilon(
109 const double t,
110 std::vector<GlobalVector*> const& x,
111 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
112 std::vector<double>& cache) const = 0;
113
114 virtual std::vector<double> const& getIntPtFractureStress(
115 const double t,
116 std::vector<GlobalVector*> const& x,
117 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
118 std::vector<double>& cache) const = 0;
119
120 virtual std::vector<double> const& getIntPtFractureAperture(
121 const double t,
122 std::vector<GlobalVector*> const& x,
123 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
124 std::vector<double>& cache) const = 0;
125
126protected:
128 double const t, Eigen::VectorXd const& local_u) = 0;
129
130private:
131 Eigen::VectorXd _local_u;
132 Eigen::VectorXd _local_b;
133 Eigen::MatrixXd _local_J;
134 std::vector<unsigned> const _dofIndex_to_localIndex;
135};
136
137} // namespace SmallDeformation
138} // namespace LIE
139} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
virtual std::vector< double > const & getIntPtEpsilon(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 & getIntPtFractureAperture(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
void assembleWithJacobian(double const t, double const dt, std::vector< double > const &local_x_, std::vector< double > const &, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data) override
SmallDeformationLocalAssemblerInterface(std::size_t n_local_size, std::vector< unsigned > dofIndex_to_localIndex)
virtual void computeSecondaryVariableConcreteWithVector(double const t, Eigen::VectorXd const &local_u)=0
virtual std::vector< double > const & getIntPtSigma(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
void computeSecondaryVariableConcrete(double const t, double const, Eigen::VectorXd const &local_x, Eigen::VectorXd const &) override
virtual void assembleWithJacobian(double const, double const, Eigen::VectorXd const &, Eigen::VectorXd &, Eigen::MatrixXd &)
virtual std::vector< double > const & getIntPtFractureStress(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0