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);
113 boost::shared_ptr<FEMethod> fe_ptr,
double diag,
132 boost::shared_ptr<FEMethod> fe_ptr,
double diag,
153 boost::shared_ptr<FEMethod> fe_ptr,
166template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
169 I>::template
OpSource<1, FIELD_DIM> {
175 boost::shared_ptr<DisplacementCubitBcData> bc_data,
176 boost::shared_ptr<Range> ents_ptr,
177 std::vector<boost::shared_ptr<ScalingMethod>> smv);
192 t_ret(
i) = tVal(
i) + rot(
i);
197template <
int FIELD_DIM, AssemblyType A, IntegrationType I,
typename OpBase>
200 boost::shared_ptr<DisplacementCubitBcData> bc_data,
201 boost::shared_ptr<Range> ents_ptr,
202 std::vector<boost::shared_ptr<ScalingMethod>> smv)
206 vecOfTimeScalingMethods(smv) {
207 static_assert(
FIELD_DIM > 1,
"Is not implemented for scalar field");
214 if (bc_data->data.flag1 == 1)
215 tVal(0) = -bc_data->data.value1;
216 if (bc_data->data.flag2 == 1 &&
FIELD_DIM > 1)
217 tVal(1) = -bc_data->data.value2;
218 if (bc_data->data.flag3 == 1 &&
FIELD_DIM > 2)
219 tVal(2) = -bc_data->data.value3;
220 if (bc_data->data.flag4 == 1 &&
FIELD_DIM > 2)
221 tAngles(0) = -bc_data->data.value4;
222 if (bc_data->data.flag5 == 1 &&
FIELD_DIM > 2)
223 tAngles(1) = -bc_data->data.value5;
224 if (bc_data->data.flag6 == 1 &&
FIELD_DIM > 1)
225 tAngles(2) = -bc_data->data.value6;
227 if (
auto ext_bc_data =
230 for (
int a = 0;
a != 3; ++
a)
231 tOffset(a) = ext_bc_data->rotOffset[
a];
234 this->timeScalingFun = [
this](
const double t) {
236 for (
auto &
o : vecOfTimeScalingMethods) {
241 if (bc_data->data.flag4 || bc_data->data.flag5 || bc_data->data.flag6) {
242 this->dispFunction = [
this](
double x,
double y,
double z) {
243 return this->rotFunction(x, y, z);
255 I>::template
OpMass<BASE_DIM, FIELD_DIM> {
261 boost::shared_ptr<Range> ents_ptr);
268 boost::shared_ptr<Range>
292 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
293 const std::string problem_name, std::string
field_name,
294 boost::shared_ptr<MatrixDouble> field_mat_ptr,
295 std::vector<boost::shared_ptr<ScalingMethod>> smv
308 auto add_op = [&](
auto &bcs) {
310 for (
auto &
m : bcs) {
311 if (
auto bc =
m.second->dispBcPtr) {
312 auto &bc_id =
m.first;
314 (boost::format(
"%s_%s_(.*)") % problem_name %
field_name).str();
315 if (std::regex_match(bc_id, std::regex(regex_str))) {
321 pipeline.push_back(
new OpInternal(
323 [](
double,
double,
double)
constexpr {
return 1.; },
324 m.second->getBcEntsPtr()));
354 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
355 const std::string problem_name, std::string
field_name
364 auto add_op = [&](
auto &bcs) {
366 for (
auto &
m : bcs) {
367 if (
auto bc =
m.second->dispBcPtr) {
368 auto &bc_id =
m.first;
370 (boost::format(
"%s_%s_(.*)") % problem_name %
field_name).str();
371 if (std::regex_match(bc_id, std::regex(regex_str))) {
375 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.
FTensor::Index< 'm', SPACE_DIM > m
SeverityLevel
Severity levels.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
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
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.
Simple interface for fast problem set-up.
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.
Deprecated interface functions.
Definition of the displacement bc data structure.
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.
Essential boundary conditions.
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
Class (Function) to enforce essential constrains on the right hand side diagonal.
VecOfTimeScalingMethods vecOfTimeScalingMethods
boost::weak_ptr< FEMethod > fePtr
MoFEM::Interface & mField
Class (Function) to enforce essential constrains.
LogManager::SeverityLevel sevLevel
boost::weak_ptr< FEMethod > fePtr
MoFEM::Interface & mField
SmartPetscObj< Vec > vRhs
Class (Function) to calculate residual side diagonal.
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 > dispFunction
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.
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.