11#ifndef _NATURAL_MESHSET_TYPE_HPP_
12#define _NATURAL_MESHSET_TYPE_HPP_
25template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
27 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, FIELD_DIM, A, I,
32 std::vector<boost::shared_ptr<ScalingMethod>> smv,
33 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
46template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
48 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, FIELD_DIM, A, I,
53 std::vector<boost::shared_ptr<ScalingMethod>> smv,
54 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
64template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
67 FIELD_DIM, A, I, OpBase> {
75 std::vector<boost::shared_ptr<ScalingMethod>> smv,
76 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
81 std::vector<boost::shared_ptr<ScalingMethod>> smv,
82 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
90template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
93 FIELD_DIM, A, I, OpBase> {
101 std::vector<boost::shared_ptr<ScalingMethod>> smv,
102 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
125template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
128 I>::template
OpSource<1, FIELD_DIM> {
135 boost::shared_ptr<Range> ents_ptr,
136 std::vector<boost::shared_ptr<ScalingMethod>> smv,
137 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
142 std::vector<boost::shared_ptr<ScalingMethod>> smv,
143 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
150template <AssemblyType A, IntegrationType I,
typename OpBase>
160 boost::shared_ptr<Range> ents_ptr,
161 std::vector<boost::shared_ptr<ScalingMethod>> smv,
162 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
167 std::vector<boost::shared_ptr<ScalingMethod>> smv,
168 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
172 double scalarValue = 0;
178template <AssemblyType A, IntegrationType I,
typename OpBase>
180 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, 1, A, I, OpBase> {
187 std::vector<boost::shared_ptr<ScalingMethod>> smv,
188 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
194template <AssemblyType A, IntegrationType I,
typename OpBase>
196 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, 1, A, I, OpBase> {
203 std::vector<boost::shared_ptr<ScalingMethod>> smv,
204 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
210template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
213 I>::template OpNormalMixVecTimesScalar<FIELD_DIM> {
219 const std::string
field_name,
const double value,
220 boost::shared_ptr<Range> ents_ptr,
221 std::vector<boost::shared_ptr<ScalingMethod>> smv,
222 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
227 std::vector<boost::shared_ptr<ScalingMethod>> smv,
228 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
234template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
236 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 3, FIELD_DIM, A, I,
240 std::vector<boost::shared_ptr<ScalingMethod>> smv,
241 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
247template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
250 FIELD_DIM, A, I, OpBase> {
253 std::vector<boost::shared_ptr<ScalingMethod>> smv,
254 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
262template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
265 :
OpFluxRhsImpl<NaturalMeshsetTypeVectorScaling<UNKNOWNSET>, 1, FIELD_DIM,
271 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
277template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
281 I>::template
OpSource<1, FIELD_DIM> {
288 boost::shared_ptr<Range> ents_ptr,
290 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
296 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
305template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
309 boost::shared_ptr<Range> ents_ptr,
310 std::vector<boost::shared_ptr<ScalingMethod>> smv,
314 this->tForce(
i) = t_force(
i);
315 this->entsPtr = ents_ptr;
318template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
321 std::vector<boost::shared_ptr<ScalingMethod>> smv,
327 tScaledForce(
i) = tForce(
i) * userFun(x, y, z);
332 vecOfTimeScalingMethods(smv), userFun(user_fun) {
333 this->timeScalingFun = [
this](
const double t) {
335 for (
auto &o : vecOfTimeScalingMethods) {
341 static_assert(
FIELD_DIM > 1,
"Not implemented for scalar field");
344template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
348 std::vector<boost::shared_ptr<ScalingMethod>> smv,
355template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
361 auto cubit_meshset_ptr =
366 CHKERR cubit_meshset_ptr->getBcDataStructure(bc_data);
368 this->tForce(0) = bc_data.
data.value3;
370 this->tForce(1) = bc_data.
data.value4;
372 this->tForce(2) = bc_data.
data.value5;
375 this->tForce(
i) *= bc_data.
data.value1;
377 this->entsPtr = boost::make_shared<Range>();
378 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
379 *(this->entsPtr),
true);
384template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
388 std::vector<boost::shared_ptr<ScalingMethod>> smv,
395template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
401 auto cubit_meshset_ptr =
405 std::vector<double> block_data;
406 CHKERR cubit_meshset_ptr->getAttributes(block_data);
410 <<
"BLOCKSET is expected to have " <<
FIELD_DIM
411 <<
" attributes but has size " << block_data.size();
414 "Size of attribute in BLOCKSET is too small");
418 for (
unsigned int ii = 0; ii !=
FIELD_DIM; ++ii) {
419 this->tForce(ii) = block_data[ii];
423 <<
"Flux blockset " << cubit_meshset_ptr->getName();
425 <<
"Number of attributes " << block_data.size();
427 this->entsPtr = boost::make_shared<Range>();
428 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
429 *(this->entsPtr),
true);
432 <<
"tForce vector initialised: " << this->tForce;
434 <<
"Number of elements " << this->entsPtr->size();
439template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
443 std::vector<boost::shared_ptr<ScalingMethod>> smv,
450template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
453 std::vector<boost::shared_ptr<ScalingMethod>> smv,
458template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
463 auto t_normal = this->getFTensor1Normal();
467 this->tForce(
i) = t_normal(
i);
468 this->tForce.normalize();
469 this->tForce(
i) *= this->surfacePressure;
473 CHKERR Parent::iNtegrate(data);
477template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
483 auto cubit_meshset_ptr =
488 CHKERR cubit_meshset_ptr->getBcDataStructure(pressure_data);
489 this->surfacePressure = pressure_data.
data.value1;
491 this->entsPtr = boost::make_shared<Range>();
492 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
493 *(this->entsPtr),
true);
495 <<
"Pressure blockset from PRESSURESET ms_id = " << ms_id;
497 <<
"Number of elements " << this->entsPtr->size();
501template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
506 std::vector<boost::shared_ptr<ScalingMethod>> smv,
512template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
518 auto cubit_meshset_ptr =
522 std::vector<double> block_data;
523 CHKERR cubit_meshset_ptr->getAttributes(block_data);
526 <<
"BLOCKSET is expected to have " <<
FIELD_DIM
527 <<
" attributes but has size " << block_data.size();
528 if (block_data.size() != 1) {
530 "Size of attribute in BLOCKSET is too small");
532 this->surfacePressure = block_data[0];
535 <<
"Pressure blockset " << cubit_meshset_ptr->getName();
537 this->entsPtr = boost::make_shared<Range>();
538 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
539 *(this->entsPtr),
true);
541 <<
"Number of elements " << this->entsPtr->size();
546template <AssemblyType A, IntegrationType I,
typename OpBase>
548 OpFluxRhsImpl(
const std::string
field_name,
const double value,
549 boost::shared_ptr<Range> ents_ptr,
550 std::vector<boost::shared_ptr<ScalingMethod>> smv,
553 this->scalarValue = value;
554 this->entsPtr = ents_ptr;
557template <AssemblyType A, IntegrationType I,
typename OpBase>
560 std::vector<boost::shared_ptr<ScalingMethod>> smv,
565 return scalarValue * userFun(x, y, z);
569 vecOfTimeScalingMethods(smv), userFun(user_fun) {
571 this->timeScalingFun = [
this](
const double t) {
573 for (
auto &o : vecOfTimeScalingMethods) {
580template <AssemblyType A, IntegrationType I,
typename OpBase>
583 std::vector<boost::shared_ptr<ScalingMethod>> smv,
ScalarFun user_fun)
589template <AssemblyType A, IntegrationType I,
typename OpBase>
595 auto cubit_meshset_ptr =
598 std::vector<double> block_data;
599 CHKERR cubit_meshset_ptr->getAttributes(block_data);
600 if (block_data.size() != 1) {
602 "Expected that block has one attribute, e.g. heat flux value");
604 this->scalarValue = block_data[0];
606 this->entsPtr = boost::make_shared<Range>();
607 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
608 *(this->entsPtr),
true);
611 <<
"Flux blockset " << cubit_meshset_ptr->getName();
613 <<
"Scalar attribute value: " << this->scalarValue;
618template <AssemblyType A, IntegrationType I,
typename OpBase>
622 std::vector<boost::shared_ptr<ScalingMethod>> smv,
629template <AssemblyType A, IntegrationType I,
typename OpBase>
635 auto cubit_meshset_ptr =
639 CHKERR cubit_meshset_ptr->getBcDataStructure(heat_flux);
640 this->scalarValue = heat_flux.
data.value1;
642 this->entsPtr = boost::make_shared<Range>();
643 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
644 *(this->entsPtr),
true);
649template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
651 OpFluxRhsImpl(
const std::string
field_name,
const double value,
652 boost::shared_ptr<Range> ents_ptr,
653 std::vector<boost::shared_ptr<ScalingMethod>> smv,
656 this->scalarValue = value;
657 this->entsPtr = ents_ptr;
660template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
663 std::vector<boost::shared_ptr<ScalingMethod>> smv,
668 return scalarValue * userFun(x, y, z);
672 vecOfTimeScalingMethods(smv), userFun(user_fun) {
674 this->timeScalingFun = [
this](
const double t) {
676 for (
auto &o : vecOfTimeScalingMethods) {
683template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
687 std::vector<boost::shared_ptr<ScalingMethod>> smv,
694template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
700 auto cubit_meshset_ptr =
703 std::vector<double> attr_vec;
704 cubit_meshset_ptr->getAttributes(attr_vec);
705 if (attr_vec.size() != 1)
707 this->scalarValue = attr_vec[0];
709 this->entsPtr = boost::make_shared<Range>();
710 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
711 *(this->entsPtr),
true);
716template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
720 std::vector<boost::shared_ptr<ScalingMethod>> smv,
727template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
733 auto cubit_meshset_ptr =
738 CHKERR cubit_meshset_ptr->getBcDataStructure(mydata);
739 this->scalarValue = mydata.
data.value1;
741 this->entsPtr = boost::make_shared<Range>();
742 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
743 *(this->entsPtr),
true);
758template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
764 boost::shared_ptr<Range> ents_ptr,
769 this->tForce(
i) = t_force(
i);
770 this->entsPtr = ents_ptr;
773template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
783 auto t = this->getFEMethod()->ts_t;
784 for (
auto &o : vecOfTimeVectorScalingMethods) {
785 auto vec = o->getVector(
t);
786 this->tForce(
i) = vec(
i) * userFun(x, y, z);
790 vecOfTimeVectorScalingMethods(smv), userFun(user_fun) {
792 static_assert(
FIELD_DIM > 1,
"Not implemented for scalar field");
795template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
796OpFluxRhsImpl<NaturalMeshsetTypeVectorScaling<BLOCKSET>, 1,
FIELD_DIM,
A,
I,
807template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
813 auto cubit_meshset_ptr =
817 std::vector<double> block_data;
818 CHKERR cubit_meshset_ptr->getAttributes(block_data);
821 <<
"BLOCKSET is expected to have " <<
FIELD_DIM
822 <<
" attributes but has size " << block_data.size();
826 "Size of attribute in BLOCKSET is too small");
830 for (
unsigned int ii = 0; ii !=
FIELD_DIM; ++ii) {
831 this->tForce(ii) = block_data[ii];
835 <<
"Flux blockset " << cubit_meshset_ptr->getName();
837 <<
"Number of attributes " << block_data.size();
839 <<
"tForce vector initialised: " << this->tForce;
841 this->entsPtr = boost::make_shared<Range>();
842 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
843 *(this->entsPtr),
true);
862 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
864 std::vector<boost::shared_ptr<ScalingMethod>> smv, std::string block_name,
874 auto add_op = [&](
auto &&meshset_vec_ptr) {
875 for (
auto m : meshset_vec_ptr) {
878 new OP(m_field,
m->getMeshsetId(),
field_name, smv, user_fun));
899 (boost::format(
"%s(.*)") % block_name).str()
908 "Handling of bc type not implemented");
915 add(boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
917 std::vector<boost::shared_ptr<ScalingMethod>> smv,
918 std::string block_name,
Sev sev) {
920 pipeline, m_field,
field_name, smv, block_name,
921 [](
double,
double,
double) {
return 1; }, sev);
939 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
941 std::vector<boost::shared_ptr<ScalingMethod>> smv, std::string block_name,
952 auto add_opv = [&](
auto &&meshset_vec_ptr) {
953 for (
auto m : meshset_vec_ptr) {
956 new OPV(m_field,
m->getMeshsetId(),
field_name, smv, user_fun));
968 (boost::format(
"%s(.*)") % block_name).str()
977 "Handling of bc type not implemented");
984 add(boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
986 std::vector<boost::shared_ptr<ScalingMethod>> smv, std::string block_name,
989 pipeline, m_field,
field_name, smv, block_name,
990 [](
double,
double,
double) {
return 1; }, sev);
1008 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
1010 std::vector<boost::shared_ptr<ScalingMethod>> smv,
1022 auto add_opv = [&](
auto &&meshset_vec_ptr) {
1023 for (
auto m : meshset_vec_ptr) {
1026 new OPV(m_field,
m->getMeshsetId(),
field_name, vsmv, user_fun));
1038 (boost::format(
"%s(.*)") % block_name).str()
1047 "Handling of bc type not implemented");
1054 add(boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
1056 std::vector<boost::shared_ptr<ScalingMethod>> smv,
1058 std::string block_name,
Sev sev) {
1060 pipeline, m_field,
field_name, smv, vsmv, block_name,
1061 [](
double,
double,
double) {
return 1; }, sev);
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
CubitBC
Types of sets and boundary conditions.
@ MOFEM_DATA_INCONSISTENCY
#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.
SeverityLevel
Severity levels.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
FTensor::Index< 'i', SPACE_DIM > i
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
std::vector< boost::shared_ptr< TimeScaleVector< FIELD_DIM > > > VecOfTimeVectorScalingMethods
Vector of time vector scaling methods.
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data)
std::vector< boost::shared_ptr< ScalingMethod > > VecOfTimeScalingMethods
Vector of time scaling methods.
MoFEM::OpBrokenTopoBase OP
constexpr IntegrationType I
constexpr double t
plate stiffness
constexpr auto field_name
FTensor::Index< 'm', 3 > m
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, std::vector< boost::shared_ptr< ScalingMethod > > smv, std::string block_name, Sev sev)
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, std::vector< boost::shared_ptr< ScalingMethod > > smv, std::string block_name, ScalarFun user_fun, Sev sev)
AddFluxToRhsPipelineImpl()=delete
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, std::vector< boost::shared_ptr< ScalingMethod > > smv, std::vector< boost::shared_ptr< TimeScaleVector< FIELD_DIM > > > vsmv, std::string block_name, Sev sev)
AddFluxToRhsPipelineImpl()=delete
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, std::vector< boost::shared_ptr< ScalingMethod > > smv, std::vector< boost::shared_ptr< TimeScaleVector< FIELD_DIM > > > vsmv, std::string block_name, ScalarFun user_fun, Sev sev)
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, std::vector< boost::shared_ptr< ScalingMethod > > smv, std::string block_name, ScalarFun user_fun, Sev sev)
AddFluxToRhsPipelineImpl()=delete
static MoFEMErrorCode add(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, MoFEM::Interface &m_field, const std::string field_name, std::vector< boost::shared_ptr< ScalingMethod > > smv, std::string block_name, Sev sev)
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition of the force bc data structure.
Definition of the heat flux bc data structure.
Interface for managing meshsets containing materials and boundary conditions.
Natural boundary conditions.
Type generating natural b.c. specialisations for meshsets.
FTensor::Tensor1< double, FIELD_DIM > tForce
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 1, FIELD_DIM > OpSource
VecOfTimeVectorScalingMethods< FIELD_DIM > vecOfTimeVectorScalingMethods
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 1, 1 > OpSource
MoFEMErrorCode getMeshsetData(MoFEM::Interface &m_field, int ms_id)
VecOfTimeScalingMethods vecOfTimeScalingMethods
Base class for OpFluxRhsImpl<NaturalMeshsetType<T>, 1, FIELD_DIM, A, I, OpBase>
VecOfTimeScalingMethods vecOfTimeScalingMethods
FTensor::Tensor1< double, FIELD_DIM > tForce
FTensor::Tensor1< double, FIELD_DIM > tScaledForce
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 1, FIELD_DIM > OpSource
VecOfTimeScalingMethods vecOfTimeScalingMethods
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpNormalMixVecTimesScalar< FIELD_DIM > OpSource
Definition of the pressure bc data structure.
Definition of the temperature bc data structure.
Force scale operator for reading four columns (time and vector)
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.