v0.13.2
Loading...
Searching...
No Matches
EssentialDisplacementCubitBcData.hpp
Go to the documentation of this file.
1/**
2 * @file EssentialDisplacementCubitBcData.hpp
3 * @brief Implementations specialisation for DisplacementCubitBcData
4 * @version 0.13.2
5 * @date 2022-09-18
6 *
7 * @copyright Copyright (c) 2022
8 *
9 */
10
11#ifndef _ESSENTIAL_DISPLACEMENTCUBITBCDATA_HPP__
12#define _ESSENTIAL_DISPLACEMENTCUBITBCDATA_HPP__
13
14namespace MoFEM {
15
16/**
17 * @brief Specialization for DisplacementCubitBcData
18 *
19 * Specialization to enforce blocksets which DisplacementCubitBcData ptr. That
20 * is to enforce displacement constraints. set
21 *
22 * @tparam
23 */
26 boost::shared_ptr<FEMethod> fe_ptr,
27 std::vector<boost::shared_ptr<ScalingMethod>> smv,
28 bool get_coords = false);
29
30 MoFEMErrorCode operator()();
31
32protected:
34 boost::weak_ptr<FEMethod> fePtr;
37};
38
39template <int FIELD_DIM, AssemblyType A, IntegrationType I, typename OpBase>
41 : FormsIntegrators<OpBase>::template Assembly<A>::template LinearForm<
42 I>::template OpSource<1, FIELD_DIM> {
43
46
47 OpEssentialRhsImpl(const std::string field_name,
48 boost::shared_ptr<DisplacementCubitBcData> bc_data,
49 boost::shared_ptr<Range> ents_ptr,
50 std::vector<boost::shared_ptr<ScalingMethod>> smv);
51
52private:
55};
56
57template <int FIELD_DIM, AssemblyType A, IntegrationType I, typename OpBase>
59 OpEssentialRhsImpl(const std::string field_name,
60 boost::shared_ptr<DisplacementCubitBcData> bc_data,
61 boost::shared_ptr<Range> ents_ptr,
62 std::vector<boost::shared_ptr<ScalingMethod>> smv)
63 : OpSource(
64 field_name, [this](double, double, double) { return tVal; },
65 ents_ptr),
66 vecOfTimeScalingMethods(smv) {
67 static_assert(FIELD_DIM > 1, "Is not implemented for scalar field");
68
70 tVal(i) = 0;
71 if (bc_data->data.flag1 == 1)
72 tVal(0) = -bc_data->data.value1;
73 if (bc_data->data.flag2 == 1 && FIELD_DIM > 1)
74 tVal(1) = -bc_data->data.value2;
75 if (bc_data->data.flag3 == 1 && FIELD_DIM > 2)
76 tVal(2) = -bc_data->data.value3;
77
78 this->timeScalingFun = [this](const double t) {
79 double s = 1;
80 for (auto &o : vecOfTimeScalingMethods) {
81 s *= o->getScale(t);
82 }
83 return s;
84 };
85}
86
88 typename OpBase>
90 OpBase>
91 : FormsIntegrators<OpBase>::template Assembly<A>::template BiLinearForm<
92 I>::template OpMass<BASE_DIM, FIELD_DIM> {
93
94 using OpMass = typename FormsIntegrators<OpBase>::template Assembly<
96
97 OpEssentialLhsImpl(const std::string field_name,
98 boost::shared_ptr<Range> ents_ptr);
99};
100
101template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
102 typename OpBase>
104 OpBase>::OpEssentialLhsImpl(const std::string field_name,
105 boost::shared_ptr<Range>
106 ents_ptr)
107 : OpMass(
109
110 [](double, double, double) constexpr { return 1; },
111
112 ents_ptr) {}
113
114template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
115 typename OpBase>
117
119 OpBase>,
120 A, I, OpBase
121
122 > {
123
125
127
128 MoFEM::Interface &m_field,
129 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
130 const std::string problem_name, std::string field_name,
131 boost::shared_ptr<MatrixDouble> field_mat_ptr,
132 std::vector<boost::shared_ptr<ScalingMethod>> smv
133
134 ) {
136
137 using OP =
138 typename EssentialBC<OpBase>::template Assembly<A>::template LinearForm<
140 FIELD_DIM>;
141 using OpInternal = typename FormsIntegrators<OpBase>::template Assembly<
142 A>::template LinearForm<I>::template OpBaseTimesVector<BASE_DIM,
143 FIELD_DIM, 1>;
144
145 auto add_op = [&](auto &bcs) {
147 for (auto &m : bcs) {
148 if (auto bc = m.second->dispBcPtr) {
149 auto &bc_id = m.first;
150 auto regex_str =
151 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
152 if (std::regex_match(bc_id, std::regex(regex_str))) {
153 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialRhs") << *bc;
154 pipeline.push_back(
155 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
156 pipeline.push_back(
157 new OP(field_name, bc, m.second->getBcEntsPtr(), smv));
158 pipeline.push_back(new OpInternal(
159 field_name, field_mat_ptr,
160 [](double, double, double) constexpr { return 1.; },
161 m.second->getBcEntsPtr()));
162 pipeline.push_back(new OpUnSetBc(field_name));
163 }
164 }
165 }
166 MOFEM_LOG_CHANNEL("SELF");
168 };
169
170 CHKERR add_op(m_field.getInterface<BcManager>()->getBcMapByBlockName());
171
173 }
174};
175
176template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
177 typename OpBase>
179
181 OpBase>,
182 A, I, OpBase
183
184 > {
185
187
189
190 MoFEM::Interface &m_field,
191 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
192 const std::string problem_name, std::string field_name
193
194 ) {
196
197 using OP = typename EssentialBC<OpBase>::template Assembly<A>::
200
201 auto add_op = [&](auto &bcs) {
203 for (auto &m : bcs) {
204 if (auto bc = m.second->dispBcPtr) {
205 auto &bc_id = m.first;
206 auto regex_str =
207 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
208 if (std::regex_match(bc_id, std::regex(regex_str))) {
209 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialLhs") << *bc;
210 pipeline.push_back(
211 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
212 pipeline.push_back(new OP(field_name, m.second->getBcEntsPtr()));
213 pipeline.push_back(new OpUnSetBc(field_name));
214 }
215 }
216 }
217 MOFEM_LOG_CHANNEL("SELF");
219 };
220
221 CHKERR add_op(m_field.getInterface<BcManager>()->getBcMapByBlockName());
222
224 }
225};
226
227} // namespace MoFEM
228
229#endif // _ESSENTIAL_DISPLACEMENTCUBITBCDATA_HPP__
static Index< 'o', 3 > o
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
Definition: LogManager.hpp:359
constexpr int FIELD_DIM
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
FTensor::Index< 'm', SPACE_DIM > m
IntegrationType
Form integrator integration types.
AssemblyType
[Storage and set boundary conditions]
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:284
constexpr int BASE_DIM
FTensor::Index< 'i', SPACE_DIM > i
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
std::vector< boost::shared_ptr< ScalingMethod > > VecOfTimeScalingMethods
Vector of time scaling methods.
Definition: Natural.hpp:20
constexpr IntegrationType I
constexpr AssemblyType A
EssentialBC< BoundaryEleOp >::Assembly< A >::BiLinearForm< GAUSS >::OpEssentialLhs< DisplacementCubitBcData, 1, SPACE_DIM > OpEssentialLhs
Definition: plastic.cpp:90
EssentialBC< BoundaryEleOp >::Assembly< A >::LinearForm< GAUSS >::OpEssentialRhs< DisplacementCubitBcData, 1, SPACE_DIM > OpEssentialRhs
Definition: plastic.cpp:92
constexpr double t
plate stiffness
Definition: plate.cpp:59
constexpr auto field_name
static MoFEMErrorCode add(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, const std::string problem_name, std::string field_name)
Function (factory) for setting operators for lhs pipeline.
Definition: Essential.hpp:93
static MoFEMErrorCode add(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, const std::string problem_name, std::string field_name, boost::shared_ptr< MatrixDouble > field_mat_ptr, std::vector< boost::shared_ptr< ScalingMethod > > smv)
Function (factory) for setting operators for rhs pipeline.
Definition: Essential.hpp:82
Simple interface for fast problem set-up.
Definition: BcManager.hpp:24
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.
Definition: BcManager.hpp:200
Deprecated interface functions.
Definition of the displacement bc data structure.
Definition: BCData.hpp:72
Essential boundary conditions.
Definition: Essential.hpp:101
Class (Function) to enforce essential constrains.
Definition: Essential.hpp:39
typename FormsIntegrators< OpBase >::template Assembly< A >::template BiLinearForm< I >::template OpMass< BASE_DIM, FIELD_DIM > OpMass
Enforce essential constrains on lhs.
Definition: Essential.hpp:71
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 1, FIELD_DIM > OpSource
Enforce essential constrains on rhs.
Definition: Essential.hpp:55
Set indices on entities on finite element.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.