36namespace MPL = MaterialPropertyLib;
40template <
typename ShapeMatrixType>
43 std::vector<ShapeMatrixType, Eigen::aligned_allocator<ShapeMatrixType>>
N;
46template <
int DisplacementDim,
typename ShapeMatricesType>
53 Eigen::Matrix<double, DisplacementDim, DisplacementDim>>;
55 using SigmaGeom = Eigen::Matrix<double,
MPL::tensorSize(DisplacementDim),
57 if constexpr (DisplacementDim == 2)
59 SigmaGeom sigma_geom = SigmaGeom::Zero(5, 5);
60 sigma_geom.template block<4, 4>(0, 0) =
61 sigma_geom_op(sigma_tensor.template block<2, 2>(0, 0).eval());
62 sigma_geom(4, 4) = sigma_tensor(2, 2);
67 if constexpr (DisplacementDim == 3)
69 return sigma_geom_op(sigma_tensor);
73template <
typename ShapeFunction,
int DisplacementDim>
113 bool const is_axially_symmetric,
116 e, integration_method, is_axially_symmetric, process_data)
118 unsigned const n_integration_points =
121 _ip_data.resize(n_integration_points);
124 auto const shape_matrices =
129 for (
unsigned ip = 0; ip < n_integration_points; ip++)
132 auto const& sm = shape_matrices[ip];
135 sm.integralMeasure * sm.detJ;
138 ip_data.dNdx_u = sm.dNdx;
146 unsigned const n_integration_points =
148 for (
unsigned ip = 0; ip < n_integration_points; ip++)
153 std::nullopt, this->
element_.getID(),
167 double>::quiet_NaN() ,
174 t, x_position, *material_state.material_state_variables);
177 constitutive_setting;
178 constitutive_setting.
init();
180 material_state.pushBackState();
190 Eigen::Ref<Eigen::VectorXd const>
const& u,
195 auto& eps_data = std::get<StrainData<DisplacementDim>>(output_data);
196 auto& deformation_gradient_data =
197 std::get<DeformationGradientData<DisplacementDim>>(output_data);
199 eps_data.eps = B * u;
200 deformation_gradient_data.deformation_gradient =
202 deformation_gradient_data.volume_ratio =
204 deformation_gradient_data.deformation_gradient);
212 double const detF = deformation_gradient_data.volume_ratio;
213 double const J_ratio = detF0 / detF;
218 "det(F0)/det(F) is negative with det(F0) = {:g}, and det(F) = "
224 DisplacementDim == 3 ? std::cbrt(J_ratio) : std::sqrt(J_ratio);
226 deformation_gradient_data.deformation_gradient
227 .template segment<DisplacementDim * DisplacementDim>(0) *= alpha;
228 deformation_gradient_data.volume_ratio *=
229 std::pow(alpha, DisplacementDim);
231 double const alpha_p2 = alpha * alpha;
232 eps_data.eps = alpha_p2 * eps_data.eps +
233 0.5 * (alpha_p2 - 1) *
242 Eigen::Ref<Eigen::VectorXd const>
const& u_prev,
258 ? (*this->
process_data_.reference_temperature)(t, x_position)[0]
259 : std::numeric_limits<double>::quiet_NaN();
269 models, t, dt, x_position,
273 alpha * (G * u_prev +
275 current_state, prev_state, material_state, tmp, CD);
281 std::vector<double>
const& ,
282 std::vector<double>
const& ,
283 std::vector<double>& ,
284 std::vector<double>& ,
285 std::vector<double>& )
override
288 "LargeDeformationLocalAssembler: assembly without jacobian is not "
293 bool const compute_detF0_only, Eigen::VectorXd
const& local_x)
const
307 _ip_data, compute_detF0_only, local_x,
315 compute_detF0_only, local_x, this->
element_,
320 std::vector<double>
const& local_x,
321 std::vector<double>
const& local_x_prev,
322 std::vector<double>& local_b_data,
323 std::vector<double>& local_Jac_data)
override
325 auto const local_matrix_size = local_x.size();
328 local_Jac_data, local_matrix_size, local_matrix_size);
331 local_b_data, local_matrix_size);
334 auto [u_prev] =
localDOF(local_x_prev);
336 unsigned const n_integration_points =
340 constitutive_setting;
344 auto const f_bar_variables =
347 for (
unsigned ip = 0; ip < n_integration_points; ip++)
349 auto const& w =
_ip_data[ip].integration_weight;
351 auto const& dNdx =
_ip_data[ip].dNdx_u;
354 std::nullopt, this->
element_.getID(),
365 (DisplacementDim == 2 ? 1 : 0),
366 ShapeFunction::NPOINTS * DisplacementDim);
368 ShapeFunction::NPOINTS>(
374 DisplacementDim, ShapeFunction::NPOINTS,
376 dNdx, N, x_coord, this->is_axially_symmetric_);
379 DisplacementDim, ShapeFunction::NPOINTS,
381 dNdx, N, grad_u, x_coord, this->is_axially_symmetric_);
384 f_bar_variables ? std::get<double>(*f_bar_variables) : 0.0;
386 detF0, B_0 + 0.5 * B_N, grad_u, u, this->
output_data_[ip]);
389 alpha, G, u_prev, x_position, t, dt, constitutive_setting,
398 auto const& b = *std::get<VolumetricBodyForce<DisplacementDim>>(CD);
401 DisplacementDim>>(CD)
404 auto const sigma_geom =
408 if (!f_bar_variables)
411 (B.transpose() * sigma -
N_u_op(N).transpose() * b) * w;
413 local_Jac.noalias() += G.transpose() * sigma_geom * G * w;
415 local_Jac.noalias() += B.transpose() * C * B * w;
419 double const alpha_p2 = alpha * alpha;
420 local_Jac.noalias() +=
421 alpha_p2 * G.transpose() * sigma_geom * G * w;
423 auto const q0 = std::get<VectorTypeForFbar>(*f_bar_variables);
426 std::get<DeformationGradientData<DisplacementDim>>(
428 .deformation_gradient;
433 dNdx, F, this->is_axially_symmetric_);
435 auto const q0_q = q0 - q;
437 auto const S_q = sigma * (q0_q).transpose();
439 local_Jac.noalias() +=
440 2.0 * alpha_p2 * S_q.transpose() * B * w / DisplacementDim;
442 auto const twoEplsI =
448 this->is_axially_symmetric_);
453 (B + twoEplsI * (q0_q).transpose() / DisplacementDim);
455 local_Jac.noalias() +=
456 2.0 * Bbar.transpose() * S_q * w / DisplacementDim;
458 local_Jac.noalias() += Bbar.transpose() * C * Bbar * w;
460 local_Jac.noalias() -=
461 alpha_p2 * sigma.dot(twoEplsI) *
462 (q0 * q0.transpose() - q * q.transpose()) * w /
466 (Bbar.transpose() * sigma -
N_u_op(N).transpose() * b) * w;
472 Eigen::VectorXd
const& local_x_prev,
473 double const t,
double const dt,
476 unsigned const n_integration_points =
480 constitutive_setting;
485 auto const f_bar_variables =
488 for (
unsigned ip = 0; ip < n_integration_points; ip++)
491 auto const& dNdx =
_ip_data[ip].dNdx_u;
494 std::nullopt, this->
element_.getID(),
505 (DisplacementDim == 2 ? 1 : 0),
506 ShapeFunction::NPOINTS * DisplacementDim);
508 ShapeFunction::NPOINTS>(
515 DisplacementDim, ShapeFunction::NPOINTS,
517 dNdx, N, x_coord, this->is_axially_symmetric_);
520 DisplacementDim, ShapeFunction::NPOINTS,
522 dNdx, N, grad_u, x_coord,
523 this->is_axially_symmetric_);
526 f_bar_variables ? std::get<double>(*f_bar_variables) : 0.0;
531 alpha, G, local_x_prev, x_position, t, dt, constitutive_setting,
538 for (
unsigned ip = 0; ip < n_integration_points; ip++)
545 const unsigned integration_point)
const override
550 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
554 static constexpr auto localDOF(std::vector<double>
const& x)
561 std::vector<IpData, Eigen::aligned_allocator<IpData>>
_ip_data;
566 ShapeFunction::NPOINTS * DisplacementDim;
EigenFixedShapeMatrixPolicy< ShapeFunction, GlobalDim > ShapeMatrixPolicyType
std::optional< MathLib::Point3d > const getCoordinates() const
MatrixType< _kelvin_vector_size, _number_of_dof > BMatrixType
MatrixType< _number_of_dof, _number_of_dof > StiffnessMatrixType
VectorType< _number_of_dof > NodalForceVectorType
Rhs residual.
VectorTypeFixedSize< MathLib::VectorizedTensor::size(DisplacementDim)> GradientVectorType
MatrixType< MathLib::VectorizedTensor::size(DisplacementDim), _number_of_dof > GradientMatrixType
constexpr int tensorSize(int dim)
See Tensor type for details.
Eigen::Matrix< double, Eigen::MatrixBase< Derived >::RowsAtCompileTime, 1 > symmetricTensorToKelvinVector(Eigen::MatrixBase< Derived > const &v)
Eigen::Matrix< double, 3, 3 > kelvinVectorToTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)
double determinant(Eigen::MatrixBase< Derived > const &tensor)
Computes determinant of a vectorized tensor.
constexpr auto identity()
constexpr Eigen::CwiseNullaryOp< EigenBlockMatrixViewFunctor< D, M >, typename EigenBlockMatrixViewFunctor< D, M >::Matrix > eigenBlockMatrixView(const Eigen::MatrixBase< M > &matrix)
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)
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)
auto localDOF(ElementDOFVector const &x)
std::array< double, 3 > interpolateCoordinates(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
BMatrixType computeBMatrix(DNDX_Type const &dNdx, N_Type const &N, const double radius, const bool is_axially_symmetric)
Fills a B-matrix based on given shape function dN/dx values.
BMatrixType computeBMatrix(DNDX_Type const &dNdx, N_Type const &N, GradientVectorType const &grad_u, const double radius, const bool is_axially_symmetric)
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > identityForF(bool const is_axially_symmetric)
std::tuple< double, VectorTypeForFbar > computeFBarInitialVariablesElementCenter(bool const compute_detF0_only, Eigen::VectorXd const &u, MeshLib::Element const &element, bool const is_axially_symmetric)
VectorTypeForFbar computeQVector(DNDX_Type const &dNdx, GradientVectorType const &F, bool const)
std::tuple< double, VectorTypeForFbar > computeFBarInitialVariablesAverage(std::vector< IpData, Eigen::aligned_allocator< IpData > > const &ip_data, bool const compute_detF0_only, Eigen::VectorXd const &u, NumLib::GenericIntegrationMethod const &integration_method, MeshLib::Element const &element, bool const is_axially_symmetric)
MathLib::KelvinVector::KelvinVectorType< DisplacementDim > compute2EPlusI(double const alpha_p2, MathLib::KelvinVector::KelvinVectorType< DisplacementDim > const &eps_bar, bool const is_axially_symmetric)
NumLib::ShapeMatrices< NodalRowVectorType, DimNodalMatrixType, DimMatrixType, GlobalDimNodalMatrixType > ShapeMatrices
MatrixType< ShapeFunction::NPOINTS, ShapeFunction::NPOINTS > NodalMatrixType
MatrixType< GlobalDim, ShapeFunction::NPOINTS > GlobalDimNodalMatrixType
VectorType< ShapeFunction::NPOINTS > NodalVectorType
RowVectorType< ShapeFunction::NPOINTS > NodalRowVectorType