22 double &tangent_stiffness,
23 boost::shared_ptr<Range> &ents,
27 auto cubit_meshset_ptr =
28 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(ms_id,
30 std::vector<double> block_data;
31 CHKERR cubit_meshset_ptr->getAttributes(block_data);
32 if (block_data.size() != 2) {
34 "Expected that block has two attribute");
36 normal_stiffness = block_data[0];
37 tangent_stiffness = block_data[1];
41 <<
"Normal stiffness " << normal_stiffness;
43 <<
"Tangent stiffness " << tangent_stiffness;
45 ents = boost::make_shared<Range>();
47 m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
60template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
67 boost::shared_ptr<MatrixDouble> u_ptr,
double scale);
73 boost::shared_ptr<MatrixDouble>
uPtr;
74 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data);
77template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
84 std::string row_field_name, std::string col_field_name);
89 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
90 EntitiesFieldData::EntData &col_data);
93template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
94OpFluxRhsImpl<ElasticExample::SpringBcType<BLOCKSET>, 1,
FIELD_DIM,
A, GAUSS,
97 boost::shared_ptr<MatrixDouble> u_ptr,
101 this->normalStiffness, this->tangentStiffness,
102 this->entsPtr, m_field, ms_id),
103 "Can not read spring stiffness data from blockset");
106template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
109 GAUSS,
EleOp>::iNtegrate(EntitiesFieldData::EntData
115 const double vol = OpBase::getMeasure();
117 auto t_w = OpBase::getFTensor0IntegrationWeight();
119 auto t_row_base = row_data.getFTensor0N();
122 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
125 auto t_u = getFTensor1FromMat<FIELD_DIM>(*uPtr);
129 const double alpha = t_w * vol * rhsScale;
131 auto l2_norm = t_normal(
i) * t_normal(
i);
135 t_P(
i,
j) = t_normal(
i) * t_normal(
j) / l2_norm;
142 t_D(
i,
j) = normalStiffness * t_P(
i,
j) + tangentStiffness * t_Q(
i,
j);
146 t_reaction(
i) = t_D(
i,
j) * t_u(
j);
149 auto t_nf = getFTensor1FromArray<FIELD_DIM, FIELD_DIM>(
OpBase::locF);
152 t_nf(
i) += (alpha * t_row_base) * t_reaction(
i);
167template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
168OpFluxLhsImpl<ElasticExample::SpringBcType<BLOCKSET>, 1,
FIELD_DIM,
A,
GAUSS,
170 std::string row_field_name,
171 std::string col_field_name)
172 :
OpBase(row_field_name, col_field_name,
OpBase::OPROWCOL) {
174 this->normalStiffness, this->tangentStiffness,
175 this->entsPtr, m_field, ms_id),
176 "Can not read spring stiffness data from blockset");
179template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
183 EleOp>::iNtegrate(EntitiesFieldData::EntData &row_data,
184 EntitiesFieldData::EntData &col_data) {
191 const double vol = OpBase::getMeasure();
193 auto t_w = OpBase::getFTensor0IntegrationWeight();
195 auto t_row_base = row_data.getFTensor0N();
198 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
203 const double alpha = t_w * vol;
205 auto l2_norm = t_normal(
i) * t_normal(
i);
209 t_P(
i,
j) = t_normal(
i) * t_normal(
j) / l2_norm;
216 t_D(
i,
j) = normalStiffness * t_P(
i,
j) + tangentStiffness * t_Q(
i,
j);
222 auto t_col_base = col_data.getFTensor0N(gg, 0);
224 auto t_m = OpBase::template getLocMat<FIELD_DIM>(
FIELD_DIM * rr);
228 t_m(
i,
j) += t_D(
i,
j) * (alpha * t_row_base * t_col_base);
245struct AddFluxToRhsPipelineImpl<
255 static MoFEMErrorCode
add(
257 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
259 boost::shared_ptr<MatrixDouble> u_ptr,
double scale,
260 std::string block_name, Sev sev
265 using OP = OpFluxRhsImpl<ElasticExample::SpringBcType<BLOCKSET>,
BASE_DIM,
268 auto add_op = [&](
auto &&meshset_vec_ptr) {
269 for (
auto m : meshset_vec_ptr) {
281 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
284 (boost::format(
"%s(.*)") % block_name).str()
293 "Handling of bc type not implemented");
302struct AddFluxToLhsPipelineImpl<
312 static MoFEMErrorCode
add(
314 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
316 std::string col_field_name, std::string block_name, Sev sev
321 using OP = OpFluxLhsImpl<ElasticExample::SpringBcType<BLOCKSET>,
BASE_DIM,
324 auto add_op = [&](
auto &&meshset_vec_ptr) {
325 for (
auto m : meshset_vec_ptr) {
328 new OP(m_field,
m->getMeshsetId(), row_field_name, col_field_name));
337 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
340 (boost::format(
"%s(.*)") % block_name).str()
349 "Handling of bc type not implemented");
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
CubitBC
Types of sets and boundary conditions.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
constexpr IntegrationType I
constexpr auto field_name
FTensor::Index< 'm', 3 > m
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, std::string row_field_name, std::string col_field_name, std::string block_name, Sev sev)
AddFluxToLhsPipelineImpl()=delete
AddFluxToRhsPipelineImpl()=delete
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr, double scale, std::string block_name, Sev sev)
GetSpringStiffness()=delete
static MoFEMErrorCode getStiffness(double &normal_stiffness, double &tangent_stiffness, boost::shared_ptr< Range > &ents, MoFEM::Interface &m_field, int ms_id)
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.
VectorDouble locF
local entity vector
int nbRows
number of dofs on rows
int nbIntegrationPts
number of integration points
int nbCols
number if dof on column
int nbRowBaseFunctions
number or row base functions
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > uPtr