v0.13.0
PlasticThermalOps.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 PlasticThermalOps.hpp
* \example PlasticThermalOps.hpp
*/
namespace PlasticThermalOps {
//! [Common data]
inline auto getTempFluxValPtr() {
return boost::shared_ptr<MatrixDouble>(shared_from_this(), &tempFluxVal);
}
inline auto getTempValDotPtr() {
return boost::shared_ptr<VectorDouble>(shared_from_this(), &tempValDot);
}
inline auto getTempDivFluxPtr() {
return boost::shared_ptr<VectorDouble>(shared_from_this(), &templDivFlux);
}
};
//! [Common data]
struct OpPlasticHeatProduction : public AssemblyDomainEleOp {
OpPlasticHeatProduction(const std::string field_name,
boost::shared_ptr<CommonData> common_data_ptr);
protected:
boost::shared_ptr<CommonData> commonDataPtr;
};
struct OpPlasticHeatProduction_dEP : public AssemblyDomainEleOp {
OpPlasticHeatProduction_dEP(const std::string row_field_name,
const std::string col_field_name,
boost::shared_ptr<CommonData> common_data_ptr);
private:
boost::shared_ptr<CommonData> commonDataPtr;
};
struct OpCalculateContrainsLhs_dT : public AssemblyDomainEleOp {
OpCalculateContrainsLhs_dT(const std::string row_field_name,
const std::string col_field_name,
boost::shared_ptr<CommonData> common_data_ptr);
private:
boost::shared_ptr<CommonData> commonDataPtr;
};
const std::string field_name, boost::shared_ptr<CommonData> common_data_ptr)
: AssemblyDomainEleOp(field_name, field_name, DomainEleOp::OPROW),
commonDataPtr(common_data_ptr) {}
const size_t nb_integration_pts = data.getN().size1();
const size_t nb_base_functions = data.getN().size2();
auto t_plastic_strain_dot =
getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticStrainDot);
auto t_D =
getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*commonDataPtr->mDPtr);
auto t_w = getFTensor0IntegrationWeight();
auto t_base = data.getFTensor0N();
for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
const double alpha = getMeasure() * t_w;
// dot(Eps^p): D : dot(Eps^p) * fraction_of_dissipation
const double beta = (alpha * fraction_of_dissipation) *
(t_D(i, j, k, l) * t_plastic_strain_dot(k, l)) *
t_plastic_strain_dot(i, j);
size_t bb = 0;
for (; bb != AssemblyDomainEleOp::nbRows; ++bb) {
nf[bb] += beta * t_base;
++t_base;
}
for (; bb < nb_base_functions; ++bb)
++t_base;
++t_w;
++t_plastic_strain_dot;
}
}
const std::string row_field_name, const std::string col_field_name,
boost::shared_ptr<CommonData> common_data_ptr)
: AssemblyDomainEleOp(row_field_name, col_field_name,
commonDataPtr(common_data_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_plastic_strain_dot =
getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticStrainDot);
auto t_D =
getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*commonDataPtr->mDPtr);
const double ts_a = getTSa();
for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
double alpha = getMeasure() * t_w * fraction_of_dissipation * ts_a * 2;
auto mat_ptr = locMat.data().begin();
constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
auto t_L = symm_L_tensor();
auto t_mat =
t_D_ep_dot(L) =
((t_D(i, j, k, l) * t_plastic_strain_dot(k, l)) * t_L(i, j, L)) *
(alpha);
size_t rr = 0;
for (; rr != AssemblyDomainEleOp::nbRows; ++rr) {
auto t_col_base = col_data.getFTensor0N(gg, 0);
for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols / size_symm; cc++) {
t_mat(L) += (t_row_base * t_col_base) * (t_D_ep_dot(L));
++t_mat;
++t_col_base;
}
++t_row_base;
}
for (; rr != nb_row_base_functions; ++rr)
++t_row_base;
++t_w;
++t_plastic_strain_dot;
}
}
const std::string row_field_name, const std::string col_field_name,
boost::shared_ptr<CommonData> common_data_ptr)
: AssemblyDomainEleOp(row_field_name, col_field_name,
commonDataPtr(common_data_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_f = getFTensor0FromVec(commonDataPtr->plasticSurface);
auto t_tau = getFTensor0FromVec(commonDataPtr->plasticTau);
if (commonDataPtr->tempVal.size() != nb_integration_pts) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Temperature not set");
}
auto t_temp = getFTensor0FromVec(commonDataPtr->tempVal);
auto t_tau_dot = getFTensor0FromVec(commonDataPtr->plasticTauDot);
const double t_a = getTSa();
auto t_row_base = row_data.getFTensor0N();
for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
const double alpha = getMeasure() * t_w;
const double c1 =
* diff_constrain_dsigma_y(t_tau_dot, t_f, hardening(t_tau, t_temp)) *
hardening_dtemp(t_tau, t_temp);
auto mat_ptr = locMat.data().begin();
size_t rr = 0;
for (; rr != AssemblyDomainEleOp::nbRows; ++rr) {
auto t_col_base = col_data.getFTensor0N(gg, 0);
for (size_t cc = 0; cc != AssemblyDomainEleOp::nbCols; ++cc) {
*mat_ptr += c1 * t_row_base * t_col_base;
++mat_ptr;
++t_col_base;
}
++t_row_base;
}
for (; rr < nb_row_base_functions; ++rr)
++t_row_base;
++t_w;
++t_f;
++t_tau;
++t_temp;
++t_tau_dot;
}
}
} // namespace PlasticThermalOps
static Index< 'L', 3 > L
EntitiesFieldData::EntData EntData
constexpr int SPACE_DIM
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
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:88
UBlasVector< double > VectorDouble
Definition: Types.hpp:79
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:149
auto diff_constrain_dsigma_y(long double tau_dot, long double f, long double hardening)
auto hardening(long double tau)
auto get_mat_scalar_dtensor_sym(MatrixDouble &mat, FTensor::Number< 2 >)
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::OpBase AssemblyDomainEleOp
Definition: plastic.cpp:63
VectorDouble locF
local entity vector
int nbRows
number of dofs on rows
MatrixDouble locMat
local entity block matrix
int nbCols
number if dof on column
boost::shared_ptr< CommonData > commonDataPtr
OpCalculateContrainsLhs_dT(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< CommonData > commonDataPtr
OpPlasticHeatProduction_dEP(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr)
boost::shared_ptr< CommonData > commonDataPtr
OpPlasticHeatProduction(const std::string field_name, boost::shared_ptr< CommonData > common_data_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data)
double fraction_of_dissipation
long double hardening_dtemp(long double tau, double temp)