11#ifndef _NATURAL_MESHSET_TYPE_HPP_
12#define _NATURAL_MESHSET_TYPE_HPP_
24template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
26 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, FIELD_DIM, A, I,
31 std::vector<boost::shared_ptr<ScalingMethod>> smv,
32 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
45template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
47 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, FIELD_DIM, A, I,
52 std::vector<boost::shared_ptr<ScalingMethod>> smv,
53 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
59template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
62 FIELD_DIM, A, I, OpBase> {
70 std::vector<boost::shared_ptr<ScalingMethod>> smv,
71 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
95template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
98 I>::template
OpSource<1, FIELD_DIM> {
105 boost::shared_ptr<Range> ents_ptr,
106 std::vector<boost::shared_ptr<ScalingMethod>> smv,
107 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
112 std::vector<boost::shared_ptr<ScalingMethod>> smv,
113 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
120template <AssemblyType A, IntegrationType I,
typename OpBase>
130 boost::shared_ptr<Range> ents_ptr,
131 std::vector<boost::shared_ptr<ScalingMethod>> smv,
132 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
137 std::vector<boost::shared_ptr<ScalingMethod>> smv,
138 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
142 double scalarValue = 0;
148template <AssemblyType A, IntegrationType I,
typename OpBase>
150 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, 1, A, I, OpBase> {
157 std::vector<boost::shared_ptr<ScalingMethod>> smv,
158 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
164template <AssemblyType A, IntegrationType I,
typename OpBase>
166 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 1, 1, A, I, OpBase> {
173 std::vector<boost::shared_ptr<ScalingMethod>> smv,
174 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
180template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
183 I>::template OpNormalMixVecTimesScalar<FIELD_DIM> {
189 const std::string
field_name,
const double value,
190 boost::shared_ptr<Range> ents_ptr,
191 std::vector<boost::shared_ptr<ScalingMethod>> smv,
192 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
197 std::vector<boost::shared_ptr<ScalingMethod>> smv,
198 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
204template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
206 :
OpFluxRhsImpl<NaturalMeshsetType<UNKNOWNSET>, 3, FIELD_DIM, A, I,
210 std::vector<boost::shared_ptr<ScalingMethod>> smv,
211 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
217template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
220 FIELD_DIM, A, I, OpBase> {
223 std::vector<boost::shared_ptr<ScalingMethod>> smv,
224 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
232template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
235 :
OpFluxRhsImpl<NaturalMeshsetTypeVectorScaling<UNKNOWNSET>, 1, FIELD_DIM,
241 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
247template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
251 I>::template
OpSource<1, FIELD_DIM> {
258 boost::shared_ptr<Range> ents_ptr,
260 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
266 ScalarFun user_fun = [](
double,
double,
double) {
return 1; });
275template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
279 boost::shared_ptr<Range> ents_ptr,
280 std::vector<boost::shared_ptr<ScalingMethod>> smv,
284 this->tForce(
i) = t_force(
i);
285 this->entsPtr = ents_ptr;
288template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
291 std::vector<boost::shared_ptr<ScalingMethod>> smv,
297 tScaledForce(
i) = tForce(
i) * userFun(x, y, z);
302 vecOfTimeScalingMethods(smv), userFun(user_fun) {
303 this->timeScalingFun = [
this](
const double t) {
305 for (
auto &o : vecOfTimeScalingMethods) {
311 static_assert(
FIELD_DIM > 1,
"Not implemented for scalar field");
314template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
318 std::vector<boost::shared_ptr<ScalingMethod>> smv,
325template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
331 auto cubit_meshset_ptr =
336 CHKERR cubit_meshset_ptr->getBcDataStructure(bc_data);
338 this->tForce(0) = bc_data.
data.value3;
340 this->tForce(1) = bc_data.
data.value4;
342 this->tForce(2) = bc_data.
data.value5;
345 this->tForce(
i) *= bc_data.
data.value1;
347 this->entsPtr = boost::make_shared<Range>();
348 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
349 *(this->entsPtr),
true);
354template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
358 std::vector<boost::shared_ptr<ScalingMethod>> smv,
365template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
371 auto cubit_meshset_ptr =
375 std::vector<double> block_data;
376 CHKERR cubit_meshset_ptr->getAttributes(block_data);
379 <<
"BLOCKSET is expected to have " <<
FIELD_DIM
380 <<
" attributes but has size " << block_data.size();
383 "Size of attribute in BLOCKSET is too small");
388 <<
"Flux blockset " << cubit_meshset_ptr->getName();
390 <<
"Number of attributes " << block_data.size();
392 for (
unsigned int ii = 0; ii !=
FIELD_DIM; ++ii) {
393 this->tForce(ii) = block_data[ii];
396 this->entsPtr = boost::make_shared<Range>();
397 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
398 *(this->entsPtr),
true);
401 <<
"tForce vector initialised: " << this->tForce;
403 <<
"Number of elements " << this->entsPtr->size();
408template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
412 std::vector<boost::shared_ptr<ScalingMethod>> smv,
419template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
424 auto t_normal = this->getFTensor1Normal();
428 this->tForce(
i) = t_normal(
i);
429 this->tForce.normalize();
430 this->tForce(
i) *= this->surfacePressure;
434 CHKERR Parent::iNtegrate(data);
438template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
444 auto cubit_meshset_ptr =
449 CHKERR cubit_meshset_ptr->getBcDataStructure(pressure_data);
450 this->surfacePressure = pressure_data.
data.value1;
452 this->entsPtr = boost::make_shared<Range>();
453 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
454 *(this->entsPtr),
true);
459template <AssemblyType A, IntegrationType I,
typename OpBase>
461 OpFluxRhsImpl(
const std::string
field_name,
const double value,
462 boost::shared_ptr<Range> ents_ptr,
463 std::vector<boost::shared_ptr<ScalingMethod>> smv,
466 this->scalarValue = value;
467 this->entsPtr = ents_ptr;
470template <AssemblyType A, IntegrationType I,
typename OpBase>
473 std::vector<boost::shared_ptr<ScalingMethod>> smv,
478 return scalarValue * userFun(x, y, z);
482 vecOfTimeScalingMethods(smv), userFun(user_fun) {
484 this->timeScalingFun = [
this](
const double t) {
486 for (
auto &o : vecOfTimeScalingMethods) {
493template <AssemblyType A, IntegrationType I,
typename OpBase>
496 std::vector<boost::shared_ptr<ScalingMethod>> smv,
ScalarFun user_fun)
502template <AssemblyType A, IntegrationType I,
typename OpBase>
508 auto cubit_meshset_ptr =
511 std::vector<double> block_data;
512 CHKERR cubit_meshset_ptr->getAttributes(block_data);
513 if (block_data.size() != 1) {
515 "Expected that block has one attribute, e.g. heat flux value");
517 this->scalarValue = block_data[0];
519 this->entsPtr = boost::make_shared<Range>();
520 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
521 *(this->entsPtr),
true);
524 <<
"Flux blockset " << cubit_meshset_ptr->getName();
526 <<
"Scalar attribute value: " << this->scalarValue;
531template <AssemblyType A, IntegrationType I,
typename OpBase>
535 std::vector<boost::shared_ptr<ScalingMethod>> smv,
542template <AssemblyType A, IntegrationType I,
typename OpBase>
548 auto cubit_meshset_ptr =
552 CHKERR cubit_meshset_ptr->getBcDataStructure(heat_flux);
553 this->scalarValue = heat_flux.
data.value1;
555 this->entsPtr = boost::make_shared<Range>();
556 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
557 *(this->entsPtr),
true);
562template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
564 OpFluxRhsImpl(
const std::string
field_name,
const double value,
565 boost::shared_ptr<Range> ents_ptr,
566 std::vector<boost::shared_ptr<ScalingMethod>> smv,
569 this->scalarValue = value;
570 this->entsPtr = ents_ptr;
573template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
576 std::vector<boost::shared_ptr<ScalingMethod>> smv,
581 return scalarValue * userFun(x, y, z);
585 vecOfTimeScalingMethods(smv), userFun(user_fun) {
587 this->timeScalingFun = [
this](
const double t) {
589 for (
auto &o : vecOfTimeScalingMethods) {
596template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
600 std::vector<boost::shared_ptr<ScalingMethod>> smv,
607template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
613 auto cubit_meshset_ptr =
616 std::vector<double> attr_vec;
617 cubit_meshset_ptr->getAttributes(attr_vec);
618 if (attr_vec.size() != 1)
620 this->scalarValue = attr_vec[0];
622 this->entsPtr = boost::make_shared<Range>();
623 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
624 *(this->entsPtr),
true);
629template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
633 std::vector<boost::shared_ptr<ScalingMethod>> smv,
640template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
646 auto cubit_meshset_ptr =
651 CHKERR cubit_meshset_ptr->getBcDataStructure(mydata);
652 this->scalarValue = mydata.
data.value1;
654 this->entsPtr = boost::make_shared<Range>();
655 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
656 *(this->entsPtr),
true);
671template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
677 boost::shared_ptr<Range> ents_ptr,
682 this->tForce(
i) = t_force(
i);
683 this->entsPtr = ents_ptr;
686template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
687OpFluxRhsImpl<NaturalMeshsetTypeVectorScaling<UNKNOWNSET>, 1,
FIELD_DIM,
A,
I,
696 auto t = this->getFEMethod()->ts_t;
697 for (
auto &o : vecOfTimeVectorScalingMethods) {
698 auto vec = o->getVector(
t);
699 this->tForce(
i) = vec(
i) * userFun(x, y, z);
703 vecOfTimeVectorScalingMethods(smv), userFun(user_fun) {
705 static_assert(
FIELD_DIM > 1,
"Not implemented for scalar field");
708template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
709OpFluxRhsImpl<NaturalMeshsetTypeVectorScaling<BLOCKSET>, 1,
FIELD_DIM,
A,
I,
720template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
726 auto cubit_meshset_ptr =
730 std::vector<double> block_data;
731 CHKERR cubit_meshset_ptr->getAttributes(block_data);
734 <<
"BLOCKSET is expected to have " <<
FIELD_DIM
735 <<
" attributes but has size " << block_data.size();
739 "Size of attribute in BLOCKSET is too small");
743 for (
unsigned int ii = 0; ii !=
FIELD_DIM; ++ii) {
744 this->tForce(ii) = block_data[ii];
748 <<
"Flux blockset " << cubit_meshset_ptr->getName();
750 <<
"Number of attributes " << block_data.size();
752 <<
"tForce vector initialised: " << this->tForce;
754 this->entsPtr = boost::make_shared<Range>();
755 CHKERR m_field.
get_moab().get_entities_by_handle(cubit_meshset_ptr->meshset,
756 *(this->entsPtr),
true);
775 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
777 std::vector<boost::shared_ptr<ScalingMethod>> smv, std::string block_name,
787 auto add_op = [&](
auto &&meshset_vec_ptr) {
788 for (
auto m : meshset_vec_ptr) {
791 new OP(m_field,
m->getMeshsetId(),
field_name, smv, user_fun));
812 (boost::format(
"%s(.*)") % block_name).str()
821 "Handling of bc type not implemented");
828 add(boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
830 std::vector<boost::shared_ptr<ScalingMethod>> smv,
831 std::string block_name,
Sev sev) {
833 pipeline, m_field,
field_name, smv, block_name,
834 [](
double,
double,
double) {
return 1; }, sev);
852 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
854 std::vector<boost::shared_ptr<ScalingMethod>> smv,
866 auto add_opv = [&](
auto &&meshset_vec_ptr) {
867 for (
auto m : meshset_vec_ptr) {
870 new OPV(m_field,
m->getMeshsetId(),
field_name, vsmv, user_fun));
882 (boost::format(
"%s(.*)") % block_name).str()
891 "Handling of bc type not implemented");
898 add(boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
900 std::vector<boost::shared_ptr<ScalingMethod>> smv,
902 std::string block_name,
Sev sev) {
904 pipeline, m_field,
field_name, smv, vsmv, block_name,
905 [](
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.
std::vector< boost::shared_ptr< ScalingMethod > > VecOfTimeScalingMethods
Vector of time scaling methods.
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::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.
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 1, FIELD_DIM > OpSource
FTensor::Tensor1< double, FIELD_DIM > tForce
VecOfTimeVectorScalingMethods< FIELD_DIM > vecOfTimeVectorScalingMethods
OpFluxRhsImpl(const std::string field_name, FTensor::Tensor1< double, FIELD_DIM > t_force, boost::shared_ptr< Range > ents_ptr, std::vector< boost::shared_ptr< TimeScaleVector< FIELD_DIM > > > smv, ScalarFun user_fun=[](double, double, double) { return 1;})
MoFEMErrorCode getMeshsetData(MoFEM::Interface &m_field, int ms_id)
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 1, 1 > OpSource
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.