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,
60 template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
67 boost::shared_ptr<MatrixDouble> u_ptr,
double scale);
73 boost::shared_ptr<MatrixDouble>
uPtr;
77 template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
84 std::string row_field_name, std::string col_field_name);
93 template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
94 OpFluxRhsImpl<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");
106 template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
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);
167 template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
168 OpFluxLhsImpl<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");
179 template <
int FIELD_DIM, AssemblyType A,
typename EleOp>
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);
245 struct AddFluxToRhsPipelineImpl<
253 AddFluxToRhsPipelineImpl() =
delete;
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");
302 struct AddFluxToLhsPipelineImpl<
310 AddFluxToLhsPipelineImpl() =
delete;
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");