v0.14.0
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 
14 namespace MoFEM {
15 
16 template <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>::
22  template LinearForm<I>::template OpSource<
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 
30 private:
31  double heatFlux;
33 };
34 
35 template <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 
55 template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
56  typename OpBase>
58  OpBase>
59  : OpEssentialLhsImpl<DisplacementCubitBcData, BASE_DIM, FIELD_DIM, A, I,
60  OpBase> {
63 };
64 
65 template <int BASE_DIM, int FIELD_DIM, AssemblyType A, IntegrationType I,
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<
89  I>::template OpEssentialRhs<HeatFluxCubitBcData, BASE_DIM,
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 
126 template <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>::
145  template BiLinearForm<I>::template OpEssentialLhs<HeatFluxCubitBcData,
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_
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Definition: UnknownInterface.hpp:93
MOFEM_LOG_CHANNEL
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:284
MoFEM::EssentialBC
Essential boundary conditions.
Definition: Essential.hpp:111
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::SourceBoundaryNormalSpecialization
Definition: LinearFormsIntegrators.hpp:17
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
MoFEM::DisplacementCubitBcData
Definition of the displacement bc data structure.
Definition: BCData.hpp:76
BASE_DIM
constexpr int BASE_DIM
Definition: dg_projection.cpp:15
MoFEM::OpEssentialRhsImpl< HeatFluxCubitBcData, 3, FIELD_DIM, A, I, OpBase >::heatFlux
double heatFlux
Definition: EssentialHeatFluxCubitBcData.hpp:31
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::OpEssentialRhsImpl< HeatFluxCubitBcData, 3, FIELD_DIM, A, I, OpBase >::vecOfTimeScalingMethods
VecOfTimeScalingMethods vecOfTimeScalingMethods
Definition: EssentialHeatFluxCubitBcData.hpp:32
FIELD_DIM
constexpr int FIELD_DIM
Definition: child_and_parent.cpp:15
I
constexpr IntegrationType I
Definition: operators_tests.cpp:31
MoFEM::OpBaseImpl
Definition: FormsIntegrators.hpp:170
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::BcManager
Simple interface for fast problem set-up.
Definition: BcManager.hpp:25
MoFEM::AddEssentialToLhsPipelineImpl< OpEssentialLhsImpl< HeatFluxCubitBcData, BASE_DIM, FIELD_DIM, A, I, OpBase >, A, I, OpBase >::add
static MoFEMErrorCode add(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, const std::string problem_name, std::string field_name)
Definition: EssentialHeatFluxCubitBcData.hpp:137
double
MoFEM::OpEssentialLhsImpl
Enforce essential constrains on lhs.
Definition: Essential.hpp:81
MoFEM::BcManager::getBcMapByBlockName
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.
Definition: BcManager.hpp:207
MoFEM::AddEssentialToRhsPipelineImpl
Function (factory) for setting operators for rhs pipeline.
Definition: Essential.hpp:92
MoFEM::AddEssentialToLhsPipelineImpl
Function (factory) for setting operators for lhs pipeline.
Definition: Essential.hpp:103
t
constexpr double t
plate stiffness
Definition: plate.cpp:59
BiLinearForm
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::IntegrationType
IntegrationType
Form integrator integration types.
Definition: FormsIntegrators.hpp:128
MoFEM::AddEssentialToRhsPipelineImpl< OpEssentialRhsImpl< HeatFluxCubitBcData, BASE_DIM, FIELD_DIM, A, I, OpBase >, A, I, OpBase >::add
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)
Definition: EssentialHeatFluxCubitBcData.hpp:76
MoFEM::OpUnSetBc
Definition: FormsIntegrators.hpp:49
MOFEM_TAG_AND_LOG
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
Definition: LogManager.hpp:362
MoFEM::OpEssentialRhsImpl
Enforce essential constrains on rhs.
Definition: Essential.hpp:65
MoFEM::AssemblyType
AssemblyType
[Storage and set boundary conditions]
Definition: FormsIntegrators.hpp:104
MoFEM::OpEssentialRhsImpl< HeatFluxCubitBcData, 3, FIELD_DIM, A, I, OpBase >::OpSource
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 3, FIELD_DIM, SourceBoundaryNormalSpecialization > OpSource
Definition: EssentialHeatFluxCubitBcData.hpp:23
MoFEM::VecOfTimeScalingMethods
std::vector< boost::shared_ptr< ScalingMethod > > VecOfTimeScalingMethods
Vector of time scaling methods.
Definition: Natural.hpp:20
MoFEM::OpSetBc
Set indices on entities on finite element.
Definition: FormsIntegrators.hpp:38
MoFEM::FormsIntegrators
Integrator forms.
Definition: FormsIntegrators.hpp:291
MoFEM::HeatFluxCubitBcData
Definition of the heat flux bc data structure.
Definition: BCData.hpp:427
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
OP
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346