11#ifndef _ESSENTIAL_DISPLACEMENTCUBITBCDATA_HPP__
12#define _ESSENTIAL_DISPLACEMENTCUBITBCDATA_HPP__
50 rotated_displacement(
i) = 0;
52 auto get_rotation = [&](
auto &
omega) {
56 rotation_matrix(
i,
j) = kronecker_delta(
i,
j);
59 if (std::abs(angle) < std::numeric_limits<double>::epsilon())
60 return rotation_matrix;
63 t_omega(
i,
j) = FTensor::levi_civita<double>(
i,
j,
k) *
omega(
k);
64 const double a = sin(angle) / angle;
65 const double sin_squared = sin(angle / 2.) * sin(angle / 2.);
66 const double b = 2. * sin_squared / (angle * angle);
67 rotation_matrix(
i,
j) +=
a * t_omega(
i,
j);
68 rotation_matrix(
i,
j) += b * t_omega(
i,
k) * t_omega(
k,
j);
70 return rotation_matrix;
73 auto rotation = get_rotation(angles);
75 coordinate_distance(
i) = offset(
i) - coordinates(
i);
76 rotated_displacement(
i) =
77 coordinate_distance(
i) - rotation(
j,
i) * coordinate_distance(
j);
79 return rotated_displacement;
93 boost::shared_ptr<FEMethod> fe_ptr,
94 std::vector<boost::shared_ptr<ScalingMethod>> smv,
95 bool get_coords =
false);
115 boost::shared_ptr<FEMethod> fe_ptr,
double diag,
136 boost::shared_ptr<FEMethod> fe_ptr,
double diag,
165 boost::shared_ptr<std::vector<double>> reaction_ptr =
nullptr,
166 boost::shared_ptr<BlockReactions> block_reactions =
nullptr);
178 char reactionBlockName[255];
181template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
184 I>::template
OpSource<1, FIELD_DIM> {
190 boost::shared_ptr<DisplacementCubitBcData> bc_data,
191 boost::shared_ptr<Range> ents_ptr,
192 std::vector<boost::shared_ptr<ScalingMethod>> smv);
206 t_ret(
i) = tVal(
i) + rot(
i);
212 if (bc_data->data.flag4 || bc_data->data.flag5 || bc_data->data.flag6) {
213 return [
this](
double x,
double y,
double z) {
214 return this->rotFunction(x, y, z);
217 return [
this](
double x,
double y,
double z) {
return tVal; };
221template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
224 boost::shared_ptr<DisplacementCubitBcData> bc_data,
225 boost::shared_ptr<Range> ents_ptr,
226 std::vector<boost::shared_ptr<ScalingMethod>> smv)
228 vecOfTimeScalingMethods(smv) {
229 static_assert(
FIELD_DIM > 1,
"Is not implemented for scalar field");
236 if (bc_data->data.flag1 == 1)
237 tVal(0) = -bc_data->data.value1;
238 if (bc_data->data.flag2 == 1 &&
FIELD_DIM > 1)
239 tVal(1) = -bc_data->data.value2;
240 if (bc_data->data.flag3 == 1 &&
FIELD_DIM > 2)
241 tVal(2) = -bc_data->data.value3;
242 if (bc_data->data.flag4 == 1 &&
FIELD_DIM > 2)
243 tAngles(0) = -bc_data->data.value4;
244 if (bc_data->data.flag5 == 1 &&
FIELD_DIM > 2)
245 tAngles(1) = -bc_data->data.value5;
246 if (bc_data->data.flag6 == 1 &&
FIELD_DIM > 1)
247 tAngles(2) = -bc_data->data.value6;
249 if (
auto ext_bc_data =
252 for (
int a = 0;
a != 3; ++
a)
253 tOffset(
a) = ext_bc_data->rotOffset[
a];
256 this->timeScalingFun = [
this](
const double t) {
258 for (
auto &o : vecOfTimeScalingMethods) {
270 I>::template
OpMass<BASE_DIM, FIELD_DIM> {
276 boost::shared_ptr<Range> ents_ptr);
283 boost::shared_ptr<Range>
307 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
308 const std::string problem_name, std::string
field_name,
309 boost::shared_ptr<MatrixDouble> field_mat_ptr,
310 std::vector<boost::shared_ptr<ScalingMethod>> smv
324 auto add_op = [&](
auto &bcs) {
326 for (
auto &
m : bcs) {
327 if (
auto bc =
m.second->dispBcPtr) {
328 auto &bc_id =
m.first;
330 (boost::format(
"%s_%s_(.*)") % problem_name %
field_name).str();
331 if (std::regex_match(bc_id, std::regex(regex_str))) {
337 pipeline.push_back(
new OpInternal(
339 [](
double,
double,
double)
constexpr {
return 1.; },
340 m.second->getBcEntsPtr()));
370 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
371 const std::string problem_name, std::string
field_name
380 auto add_op = [&](
auto &bcs) {
382 for (
auto &
m : bcs) {
383 if (
auto bc =
m.second->dispBcPtr) {
384 auto &bc_id =
m.first;
386 (boost::format(
"%s_%s_(.*)") % problem_name %
field_name).str();
387 if (std::regex_match(bc_id, std::regex(regex_str))) {
391 pipeline.push_back(
new OP(
field_name,
m.second->getBcEntsPtr()));
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
constexpr double omega
Save field DOFS on vertices/tags.
SeverityLevel
Severity levels.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
BcMapByBlockName & getBcMapByBlockName()
Get the boundary condition map.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
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(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, const std::string problem_name, std::string field_name)
AddEssentialToLhsPipelineImpl()=delete
Function (factory) for setting operators for lhs pipeline.
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)
AddEssentialToRhsPipelineImpl()=delete
Function (factory) for setting operators for rhs pipeline.
Boundary condition manager for finite element problem setup.
Deprecated interface functions.
A specialized version of DisplacementCubitBcData that includes an additional rotation offset.
std::array< double, 3 > rotOffset
DisplacementCubitBcDataWithRotation()
static FTensor::Tensor1< double, 3 > GetRotDisp(const FTensor::Tensor1< double, 3 > &angles, FTensor::Tensor1< double, 3 > coordinates, FTensor::Tensor1< double, 3 > offset=FTensor::Tensor1< double, 3 >{ 0., 0., 0.})
Calculates the rotated displacement given the rotation angles, coordinates, and an optional offset.
Definition of the displacement bc data structure.
Essential boundary conditions.
virtual ~EssentialPostProcLhs()=default
boost::weak_ptr< FEMethod > fePtr
SmartPetscObj< Mat > vLhs
MoFEM::Interface & mField
Class (Function) to enforce essential constrains on the left hand side diagonal.
boost::weak_ptr< FEMethod > fePtr
MoFEM::Interface & mField
SmartPetscObj< Vec > vRhs
virtual ~EssentialPostProcRhs()=default
Class (Function) to enforce essential constrains on the right hand side diagonal.
LogManager::SeverityLevel sevLevel
boost::shared_ptr< std::vector< double > > reactionPtr
boost::weak_ptr< FEMethod > fePtr
boost::shared_ptr< BlockReactions > blockReactions
std::map< std::string, BlockReaction > BlockReactions
std::array< double, 6 > BlockReaction
MoFEM::Interface & mField
SmartPetscObj< Vec > vRhs
Class (Function) to calculate residual side diagonal.
virtual ~EssentialPreProc()=default
VecOfTimeScalingMethods vecOfTimeScalingMethods
boost::weak_ptr< FEMethod > fePtr
MoFEM::Interface & mField
Class (Function) to enforce essential constrains.
typename FormsIntegrators< OpBase >::template Assembly< A >::template BiLinearForm< I >::template OpMass< BASE_DIM, FIELD_DIM > OpMass
Enforce essential constrains on lhs.
VecOfTimeScalingMethods vecOfTimeScalingMethods
FTensor::Tensor1< double, 3 > tOffset
typename FormsIntegrators< OpBase >::template Assembly< A >::template LinearForm< I >::template OpSource< 1, FIELD_DIM > OpSource
VectorFun< FIELD_DIM > initDispFunction(boost::shared_ptr< DisplacementCubitBcData > bc_data)
FTensor::Tensor1< double, 3 > tAngles
FTensor::Tensor1< double, FIELD_DIM > tVal
FTensor::Tensor1< double, FIELD_DIM > rotFunction(double x, double y, double z)
Enforce essential constrains on rhs.
Set indices on entities on finite element.
Unset indices on entities on finite element.
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.