v0.15.0
Loading...
Searching...
No Matches
EssentialTemperatureCubitBcData.cpp
Go to the documentation of this file.
1/**
2 * @file EssentialTemperatureCubitBcData.cpp
3 * @brief Essential boundary conditions
4 * @version 13.1
5 * @date 2022-09-03
6 *
7 * @copyright Copyright (c) 2022
8 *
9 */
10
11#include <MoFEM.hpp>
12
13namespace MoFEM {
14
16 MoFEM::Interface &m_field, boost::shared_ptr<FEMethod> fe_ptr,
17 std::vector<boost::shared_ptr<ScalingMethod>> smv)
18 : mField(m_field), fePtr(fe_ptr), vecOfTimeScalingMethods(smv) {}
19
22
23 if (auto fe_method_ptr = fePtr.lock()) {
24
25 auto bc_mng = mField.getInterface<BcManager>();
26 auto fb = mField.getInterface<FieldBlas>();
27 const auto problem_name = fe_method_ptr->problemPtr->getName();
28
29 for (auto bc : bc_mng->getBcMapByBlockName()) {
30 if (auto temp_bc = bc.second->tempBcPtr) {
31
32 auto &bc_id = bc.first;
33
34 auto regex_str = (boost::format("%s_(.*)") % problem_name).str();
35 if (std::regex_match(bc_id, std::regex(regex_str))) {
36
37 auto [field_name, block_name] =
38 BcManager::extractStringFromBlockId(bc_id, problem_name);
39
40 MOFEM_LOG("WORLD", Sev::noisy)
41 << "Apply EssentialPreProc<TemperatureCubitBcData>: "
42 << problem_name << "_" << field_name << "_" << block_name;
43
44 auto verts = bc.second->bcEnts.subset_by_type(MBVERTEX);
45 auto v = temp_bc->data.value1;
46 for (auto s : vecOfTimeScalingMethods) {
47 v *= s->getScale(fe_method_ptr->ts_t);
48 }
49
50 auto lambda = [&](boost::shared_ptr<FieldEntity> field_entity_ptr) {
52 for (auto &d : field_entity_ptr->getEntFieldData())
53 d = v;
55 };
56 CHKERR fb->fieldLambdaOnEntities(lambda, field_name, &verts);
57 }
58 }
59 }
60
61 } else {
62 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
63 "Can not lock shared pointer");
64 }
65
67}
68
69} // namespace MoFEM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
static double lambda
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
constexpr auto field_name
Simple interface for fast problem set-up.
Definition BcManager.hpp:29
static std::pair< std::string, std::string > extractStringFromBlockId(const std::string block_id, const std::string prb_name)
Extract block name and block name form block id.
Deprecated interface functions.
Class (Function) to enforce essential constrains.
Definition Essential.hpp:25
Basic algebra on fields.
Definition FieldBlas.hpp:21
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.