ElementAnalysis Class Reference
+ Inheritance diagram for ElementAnalysis:

Public Member Functions

 ElementAnalysis ()
 
- Public Member Functions inherited from SCoupling< M, O >
 SCoupling ()=default
 
void solveSurfaceCoupling ()
 
void solveSurfaceCoupling (unsigned nStep)
 
void solveSurfaceCouplingFixedSolid ()
 
TriangleWallcreateTriangleWall (std::array< Vec3D, 3 > vertex)
 
void updateTriangleWall (TriangleWall *&wall, std::array< Vec3D, 3 > vertex)
 
void computeOneTimeStepForSCoupling (const unsigned &nStepsMercury)
 
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 ()
 
- 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 ()
 
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
35  {
36  //set name
37  setName("ElementAnalysis");
38  #ifdef OOMPH_HAS_MUMPS
39  linear_solver_pt()=new MumpsSolver;
40  #endif
41  //remove existing output files
43 
44  // setup oomph
45  setElasticModulus(1e6);
46  setDensity(2500);
47  setSolidCubicMesh(3, 3, 3, -1, 1, -1, 1, -1, 1);
48  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
49  prepareForSolve();
50  coupleBoundary(Boundary::Z_MAX);
51 
52  // number of elements
53  logger(INFO, "\nElements: %", solid_mesh_pt()->nelement());
54  std::cout << "Center Positions:\n";
55  for (int e = 0; e < solid_mesh_pt()->nelement(); ++e) {
56  ELEMENT* e_pt = dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(e));
57  std::cout << " " << e << ": " << getXiCenter(e_pt) << std::endl;
58  }
59 
60  ELEMENT* e_pt = dynamic_cast<ELEMENT*>(solid_mesh_pt()->element_pt(22));
61 // // Set up memory for the shape/test functions
62 // Shape psi(e_pt->nnode());
63 // Vector<double> s(3, 0.0);
64 // // Get shape/test fcts
65 // e_pt->shape(s, psi);
66 // GeomObject* geom_obj_pt = 0;
67 // e_pt->locate_zeta(x, geom_obj_pt, s);
68 
69  logger(INFO, "Nodes per element: %", e_pt->nnode());
70  std::cout << "Nodal positions element 22:\n";
71  for (int n = 0; n < e_pt->nnode(); ++n) {
72  SolidNode* n_pt = dynamic_cast<SolidNode*>(e_pt->node_pt(n));
73  std::cout << " " << n << ": " << n_pt->x(0) << ' ' << n_pt->x(1) << ' ' << n_pt->x(2) << std::endl;
74  }
75 
76  // Loop over the integration points
77  logger(INFO, "Integration points per element: %", e_pt->integral_pt()->nweight());
78  std::cout << "Local and global coordinates, weight, Jacobian and shape functions at integration points:\n";
79  unsigned dim = e_pt->nodal_dimension();
80  for (unsigned ipt = 0; ipt < e_pt->integral_pt()->nweight(); ipt++) {
81  Vector<double> s(dim);
82  // Assign the values of s
83  for (unsigned i = 0; i < dim; ++i) {
84  s[i] = e_pt->integral_pt()->knot(ipt, i);
85  }
86  //set shape and its derivatives
87  Shape psi(e_pt->nnode(), e_pt->nnodal_position_type());
88  DShape dpsidxi(e_pt->nnode(), e_pt->nnodal_position_type(), dim);
89  double J = e_pt->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
90  // weight
91  double w = e_pt->integral_pt()->weight(ipt);
92  //interpolate
93  Vector<double> interpolated_x(dim, 0.0);
94  Vector<double> interpolated_xi(dim, 0.0);
95  std::stringstream psi_ss;
96  for (int l = 0; l < e_pt->nnode(); ++l) { // test functions
97  for (int k = 0; k < e_pt->nnodal_position_type(); ++k) { // eqn_number
98  for (int i = 0; i < dim; ++i) {
99  //local_eqn = position_local_eqn_at_node(k, i);
100  interpolated_xi[i] += e_pt->lagrangian_position_gen(l, k, i) * psi(l,k);
101  interpolated_x[i] += e_pt->nodal_position_gen(l, k, i) * psi(l, k);
102  }
103  psi_ss << psi(l, k) << ' ';
104  }
105  }
106  std::cout << "ipt " << ipt << " w " << w << " J " << J << " s " << s << " xi " << interpolated_xi << " psi " << psi_ss.str() << std::endl;
107  }
108  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
void removeOldFiles() const
Definition: BaseCoupling.h:68
void setName(std::string name)
Definition: BaseCoupling.h:59
static Vector< double > getXiCenter(ELEMENT *e_pt)
Definition: ElementAnalysis.cpp:110
void coupleBoundary(unsigned b)
Definition: SCoupling.h:681
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

References SCoupling< M, O >::coupleBoundary(), getXiCenter(), constants::i, INFO, logger, n, BaseCoupling< M, O >::removeOldFiles(), and BaseCoupling< M, O >::setName().

Member Function Documentation

◆ getXiCenter()

static Vector<double> ElementAnalysis::getXiCenter ( ELEMENT e_pt)
inlinestatic
110  {
111  Vector<double> center(3);
112  for (int n = 0; n < e_pt->nnode(); ++n) {
113  SolidNode* n_pt = dynamic_cast<SolidNode*>(e_pt->node_pt(n));
114  for (unsigned d = 0; d < n_pt->ndim(); ++d) {
115  center[d] += n_pt->xi(d) / e_pt->nnode();
116  }
117  }
118  return center;
119  }

References n.

Referenced by ElementAnalysis().


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