v0.16.0
Loading...
Searching...
No Matches
EssentialHeatFluxCubitBcData.hpp
Go to the documentation of this file.
1/**
2 * @file EssentialHeatFluxCubitBcData.hpp
3 * @brief Specialization for essential b.c. with HeatFluxCubitBcData
4 * @version 0.13.2
5 * @date 2022-09-18
6 *
7 * @copyright Copyright (c) 2022
8 *
9 */
10
11#ifndef _ESSENTIAL_HEATFLUXCUBITBCDATA_HPP_
12#define _ESSENTIAL_HEATFLUXCUBITBCDATA_HPP_
13
14namespace MoFEM {
15
16template <AssemblyType A, typename OpBase>
18 : FormsIntegrators<OpBase>::template Assembly<A>::OpBase {
19
20 using OP = typename FormsIntegrators<OpBase>::template Assembly<A>::OpBase;
21
22 OpEssentialRhsImpl(const std::string field_name,
23 boost::shared_ptr<HeatFluxCubitBcData> bc_data,
24 boost::shared_ptr<Range> ents_ptr,
25 std::vector<boost::shared_ptr<ScalingMethod>> smv);
26
27protected:
28 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data);
29
30private:
31 double heatFlux;
33};
34
35template <AssemblyType A, typename OpBase>
37 : OpEssentialRhsImpl<HeatFluxCubitBcData, 3, 3, A, GAUSS, OpBase> {
39 OpBase>::OpEssentialRhsImpl;
40};
41
42template <AssemblyType A, typename OpBase>
44 OpEssentialRhsImpl(const std::string field_name,
45 boost::shared_ptr<HeatFluxCubitBcData> bc_data,
46 boost::shared_ptr<Range> ents_ptr,
47 std::vector<boost::shared_ptr<ScalingMethod>> smv)
48 : OP(field_name, field_name, OpBase::OPROW, ents_ptr),
49 vecOfTimeScalingMethods(smv) {
50 heatFlux = -bc_data->data.value1;
51 this->timeScalingFun = [this](const double t) {
52 double s = 1;
53 for (auto &o : vecOfTimeScalingMethods) {
54 s *= o->getScale(t);
55 }
56 return s;
57 };
58}
59
60template <AssemblyType A, typename OpBase>
65
66 FTENSOR_INDEX(3, i);
67
68 // get element volume
69 const double vol = OP::getMeasure();
70 // get integration weights
71 auto t_w = OP::getFTensor0IntegrationWeight();
72 // get base function gradient on rows
73 auto t_row_base = row_data.getFTensor1N<3>();
74 // get normal
75 auto t_normal = OP::getFTensor1NormalsAtGaussPts();
76
77 // loop over integration points
78 for (int gg = 0; gg != OP::nbIntegrationPts; gg++) {
79 // take into account Jacobian
80 const double alpha = t_w;
81
82 FTensor::Tensor1<double, 3> t_unit_normal;
83 t_unit_normal(i) = t_normal(i) / t_normal.l2();
84
85 // loop over rows base functions
86 int rr = 0;
87 for (; rr != OP::nbRows; ++rr) {
88 OP::locF[rr] += alpha * (t_row_base(i) * t_unit_normal(i));
89 ++t_row_base;
90 }
91 for (; rr < OP::nbRowBaseFunctions; ++rr)
92 ++t_row_base;
93 ++t_w; // move to another integration weight
94 ++t_normal;
95 }
96
97 OP::locF *= vol * heatFlux;
98
100}
101
102template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
103 typename OpBase>
105 OpBase>
106 : OpEssentialLhsImpl<DisplacementCubitBcData, BASE_DIM, FIELD_DIM, A, I,
107 OpBase> {
109 OpBase>::OpEssentialLhsImpl;
110};
111
112template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
113 typename OpBase>
115
117 A, I, OpBase
118
119 > {
120
122
124
125 MoFEM::Interface &m_field,
126 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
127 const std::string problem_name, std::string field_name,
128 boost::shared_ptr<MatrixDouble> field_mat_ptr,
129 std::vector<boost::shared_ptr<ScalingMethod>> smv
130
131 ) {
133
134 using OP =
135 typename EssentialBC<OpBase>::template Assembly<A>::template LinearForm<
136 I>::template OpEssentialRhs<HeatFluxCubitBcData, BASE_DIM,
137 FIELD_DIM>;
138 using OpInternal = typename FormsIntegrators<OpBase>::template Assembly<
139 A>::template LinearForm<I>::template OpBaseTimesVector<BASE_DIM,
140 FIELD_DIM,
141 FIELD_DIM>;
142
143 auto add_op = [&](auto &bcs) {
145 for (auto &m : bcs) {
146 if (auto bc = m.second->heatFluxBcPtr) {
147 auto &bc_id = m.first;
148 auto regex_str =
149 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
150 if (std::regex_match(bc_id, std::regex(regex_str))) {
151 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialRhs") << *bc;
152 pipeline.push_back(
153 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
154 pipeline.push_back(
155 new OP(field_name, bc, m.second->getBcEntsPtr(), smv));
156 pipeline.push_back(new OpInternal(
157 field_name, field_mat_ptr,
158 [](double, double, double) constexpr { return 1.; },
159 m.second->getBcEntsPtr()));
160 pipeline.push_back(new OpUnSetBc(field_name));
161 }
162 }
163 }
164 MOFEM_LOG_CHANNEL("SELF");
166 };
167
168 CHKERR add_op(m_field.getInterface<BcManager>()->getBcMapByBlockName());
169
171 }
172};
173
174template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
175 typename OpBase>
177
179 A, I, OpBase
180
181 > {
182
184
186
187 MoFEM::Interface &m_field,
188 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
189 const std::string problem_name, std::string field_name) {
191
192 using OP = typename EssentialBC<OpBase>::template Assembly<A>::
193 template BiLinearForm<I>::template OpEssentialLhs<HeatFluxCubitBcData,
195
196 auto add_op = [&](auto &bcs) {
198 for (auto &m : bcs) {
199 if (auto bc = m.second->heatFluxBcPtr) {
200 auto &bc_id = m.first;
201 auto regex_str =
202 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
203 if (std::regex_match(bc_id, std::regex(regex_str))) {
204 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialLhs") << *bc;
205 pipeline.push_back(
206 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
207 pipeline.push_back(new OP(field_name, m.second->getBcEntsPtr()));
208 pipeline.push_back(new OpUnSetBc(field_name));
209 }
210 }
211 }
212 MOFEM_LOG_CHANNEL("SELF");
214 };
215
216 CHKERR add_op(m_field.getInterface<BcManager>()->getBcMapByBlockName());
217
219 }
220};
221
222} // namespace MoFEM
223
224#endif //_ESSENTIAL_HEATFLUXCUBITBCDATA_HPP_
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define FTENSOR_INDEX(DIM, I)
constexpr int FIELD_DIM
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
constexpr int BASE_DIM
IntegrationType
Form integrator integration types.
AssemblyType
[Storage and set boundary conditions]
@ GAUSS
Gaussian quadrature integration.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
BcMapByBlockName & getBcMapByBlockName()
Get the boundary condition map.
FTensor::Index< 'i', SPACE_DIM > i
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
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
constexpr double t
plate stiffness
Definition plate.cpp:58
constexpr auto field_name
FTensor::Index< 'm', 3 > m
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.
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:92
Boundary condition manager for finite element problem setup.
Deprecated interface functions.
Definition of the displacement bc data structure.
Definition BCData.hpp:72
Data on single entity (This is passed as argument to DataOperator::doWork)
auto getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
Essential boundary conditions.
Definition of the heat flux bc data structure.
Definition BCData.hpp:423
Enforce essential constrains on lhs.
Definition Essential.hpp:81
Enforce essential constrains on rhs.
Definition Essential.hpp:65
Set indices on entities on finite element.
Unset indices on entities on finite element.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.