v0.15.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, 1>;
141
142 auto add_op = [&](auto &bcs) {
144 for (auto &m : bcs) {
145 if (auto bc = m.second->heatFluxBcPtr) {
146 auto &bc_id = m.first;
147 auto regex_str =
148 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
149 if (std::regex_match(bc_id, std::regex(regex_str))) {
150 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialRhs") << *bc;
151 pipeline.push_back(
152 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
153 pipeline.push_back(
154 new OP(field_name, bc, m.second->getBcEntsPtr(), smv));
155 pipeline.push_back(new OpInternal(
156 field_name, field_mat_ptr,
157 [](double, double, double) constexpr { return 1.; },
158 m.second->getBcEntsPtr()));
159 pipeline.push_back(new OpUnSetBc(field_name));
160 }
161 }
162 }
163 MOFEM_LOG_CHANNEL("SELF");
165 };
166
167 CHKERR add_op(m_field.getInterface<BcManager>()->getBcMapByBlockName());
168
170 }
171};
172
173template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
174 typename OpBase>
176
178 A, I, OpBase
179
180 > {
181
183
185
186 MoFEM::Interface &m_field,
187 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
188 const std::string problem_name, std::string field_name) {
190
191 using OP = typename EssentialBC<OpBase>::template Assembly<A>::
192 template BiLinearForm<I>::template OpEssentialLhs<HeatFluxCubitBcData,
194
195 auto add_op = [&](auto &bcs) {
197 for (auto &m : bcs) {
198 if (auto bc = m.second->heatFluxBcPtr) {
199 auto &bc_id = m.first;
200 auto regex_str =
201 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
202 if (std::regex_match(bc_id, std::regex(regex_str))) {
203 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialLhs") << *bc;
204 pipeline.push_back(
205 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
206 pipeline.push_back(new OP(field_name, m.second->getBcEntsPtr()));
207 pipeline.push_back(new OpUnSetBc(field_name));
208 }
209 }
210 }
211 MOFEM_LOG_CHANNEL("SELF");
213 };
214
215 CHKERR add_op(m_field.getInterface<BcManager>()->getBcMapByBlockName());
216
218 }
219};
220
221} // namespace MoFEM
222
223#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]
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
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
Simple interface for fast problem set-up.
Definition BcManager.hpp:29
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.
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)
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > 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.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.