ElementAnalysis Class Reference
+ Inheritance diagram for ElementAnalysis:

Public Member Functions

 ElementAnalysis ()
 
- Public Member Functions inherited from SCoupling< M, O >
 SCoupling ()=default
 
void solveSurfaceCoupling (const unsigned max_adapt=0)
 
void solveSurfaceCoupling (unsigned nStep, const unsigned max_adapt)
 
void solveSurfaceCouplingForgiving (unsigned nStep, double timeMaxMin=-constants::inf, const unsigned max_adapt=0)
 
void solveSurfaceCouplingFixedSolid ()
 
TriangleWallcreateTriangleWall (std::array< Vec3D, 3 > vertex)
 
void updateTriangleWall (TriangleWall *&wall, std::array< Vec3D, 3 > vertex)
 
void computeOneTimeStepForSCoupling (const unsigned &nStepsMercury, const unsigned max_adapt=0)
 
void createDPMWallsFromFiniteElems ()
 
void updateDPMWallsFromFiniteElems ()
 
void updateTractionOnFiniteElems ()
 
bool computeSCouplingForcesFromTriangles (ELEMENT *const elem_pt, const unsigned &nTriangles, unsigned &wallID, Vector< Vector< double > > &nodalCouplingForces)
 
void getElementBoundingBox (ELEMENT *&elem_pt, Vec3D &min, Vec3D &max)
 
void getSCoupledElements ()
 
void coupleBoundary (unsigned b)
 
void coupleBoundaries (std::vector< unsigned > b)
 
void disableLogSurfaceCoupling ()
 
void setSolidFeelsParticles (bool val)
 
bool getSolidFeelsParticles () const
 
- Public Member Functions inherited from BaseCoupling< M, O >
 BaseCoupling ()=default
 
void setName (std::string name)
 
std::string getName () const
 
void removeOldFiles () const
 
void writeEneTimeStep (std::ostream &os) const override
 
void writeEneHeader (std::ostream &os) const override
 
void solveOomph (int max_adapt=0)
 
void checkResidual ()
 
void solveMercury (unsigned long nt)
 
void setCGWidth (const double &width)
 
double getCGWidth ()
 
bool useCGMapping ()
 
CGFunctions::LucyXYZ getCGFunction ()
 

Static Public Member Functions

static Vector< doublegetXiCenter (ELEMENT *e_pt)
 

Additional Inherited Members

- Public Types inherited from SCoupling< M, O >
typedef O::ELEMENT ELEMENT
 

Detailed Description

Define a coupled problem

Constructor & Destructor Documentation

◆ ElementAnalysis()

ElementAnalysis::ElementAnalysis ( )
inline
14  {
15  //set name
16  setName("ElementAnalysis");
17  #ifdef OOMPH_HAS_MUMPS
18  linear_solver_pt()=new MumpsSolver;
19  #endif
20  //remove existing output files
22 
23  // setup oomph
24  setElasticModulus(1e6);
25  setDensity(2500);
26  setSolidCubicMesh(3, 3, 3, -1, 1, -1, 1, -1, 1);
27  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
28  prepareForSolve();
29  coupleBoundary(Boundary::Z_MAX);
30 
31  // number of elements
32  logger(INFO, "\nElements: %", solid_mesh_pt()->nelement());
33  std::cout << "Center Positions:\n";
34  for (int e = 0; e < solid_mesh_pt()->nelement(); ++e) {
35  ELEMENT* e_pt = dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(e));
36  std::cout << " " << e << ": " << getXiCenter(e_pt) << std::endl;
37  }
38 
39  ELEMENT* e_pt = dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(22));
40 // // Set up memory for the shape/test functions
41 // Shape psi(e_pt->nnode());
42 // Vector<double> s(3, 0.0);
43 // // Get shape/test fcts
44 // e_pt->shape(s, psi);
45 // GeomObject* geom_obj_pt = 0;
46 // e_pt->locate_zeta(x, geom_obj_pt, s);
47 
48  logger(INFO, "Nodes per element: %", e_pt->nnode());
49  std::cout << "Nodal positions element 22:\n";
50  for (int n = 0; n < e_pt->nnode(); ++n) {
51  SolidNode* n_pt = dynamic_cast<SolidNode*>(e_pt->node_pt(n));
52  std::cout << " " << n << ": " << n_pt->x(0) << ' ' << n_pt->x(1) << ' ' << n_pt->x(2) << std::endl;
53  }
54 
55  // Loop over the integration points
56  logger(INFO, "Integration points per element: %", e_pt->integral_pt()->nweight());
57  std::cout << "Local and global coordinates, weight, Jacobian and shape functions at integration points:\n";
58  unsigned dim = e_pt->nodal_dimension();
59  for (unsigned ipt = 0; ipt < e_pt->integral_pt()->nweight(); ipt++) {
60  Vector<double> s(dim);
61  // Assign the values of s
62  for (unsigned i = 0; i < dim; ++i) {
63  s[i] = e_pt->integral_pt()->knot(ipt, i);
64  }
65  //set shape and its derivatives
66  Shape psi(e_pt->nnode(), e_pt->nnodal_position_type());
67  DShape dpsidxi(e_pt->nnode(), e_pt->nnodal_position_type(), dim);
68  double J = e_pt->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
69  // weight
70  double w = e_pt->integral_pt()->weight(ipt);
71  //interpolate
72  Vector<double> interpolated_x(dim, 0.0);
73  Vector<double> interpolated_xi(dim, 0.0);
74  std::stringstream psi_ss;
75  for (int l = 0; l < e_pt->nnode(); ++l) { // test functions
76  for (int k = 0; k < e_pt->nnodal_position_type(); ++k) { // eqn_number
77  for (int i = 0; i < dim; ++i) {
78  //local_eqn = position_local_eqn_at_node(k, i);
79  interpolated_xi[i] += e_pt->lagrangian_position_gen(l, k, i) * psi(l,k);
80  interpolated_x[i] += e_pt->nodal_position_gen(l, k, i) * psi(l, k);
81  }
82  psi_ss << psi(l, k) << ' ';
83  }
84  }
85  std::cout << "ipt " << ipt << " w " << w << " J " << J << " s " << s << " xi " << interpolated_xi << " psi " << psi_ss.str() << std::endl;
86  }
87  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
RowVector3d w
Definition: Matrix_resize_int.cpp:3
void removeOldFiles() const
Definition: BaseCoupling.h:47
void setName(std::string name)
Definition: BaseCoupling.h:38
static Vector< double > getXiCenter(ELEMENT *e_pt)
Definition: ElementAnalysis.cpp:89
O::ELEMENT ELEMENT
Definition: SCoupling.h:18
void coupleBoundary(unsigned b)
Definition: SCoupling.h:692
Definition: shape.h:278
Wrapper to Mumps solver.
Definition: mumps_solver.h:62
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
Definition: shape.h:76
Definition: nodes.h:1686
RealScalar s
Definition: level1_cplx_impl.h:130
char char char int int * k
Definition: level2_impl.h:374

References SCoupling< M, O >::coupleBoundary(), e(), getXiCenter(), i, INFO, J, k, logger, n, BaseCoupling< M, O >::removeOldFiles(), s, BaseCoupling< M, O >::setName(), w, and oomph::Node::x().

Member Function Documentation

◆ getXiCenter()

static Vector<double> ElementAnalysis::getXiCenter ( ELEMENT e_pt)
inlinestatic
89  {
90  Vector<double> center(3);
91  for (int n = 0; n < e_pt->nnode(); ++n) {
92  SolidNode* n_pt = dynamic_cast<SolidNode*>(e_pt->node_pt(n));
93  for (unsigned d = 0; d < n_pt->ndim(); ++d) {
94  center[d] += n_pt->xi(d) / e_pt->nnode();
95  }
96  }
97  return center;
98  }
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
double & xi(const unsigned &i)
Reference to i-th Lagrangian position.
Definition: nodes.h:1883

References n, oomph::Node::ndim(), and oomph::SolidNode::xi().

Referenced by ElementAnalysis().


The documentation for this class was generated from the following file: