v0.15.0
Loading...
Searching...
No Matches
DirichletBC.cpp File Reference
#include <MoFEM.hpp>
#include <MethodForForceScaling.hpp>
#include <DirichletBC.hpp>

Go to the source code of this file.

Typedefs

using FTensor1 = FTensor::Tensor1<double, 3>
 

Functions

static MoFEMErrorCode set_numered_dofs_on_ents (const Problem *problem_ptr, const FieldBitNumber bit_number, Range &ents, boost::function< MoFEMErrorCode(const boost::shared_ptr< MoFEM::NumeredDofEntity > &dof)> for_each_dof)
 
auto get_rotation_from_vector (FTensor1 &t_omega)
 
auto get_displacement (VectorDouble3 &coords, FTensor1 t_centr, FTensor1 t_normal, double theta)
 

Typedef Documentation

◆ FTensor1

Definition at line 90 of file DirichletBC.cpp.

Function Documentation

◆ get_displacement()

auto get_displacement ( VectorDouble3 & coords,
FTensor1 t_centr,
FTensor1 t_normal,
double theta )
inline

Definition at line 115 of file DirichletBC.cpp.

116 {
117 FTensor::Index<'i', 3> i;
118 FTensor::Index<'j', 3> j;
119 FTensor::Index<'k', 3> k;
120
121 FTensor1 t_omega;
122 FTensor1 t_coords(coords[0], coords[1], coords[2]);
123 const double a = std::sqrt(t_normal(i) * t_normal(i));
124 t_omega(i) = t_normal(i) * (theta / a);
125 auto t_R = get_rotation_from_vector(t_omega);
126 FTensor1 t_delta, t_disp;
127 t_delta(i) = t_centr(i) - t_coords(i);
128 t_disp(i) = t_delta(i) - t_R(i, j) * t_delta(j);
129
130 return VectorDouble({t_disp(0), t_disp(1), t_disp(2)});
131};
auto get_rotation_from_vector(FTensor1 &t_omega)
constexpr double a
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
UBlasVector< double > VectorDouble
Definition Types.hpp:68

◆ get_rotation_from_vector()

auto get_rotation_from_vector ( FTensor1 & t_omega)
inline

Definition at line 92 of file DirichletBC.cpp.

92 {
93 FTensor::Index<'i', 3> i;
94 FTensor::Index<'j', 3> j;
95 FTensor::Index<'k', 3> k;
97 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
98 t_R(i, j) = t_kd(i, j);
99
100 const double angle = std::sqrt(t_omega(i) * t_omega(i));
101 if (std::abs(angle) < 1e-18)
102 return t_R;
103
105 t_Omega(i, j) = FTensor::levi_civita<double>(i, j, k) * t_omega(k);
106 const double a = sin(angle) / angle;
107 const double ss_2 = sin(angle / 2.);
108 const double b = 2. * ss_2 * ss_2 / (angle * angle);
109 t_R(i, j) += a * t_Omega(i, j);
110 t_R(i, j) += b * t_Omega(i, k) * t_Omega(k, j);
111
112 return t_R;
113};
Kronecker Delta class.
constexpr auto t_kd
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use

◆ set_numered_dofs_on_ents()

static MoFEMErrorCode set_numered_dofs_on_ents ( const Problem * problem_ptr,
const FieldBitNumber bit_number,
Range & ents,
boost::function< MoFEMErrorCode(const boost::shared_ptr< MoFEM::NumeredDofEntity > &dof)> for_each_dof )
static

Definition at line 11 of file DirichletBC.cpp.

15 {
17
18 auto &dofs_by_uid = problem_ptr->getNumeredRowDofsPtr()->get<Unique_mi_tag>();
19
20 for (auto eit = ents.pair_begin(); eit != ents.pair_end(); ++eit) {
21
22 auto lo_dit = dofs_by_uid.lower_bound(
23 DofEntity::getLoFieldEntityUId(bit_number, eit->first));
24 auto hi_dit = dofs_by_uid.upper_bound(
25 DofEntity::getHiFieldEntityUId(bit_number, eit->second));
26
27 for (; lo_dit != hi_dit; ++lo_dit) {
28 auto &dof = *lo_dit;
29 if (dof->getHasLocalIndex())
30 CHKERR for_each_dof(dof);
31 }
32 }
33
35};
#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.
static UId getLoFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)
static UId getHiFieldEntityUId(const FieldBitNumber bit, const EntityHandle ent)
auto & getNumeredRowDofsPtr() const
get access to numeredRowDofsPtr storing DOFs on rows