v0.13.2
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 <int FIELD_DIM, AssemblyType A, IntegrationType I, typename OpBase>
18 : FormsIntegrators<OpBase>::template Assembly<A>::template LinearForm<I>::
19 template OpSource<3, FIELD_DIM, SourceBoundaryNormalSpecialization> {
20
21 using OpSource = typename FormsIntegrators<OpBase>::template Assembly<A>::
24
25 OpEssentialRhsImpl(const std::string field_name,
26 boost::shared_ptr<HeatFluxCubitBcData> bc_data,
27 boost::shared_ptr<Range> ents_ptr,
28 std::vector<boost::shared_ptr<ScalingMethod>> smv);
29
30private:
31 double heatFlux;
33};
34
35template <int FIELD_DIM, AssemblyType A, IntegrationType I, typename OpBase>
37 OpEssentialRhsImpl(const std::string field_name,
38 boost::shared_ptr<HeatFluxCubitBcData> bc_data,
39 boost::shared_ptr<Range> ents_ptr,
40 std::vector<boost::shared_ptr<ScalingMethod>> smv)
41 : OpSource(
42 field_name, [this](double, double, double) { return heatFlux; },
43 ents_ptr),
44 vecOfTimeScalingMethods(smv) {
45 heatFlux = -bc_data->data.value1;
46 this->timeScalingFun = [this](const double t) {
47 double s = 1;
48 for (auto &o : vecOfTimeScalingMethods) {
49 s *= o->getScale(t);
50 }
51 return s;
52 };
53}
54
56 typename OpBase>
58 OpBase>
59 : OpEssentialLhsImpl<DisplacementCubitBcData, BASE_DIM, FIELD_DIM, A, I,
60 OpBase> {
62 OpBase>::OpEssentialLhsImpl;
63};
64
66 typename OpBase>
68
70 A, I, OpBase
71
72 > {
73
75
77
78 MoFEM::Interface &m_field,
79 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
80 const std::string problem_name, std::string field_name,
81 boost::shared_ptr<MatrixDouble> field_mat_ptr,
82 std::vector<boost::shared_ptr<ScalingMethod>> smv
83
84 ) {
86
87 using OP =
88 typename EssentialBC<OpBase>::template Assembly<A>::template LinearForm<
90 FIELD_DIM>;
91 using OpInternal = typename FormsIntegrators<OpBase>::template Assembly<
92 A>::template LinearForm<I>::template OpBaseTimesVector<BASE_DIM,
93 FIELD_DIM, 1>;
94
95 auto add_op = [&](auto &bcs) {
97 for (auto &m : bcs) {
98 if (auto bc = m.second->heatFluxBcPtr) {
99 auto &bc_id = m.first;
100 auto regex_str =
101 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
102 if (std::regex_match(bc_id, std::regex(regex_str))) {
103 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialRhs") << *bc;
104 pipeline.push_back(
105 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
106 pipeline.push_back(
107 new OP(field_name, bc, m.second->getBcEntsPtr(), smv));
108 pipeline.push_back(new OpInternal(
109 field_name, field_mat_ptr,
110 [](double, double, double) constexpr { return 1.; },
111 m.second->getBcEntsPtr()));
112 pipeline.push_back(new OpUnSetBc(field_name));
113 }
114 }
115 }
116 MOFEM_LOG_CHANNEL("SELF");
118 };
119
120 CHKERR add_op(m_field.getInterface<BcManager>()->getBcMapByBlockName());
121
123 }
124};
125
126template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
127 typename OpBase>
129
131 A, I, OpBase
132
133 > {
134
136
138
139 MoFEM::Interface &m_field,
140 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
141 const std::string problem_name, std::string field_name) {
143
144 using OP = typename EssentialBC<OpBase>::template Assembly<A>::
147
148 auto add_op = [&](auto &bcs) {
150 for (auto &m : bcs) {
151 if (auto bc = m.second->heatFluxBcPtr) {
152 auto &bc_id = m.first;
153 auto regex_str =
154 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
155 if (std::regex_match(bc_id, std::regex(regex_str))) {
156 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "OpEssentialLhs") << *bc;
157 pipeline.push_back(
158 new OpSetBc(field_name, false, m.second->getBcMarkersPtr()));
159 pipeline.push_back(new OP(field_name, 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
174} // namespace MoFEM
175
176#endif //_ESSENTIAL_HEATFLUXCUBITBCDATA_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
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
Definition of the heat flux bc data structure.
Definition: BCData.hpp:422
Enforce essential constrains on lhs.
Definition: Essential.hpp:71
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 3, FIELD_DIM, SourceBoundaryNormalSpecialization > 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.