35namespace SmallDeformation
37template <
typename ShapeFunction,
int DisplacementDim>
43 bool const is_axially_symmetric,
45 : _process_data(process_data),
46 _integration_method(integration_method),
48 _is_axially_symmetric(is_axially_symmetric)
50 unsigned const n_integration_points =
53 _ip_data.reserve(n_integration_points);
56 auto const shape_matrices =
58 DisplacementDim>(e, is_axially_symmetric,
64 for (
unsigned ip = 0; ip < n_integration_points; ip++)
66 _ip_data.emplace_back(solid_material);
68 auto const& sm = shape_matrices[ip];
70 ip_data.dNdx_u = sm.dNdx;
71 ip_data.integration_weight =
73 sm.integralMeasure * sm.detJ;
76 static const int kelvin_vector_size =
78 ip_data._sigma.setZero(kelvin_vector_size);
79 ip_data._eps.setZero(kelvin_vector_size);
82 ip_data._sigma_prev.resize(kelvin_vector_size);
83 ip_data._eps_prev.resize(kelvin_vector_size);
85 ip_data._C.resize(kelvin_vector_size, kelvin_vector_size);
91template <
typename ShapeFunction,
int DisplacementDim>
94 std::vector<double>
const& local_x,
95 std::vector<double>
const& ,
96 std::vector<double>& local_b_data,
97 std::vector<double>& local_Jac_data)
99 assert(_element.getDimension() == DisplacementDim);
101 auto const local_matrix_size = local_x.size();
104 local_Jac_data, local_matrix_size, local_matrix_size);
107 local_b_data, local_matrix_size);
109 unsigned const n_integration_points =
110 _integration_method.getNumberOfPoints();
117 auto const B_dil_bar = getDilatationalBBarMatrix();
119 for (
unsigned ip = 0; ip < n_integration_points; ip++)
122 auto const& w = _ip_data[ip].integration_weight;
124 auto const& N = _ip_data[ip].N_u;
125 auto const& dNdx = _ip_data[ip].dNdx_u;
133 this->_is_axially_symmetric);
135 auto const& eps_prev = _ip_data[ip]._eps_prev;
136 auto const& sigma_prev = _ip_data[ip]._sigma_prev;
138 auto& eps = _ip_data[ip]._eps;
139 auto& sigma = _ip_data[ip]._sigma;
140 auto& state = _ip_data[ip]._material_state_variables;
143 B * Eigen::Map<typename BMatricesType::NodalForceVectorType const>(
144 local_x.data(), ShapeFunction::NPOINTS * DisplacementDim);
155 variables_prev.
temperature = _process_data.reference_temperature;
157 auto&& solution = _ip_data[ip]._solid_material.integrateStress(
158 variables_prev, variables, t, x_position, dt, *state);
162 OGS_FATAL(
"Computation of local constitutive relation failed.");
166 std::tie(sigma, state, C) = std::move(*solution);
168 local_b.noalias() -= B.transpose() * sigma * w;
169 local_Jac.noalias() += B.transpose() * C * B * w;
173template <
typename ShapeFunction,
int DisplacementDim>
176 double const , Eigen::VectorXd
const& )
180 KV sigma_avg = KV::Zero();
181 auto const e_id = _element.getID();
183 unsigned const n_integration_points =
184 _integration_method.getNumberOfPoints();
185 for (
unsigned ip = 0; ip < n_integration_points; ip++)
187 sigma_avg += _ip_data[ip]._sigma;
189 sigma_avg /= n_integration_points;
192 &(*_process_data.element_stresses)[e_id * KV::RowsAtCompileTime]) =
196template <
typename ShapeFunction,
int DisplacementDim>
197std::vector<double>
const&
201 std::vector<GlobalVector*>
const& ,
202 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
203 std::vector<double>& cache)
const
206 _ip_data, &IntegrationPointDataType::_sigma, cache);
208template <
typename ShapeFunction,
int DisplacementDim>
209std::vector<double>
const&
213 std::vector<GlobalVector*>
const& ,
214 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& ,
215 std::vector<double>& cache)
const
218 _ip_data, &IntegrationPointDataType::_eps, cache);
KelvinVector mechanical_strain
std::size_t getID() const
Returns the ID of the element.
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
unsigned getNumberOfPoints() const
void setElementID(std::size_t element_id)
void setIntegrationPoint(unsigned integration_point)
MatrixType< _kelvin_vector_size, _number_of_dof > BMatrixType
auto & selectSolidConstitutiveRelation(SolidMaterialsMap const &constitutive_relations, MeshLib::PropertyVector< int > const *const material_ids, std::size_t const element_id)
Eigen::Matrix< double, 4, 1 > kelvinVectorToSymmetricTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), kelvin_vector_dimensions(DisplacementDim), Eigen::RowMajor > KelvinMatrixType
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
double interpolateXCoordinate(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
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)
BMatrixType computeBMatrixPossiblyWithBbar(DNDX_Type const &dNdx, N_Type const &N, std::optional< BBarMatrixType > const &B_dil_bar, const double radius, const bool is_axially_symmetric)
Fills a B matrix, or a B bar matrix if required.
std::vector< double > const & getIntegrationPointKelvinVectorData(IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)