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,
102 this->normalStiffness, this->tangentStiffness,
103 this->entsPtr, m_field, ms_id),
104 "Can not read spring stiffness data from blockset");
107template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
110 GAUSS,
EleOp>::iNtegrate(EntitiesFieldData::EntData
116 const double vol = OpBase::getMeasure();
118 auto t_w = OpBase::getFTensor0IntegrationWeight();
120 auto t_row_base = row_data.getFTensor0N();
123 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
126 auto t_u = getFTensor1FromMat<FIELD_DIM>(*uPtr);
130 const double alpha = t_w * vol * rhsScale;
132 auto l2_norm = t_normal(
i) * t_normal(
i);
136 t_P(
i,
j) = t_normal(
i) * t_normal(
j) / l2_norm;
143 t_D(
i,
j) = normalStiffness * t_P(
i,
j) + tangentStiffness * t_Q(
i,
j);
147 t_reaction(
i) = t_D(
i,
j) * t_u(
j);
150 auto t_nf = getFTensor1FromArray<FIELD_DIM, FIELD_DIM>(
OpBase::locF);
153 t_nf(
i) += (alpha * t_row_base) * t_reaction(
i);
168template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
169OpFluxLhsImpl<ElasticExample::SpringBcType<BLOCKSET>, 1,
FIELD_DIM,
A,
GAUSS,
171 std::string row_field_name,
172 std::string col_field_name)
173 :
OpBase(row_field_name, col_field_name,
OpBase::OPROWCOL) {
175 this->normalStiffness, this->tangentStiffness,
176 this->entsPtr, m_field, ms_id),
177 "Can not read spring stiffness data from blockset");
180template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
184 EleOp>::iNtegrate(EntitiesFieldData::EntData &row_data,
185 EntitiesFieldData::EntData &col_data) {
192 const double vol = OpBase::getMeasure();
194 auto t_w = OpBase::getFTensor0IntegrationWeight();
196 auto t_row_base = row_data.getFTensor0N();
199 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
204 const double alpha = t_w * vol;
206 auto l2_norm = t_normal(
i) * t_normal(
i);
210 t_P(
i,
j) = t_normal(
i) * t_normal(
j) / l2_norm;
217 t_D(
i,
j) = normalStiffness * t_P(
i,
j) + tangentStiffness * t_Q(
i,
j);
223 auto t_col_base = col_data.getFTensor0N(gg, 0);
225 auto t_m = OpBase::template getLocMat<FIELD_DIM>(
FIELD_DIM * rr);
229 t_m(
i,
j) += t_D(
i,
j) * (alpha * t_row_base * t_col_base);
246struct AddFluxToRhsPipelineImpl<
256 static MoFEMErrorCode
add(
258 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
260 boost::shared_ptr<MatrixDouble> u_ptr,
double scale,
261 std::string block_name, Sev sev
266 using OP = OpFluxRhsImpl<ElasticExample::SpringBcType<BLOCKSET>,
BASE_DIM,
269 auto add_op = [&](
auto &&meshset_vec_ptr) {
270 for (
auto m : meshset_vec_ptr) {
282 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
285 (boost::format(
"%s(.*)") % block_name).str()
294 "Handling of bc type not implemented");
303struct AddFluxToLhsPipelineImpl<
313 static MoFEMErrorCode
add(
315 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
317 std::string col_field_name, std::string block_name, Sev sev
322 using OP = OpFluxLhsImpl<ElasticExample::SpringBcType<BLOCKSET>,
BASE_DIM,
325 auto add_op = [&](
auto &&meshset_vec_ptr) {
326 for (
auto m : meshset_vec_ptr) {
329 new OP(m_field,
m->getMeshsetId(), row_field_name, col_field_name));
338 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
341 (boost::format(
"%s(.*)") % block_name).str()
350 "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)
OpBaseImpl< A, EleOp > OpBase
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > uPtr