11 const std::string row_field_name,
const std::string col_field_name,
12 boost::shared_ptr<MatrixDouble> mDptr,
13 boost::shared_ptr<VectorDouble> coeff_expansion_ptr);
15 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
16 EntitiesFieldData::EntData &col_data);
19 boost::shared_ptr<MatrixDouble>
mDPtr;
29 boost::shared_ptr<MatrixDouble> strain_ptr,
30 boost::shared_ptr<VectorDouble> temp_ptr,
31 boost::shared_ptr<MatrixDouble> m_D_ptr,
32 boost::shared_ptr<VectorDouble> coeff_expansion_ptr,
33 boost::shared_ptr<MatrixDouble> stress_ptr);
36 boost::shared_ptr<VectorDouble> temp_ptr,
37 boost::shared_ptr<MatrixDouble> m_D_ptr,
38 boost::shared_ptr<VectorDouble> coeff_expansion_ptr,
39 boost::shared_ptr<double> ref_temp_ptr,
40 boost::shared_ptr<MatrixDouble> stress_ptr);
47 boost::shared_ptr<MatrixDouble>
mDPtr;
54 const std::string row_field_name,
const std::string col_field_name,
55 boost::shared_ptr<MatrixDouble> mDptr,
56 boost::shared_ptr<VectorDouble> coeff_expansion_ptr)
59 mDPtr(mDptr), coeffExpansionPtr(coeff_expansion_ptr) {
65 EntitiesFieldData::EntData &col_data) {
70 const auto nb_integration_pts = row_data.getN().size1();
71 const auto nb_row_base_functions = row_data.getN().size2();
72 auto t_w = getFTensor0IntegrationWeight();
73 auto t_row_diff_base = row_data.getFTensor1DiffN<
SPACE_DIM>();
74 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*
mDPtr);
83 t_coeff_exp(
i,
j) = 0;
85 t_coeff_exp(d, d) = (*coeffExpansionPtr)[d];
88 t_eigen_strain(
i,
j) = (t_D(
i,
j,
k,
l) * t_coeff_exp(
k,
l));
90 for (
auto gg = 0; gg != nb_integration_pts; ++gg) {
92 double alpha = getMeasure() * t_w;
97 DataLayoutTraits<DataLayout::CoeffsByGauss>>(
99 auto t_col_base = col_data.getFTensor0N(gg, 0);
103 (t_row_diff_base(
j) * t_eigen_strain(
i,
j)) * (t_col_base * alpha);
111 for (; rr != nb_row_base_functions; ++rr)
121 const std::string
field_name, boost::shared_ptr<MatrixDouble> strain_ptr,
122 boost::shared_ptr<VectorDouble> temp_ptr,
123 boost::shared_ptr<MatrixDouble> m_D_ptr,
124 boost::shared_ptr<VectorDouble> coeff_expansion_ptr,
125 boost::shared_ptr<MatrixDouble> stress_ptr)
127 tempPtr(temp_ptr), mDPtr(m_D_ptr), coeffExpansionPtr(coeff_expansion_ptr),
128 stressPtr(stress_ptr) {
130 std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE],
false);
134 boost::shared_ptr<MatrixDouble> strain_ptr,
135 boost::shared_ptr<VectorDouble> temp_ptr,
136 boost::shared_ptr<MatrixDouble> m_D_ptr,
137 boost::shared_ptr<VectorDouble> coeff_expansion_ptr,
138 boost::shared_ptr<double> ref_temp_ptr,
139 boost::shared_ptr<MatrixDouble> stress_ptr)
141 tempPtr(temp_ptr), mDPtr(m_D_ptr), coeffExpansionPtr(coeff_expansion_ptr),
142 refTempPtr(ref_temp_ptr), stressPtr(stress_ptr) {}
148 const auto nb_gauss_pts = getGaussPts().size2();
151 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*
mDPtr);
152 auto t_strain = getFTensor2SymmetricFromMat<SPACE_DIM>(*
strainPtr);
153 auto t_stress = getFTensor2SymmetricFromMat<SPACE_DIM>(*
stressPtr);
154 auto t_temp = getFTensor0FromVec(*
tempPtr);
162 t_coeff_exp(
i,
j) = 0;
164 t_coeff_exp(d, d) = (*coeffExpansionPtr)[d];
167 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
170 (t_strain(
k,
l) - t_coeff_exp(
k,
l) * (t_temp - (*refTempPtr)));
179struct SetTargetTemperature;
185template <AssemblyType A, IntegrationType I,
typename OpBase>
189template <AssemblyType A, IntegrationType I, typename OpBase>
193template <AssemblyType A, IntegrationType I, typename OpBase>
196 MoFEM::OpFluxRhsImpl<ThermoElasticOps::SetTargetTemperature, 1, 1, A, I,
206 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
208 boost::shared_ptr<VectorDouble> temp_ptr, std::string block_name,
219 auto add_op = [&](
auto &&meshset_vec_ptr) {
221 for (
auto m : meshset_vec_ptr) {
222 std::vector<double> block_data;
223 m->getAttributes(block_data);
224 if (block_data.size() < 2) {
226 "Expected two parameters");
228 double target_temperature = block_data[0];
229 double beta = block_data[1];
230 auto ents_ptr = boost::make_shared<Range>();
235 <<
"Add " << *
m <<
" target temperature " << target_temperature
236 <<
" penalty " << beta;
238 auto op_source =
new OP_SOURCE(
240 [target_temperature, beta](
double,
double,
double) {
241 return target_temperature * beta;
244 op_source->feScalingFun = fe_fun;
245 pipeline.push_back(op_source);
246 auto op_temp =
new OP_TEMP(
248 [beta](
double,
double,
double) {
return -beta; }, ents_ptr);
249 op_temp->feScalingFun = fe_fun;
250 pipeline.push_back(op_temp);
259 (boost::format(
"%s(.*)") % block_name).str()
271template <AssemblyType A, IntegrationType I,
typename OpBase>
272struct AddFluxToLhsPipelineImpl<
281 static MoFEMErrorCode
add(
283 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
285 std::string block_name, FEFun fe_fun, Sev sev
290 using OP_MASS =
typename FormsIntegrators<OpBase>::template Assembly<
293 auto add_op = [&](
auto &&meshset_vec_ptr) {
295 for (
auto m : meshset_vec_ptr) {
296 std::vector<double> block_data;
297 m->getAttributes(block_data);
298 if (block_data.size() != 2) {
300 "Expected two parameters");
302 double beta = block_data[1];
303 auto ents_ptr = boost::make_shared<Range>();
308 <<
"Add " << *
m <<
" penalty " << beta;
310 auto op_mass =
new OP_MASS(
312 [beta](
double,
double,
double) {
return beta; }, ents_ptr);
313 op_mass->feScalingFun = fe_fun;
314 pipeline.push_back(op_mass);
321 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
323 (boost::format(
"%s(.*)") % block_name).str()
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
SeverityLevel
Severity levels.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
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.
boost::function< double(const FEMethod *fe_ptr)> FEFun
Lambda function used to scale with time.
constexpr IntegrationType I
constexpr auto field_name
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMass
[Only used with Hooke equation (linear material model)]
FTensor::Index< 'm', 3 > m
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, std::string block_name, FEFun fe_fun, Sev sev)
AddFluxToLhsPipelineImpl()=delete
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, boost::shared_ptr< VectorDouble > temp_ptr, std::string block_name, FEFun fe_fun, Sev sev)
AddFluxToRhsPipelineImpl()=delete
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
Interface for managing meshsets containing materials and boundary conditions.
int nbRows
number of dofs on rows
MatrixDouble locMat
local entity block matrix
int nbCols
number if dof on column
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
boost::shared_ptr< MatrixDouble > mDPtr
OpKCauchyThermoElasticity(const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< MatrixDouble > mDptr, boost::shared_ptr< VectorDouble > coeff_expansion_ptr)
boost::shared_ptr< VectorDouble > coeffExpansionPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
DEPRECATED OpStressThermal(const std::string field_name, boost::shared_ptr< MatrixDouble > strain_ptr, boost::shared_ptr< VectorDouble > temp_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr, boost::shared_ptr< VectorDouble > coeff_expansion_ptr, boost::shared_ptr< MatrixDouble > stress_ptr)
boost::shared_ptr< VectorDouble > coeffExpansionPtr
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
[Calculate stress]
boost::shared_ptr< MatrixDouble > strainPtr
boost::shared_ptr< MatrixDouble > stressPtr
boost::shared_ptr< double > refTempPtr
boost::shared_ptr< VectorDouble > tempPtr
boost::shared_ptr< MatrixDouble > mDPtr