v0.13.0
PlasticOpsSmallStrains.hpp
/* This file is part of MoFEM.
* MoFEM is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* MoFEM is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
/** \file PlasticOpsSmallStrains.hpp
* \example PlasticOpsSmallStrains.hpp
*/
namespace PlasticOps {
const std::string row_field_name, const std::string col_field_name,
boost::shared_ptr<CommonData> common_data_ptr,
boost::shared_ptr<MatrixDouble> m_D_ptr)
: AssemblyDomainEleOp(row_field_name, col_field_name,
commonDataPtr(common_data_ptr), mDPtr(m_D_ptr) {
sYmm = false;
}
const size_t nb_integration_pts = row_data.getN().size1();
const size_t nb_row_base_functions = row_data.getN().size2();
auto t_w = getFTensor0IntegrationWeight();
auto t_row_base = row_data.getFTensor0N();
auto t_f = getFTensor0FromVec(commonDataPtr->plasticSurface);
auto t_tau_dot = getFTensor0FromVec(commonDataPtr->plasticTauDot);
auto t_flow =
getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticFlow);
auto t_D =
getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*commonDataPtr->mDPtr);
// This is D set by user in operator, i.e. D_deviator
auto t_D_Op = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mDPtr);
constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
t_diff_grad;
t_diff_grad(i, j, k, l) = t_kd(i, k) * t_kd(j, l);
for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
double alpha = getMeasure() * t_w;
auto t_diff_plastic_flow_dstrain = diff_plastic_flow_dstrain(
t_D_Op,
t_flow_stress_dstrain(i, j, k, l) =
t_D(i, j, m, n) * t_diff_plastic_flow_dstrain(m, n, k, l);
t_diff_plastic_flow_stress_dgrad;
t_diff_plastic_flow_stress_dgrad(i, j, k, l) =
t_flow_stress_dstrain(i, j, m, n) * t_diff_grad(m, n, k, l);
size_t rr = 0;
for (; rr != AssemblyDomainEleOp::nbRows / size_symm; ++rr) {
auto t_mat =
const double c0 = alpha * t_row_base * t_tau_dot;
auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / SPACE_DIM; ++cc) {
t_mat(i, j, l) -= c0 * (t_diff_plastic_flow_stress_dgrad(i, j, l, k) *
t_col_diff_base(k));
++t_mat;
++t_col_diff_base;
}
++t_row_base;
}
for (; rr < nb_row_base_functions; ++rr)
++t_row_base;
++t_w;
++t_f;
++t_flow;
++t_tau_dot;
}
}
const std::string row_field_name, const std::string col_field_name,
boost::shared_ptr<CommonData> common_data_ptr,
boost::shared_ptr<MatrixDouble> m_D_ptr)
: AssemblyDomainEleOp(row_field_name, col_field_name,
commonDataPtr(common_data_ptr), mDPtr(m_D_ptr) {
sYmm = false;
}
const size_t nb_integration_pts = row_data.getN().size1();
const size_t nb_row_base_functions = row_data.getN().size2();
auto t_w = getFTensor0IntegrationWeight();
auto t_row_base = row_data.getFTensor0N();
auto t_f = getFTensor0FromVec(commonDataPtr->plasticSurface);
auto t_tau = getFTensor0FromVec(commonDataPtr->plasticTau);
if (commonDataPtr->tempVal.size() != nb_integration_pts) {
commonDataPtr->tempVal.resize(nb_integration_pts, 0);
commonDataPtr->tempVal.clear();
}
auto t_temp = getFTensor0FromVec(commonDataPtr->tempVal);
auto t_tau_dot = getFTensor0FromVec(commonDataPtr->plasticTauDot);
auto t_flow =
getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticFlow);
auto t_D =
getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*commonDataPtr->mDPtr);
// This is operator stet by user, i.e. D_deviator
auto t_D_Op = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mDPtr);
// constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
// FTensor::Tensor4<double, SPACE_DIM, SPACE_DIM, SPACE_DIM, SPACE_DIM>
// t_diff_grad;
// t_diff_grad(i, j, k, l) = t_kd(i, k) * t_kd(j, l);
auto t_diff_grad_symmetrise = diff_symmetrize();
for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
double alpha = getMeasure() * t_w;
auto t_diff_constrain_dstrain = diff_constrain_dstrain(
diff_constrain_df(t_tau_dot, t_f, hardening(t_tau, t_temp)),
t_flow));
t_diff_constrain_dgrad(k, l) =
t_diff_constrain_dstrain(i, j) * t_diff_grad_symmetrise(i, j, k, l);
size_t rr = 0;
for (; rr != AssemblyDomainEleOp::nbRows; ++rr) {
auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / SPACE_DIM; cc++) {
t_mat(i) += alpha * t_row_base * (t_diff_constrain_dgrad(i, j)) *
t_col_diff_base(j);
++t_mat;
++t_col_diff_base;
}
++t_row_base;
}
for (; rr != nb_row_base_functions; ++rr)
++t_row_base;
++t_f;
++t_tau;
++t_tau_dot;
++t_flow;
++t_temp;
++t_w;
}
}
}; // namespace PlasticOps
EntitiesFieldData::EntData EntData
constexpr int SPACE_DIM
Kronecker Delta class.
constexpr double alpha
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
constexpr auto t_kd
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:149
auto hardening(long double tau)
auto diff_constrain_dstress(double &&diff_constrain_df, FTensor::Tensor2_symmetric< T, SPACE_DIM > &t_plastic_flow)
Definition: PlasticOps.hpp:515
FTensor::Index< 'j', SPACE_DIM > j
[Common data]
Definition: PlasticOps.hpp:91
auto diff_constrain_dstrain(T1 &t_D, T2 &&t_diff_constrain_dstress)
Definition: PlasticOps.hpp:524
static auto get_mat_scalar_dvector(MatrixDouble &mat, FTensor::Number< 2 >)
Definition: PlasticOps.hpp:555
FTensor::Index< 'l', SPACE_DIM > l
Definition: PlasticOps.hpp:93
FTensor::Index< 'k', SPACE_DIM > k
Definition: PlasticOps.hpp:92
auto diff_tensor()
[Operators definitions]
Definition: PlasticOps.hpp:294
auto diff_deviator(FTensor::Ddg< double, SPACE_DIM, SPACE_DIM > &&t_diff_stress)
Definition: PlasticOps.hpp:374
FTensor::Index< 'i', SPACE_DIM > i
Definition: PlasticOps.hpp:95
FTensor::Index< 'm', SPACE_DIM > m
Definition: PlasticOps.hpp:94
auto diff_symmetrize()
Definition: PlasticOps.hpp:320
auto diff_plastic_flow_dstress(long double f, FTensor::Tensor2_symmetric< T, SPACE_DIM > &t_flow, FTensor::Ddg< double, 3, SPACE_DIM > &&t_diff_deviator)
Definition: PlasticOps.hpp:442
auto diff_plastic_flow_dstrain(FTensor::Ddg< T, SPACE_DIM, SPACE_DIM > &t_D, FTensor::Ddg< double, SPACE_DIM, SPACE_DIM > &&t_diff_plastic_flow_dstress)
Definition: PlasticOps.hpp:454
auto diff_constrain_df(long double dot_tau, long double f, long double sigma_y)
Definition: PlasticOps.hpp:504
static FTensor::Tensor3< FTensor::PackPtr< double *, 2 >, 2, 2, 2 > get_mat_tensor_sym_dvector(size_t rr, MatrixDouble &mat, FTensor::Number< 2 >)
[Lambda functions]
Definition: PlasticOps.hpp:534
FTensor::Index< 'n', SPACE_DIM > n
Definition: PlasticOps.hpp:96
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::OpBase AssemblyDomainEleOp
Definition: plastic.cpp:63
int nbRows
number of dofs on rows
MatrixDouble locMat
local entity block matrix
int nbCols
number if dof on column
OpCalculateContrainsLhs_dU(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
boost::shared_ptr< MatrixDouble > mDPtr
Definition: PlasticOps.hpp:238
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:237
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpCalculatePlasticFlowLhs_dU(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
boost::shared_ptr< MatrixDouble > mDPtr
Definition: PlasticOps.hpp:186
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:185