v0.14.0
Public Member Functions | List of all members
FractureMechanics::AnalyticalForces Struct Reference

#include <users_modules/fracture_mechanics/AnalyticalFun.hpp>

Inheritance diagram for FractureMechanics::AnalyticalForces:
[legend]
Collaboration diagram for FractureMechanics::AnalyticalForces:
[legend]

Public Member Functions

PetscErrorCode getForce (const EntityHandle ent, const VectorDouble3 &coords, const VectorDouble3 &normal, VectorDouble3 &forces)
 
- Public Member Functions inherited from NeumannForcesSurface::MethodForAnalyticalForce
virtual ~MethodForAnalyticalForce ()=default
 
- Public Member Functions inherited from FractureMechanics::AnalyticalOptions
PetscErrorCode getOptions ()
 
 AnalyticalOptions ()
 

Additional Inherited Members

- Public Attributes inherited from FractureMechanics::AnalyticalOptions
double aLpha
 
bool optionsInitialised
 

Detailed Description

Definition at line 51 of file AnalyticalFun.hpp.

Member Function Documentation

◆ getForce()

PetscErrorCode FractureMechanics::AnalyticalForces::getForce ( const EntityHandle  ent,
const VectorDouble3 &  coords,
const VectorDouble3 &  normal,
VectorDouble3 &  force 
)
inlinevirtual

User implemented analytical force

Parameters
coordscoordinates of integration point
normalnormal at integration point
forcereturned force
Returns
error code

Reimplemented from NeumannForcesSurface::MethodForAnalyticalForce.

Definition at line 54 of file AnalyticalFun.hpp.

55  {
56 
58 
59  // initailise options
60  if (!optionsInitialised) {
61  ierr = getOptions();
62  CHKERRQ(ierr);
63  }
64 
65  const double x = coords[0];
66  const double y = coords[1];
67  const double z = coords[2];
68  double &fx = forces[0];
69  double &fy = forces[1];
70  double &fz = forces[2];
71 
72  const double n0 = normal[0] / sqrt(pow(normal[0], 2) + pow(normal[1], 2) +
73  pow(normal[2], 2));
74  const double n1 = normal[1] / sqrt(pow(normal[0], 2) + pow(normal[1], 2) +
75  pow(normal[2], 2));
76  const double n2 = normal[2] / sqrt(pow(normal[0], 2) + pow(normal[1], 2) +
77  pow(normal[2], 2));
78 
79  const double pi = M_PI;
80  const double alpha = aLpha;
81  const double theta = atan2(z, x * sin(alpha) + y * cos(alpha));
82 
83  const double rxy =
84  sqrt(pow(x * sin(alpha) + y * cos(alpha), 2) + pow(z, 2));
85  const double sref1 = 1 / sqrt(2 * pi * rxy) * cos(theta / 2.) *
86  (1. - sin(theta / 2.) * sin(3. * theta / 2.));
87  const double sref2 = 1 / sqrt(2 * pi * rxy) * cos(theta / 2.) *
88  (1. + sin(theta / 2.) * sin(3. * theta / 2.));
89  const double sref3 = 1 / sqrt(2 * pi * rxy) * sin(theta / 2.) *
90  cos(theta / 2.) * cos(3. * theta / 2.);
91 
92  const double scal1 = sref1 * pow(sin(alpha), 2);
93  const double scal2 = sref1 * pow(cos(alpha), 2);
94  const double scal3 = sref2;
95  const double scal4 = sref1 * sin(alpha) * cos(alpha);
96  const double scal5 = sref3 * sin(alpha);
97  const double scal6 = sref3 * cos(alpha);
98 
99  // This is just example
100  fx = scal1 * n0 + scal4 * n1 + scal5 * n2;
101  fy = scal4 * n0 + scal2 * n1 + scal6 * n2;
102  fz = scal5 * n0 + scal6 * n1 + scal3 * n2;
103 
104  fx *= -1;
105  fy *= -1;
106  fz *= -1;
107 
109  }

The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
FractureMechanics::AnalyticalOptions::aLpha
double aLpha
Definition: AnalyticalFun.hpp:18
ClipperLib::pi
static const double pi
Definition: clipper.cpp:89
FractureMechanics::AnalyticalOptions::getOptions
PetscErrorCode getOptions()
Definition: AnalyticalFun.hpp:20
FractureMechanics::AnalyticalOptions::optionsInitialised
bool optionsInitialised
Definition: AnalyticalFun.hpp:19
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453