SolidBag Class Reference
+ Inheritance diagram for SolidBag:

Public Member Functions

 SolidBag ()
 
void actionsBeforeOomphTimeStep () override
 
void bendBag ()
 
void setSuctionAsBodyForce (double bodyForce)
 
- Public Member Functions inherited from SolidProblem< RefineableQDPVDElement< 3, 2 > >
 SolidProblem ()
 Constructor: set default constitutive law and time stepper. More...
 
void setName (const std::string &name)
 set function for name_ More...
 
std::string getName () const
 get function for name_ More...
 
void setElasticModulus (double elasticModulus)
 set function for elasticModulus_ More...
 
double getElasticModulus () const
 get function for elasticModulus_ More...
 
void addDissipation (double dissipation)
 
void setupRefinementParameters (const double &min_error_target, const double &max_error_target, Z2ErrorEstimator *&error_estimator_pt)
 
void addAnisotropy (double Ex, double Ey, double Ez)
 
void setOomphGravity (double gravity)
 set function for elasticModulus_ More...
 
double getOomphGravity () const
 get function for gravity_ More...
 
void setPoissonRatio (double poissonRatio)
 set function for poissonRatio_ More...
 
double getPoissonRatio () const
 get function for poissonRatio_ More...
 
void setDensity (double density)
 set function for density_ More...
 
double getDensity () const
 get function for density_ More...
 
void setBodyForceAsGravity (double gravity=9.8)
 set function for body_force_pt More...
 
void setIsPinned (std::function< bool(SolidNode *, unsigned)> isPinned)
 set function for isPinned_ More...
 
void pinBoundary (unsigned b)
 
void pinBoundaries (std::vector< unsigned > b)
 
std::enable_if< std::is_base_of< RefineableQDPVDElement< 3, 2 >, ELEMENT >::value, void > setDissipation (double dissipation)
 Sets the dissipation coefficient for all elements. More...
 
void setNewtonSolverTolerance (double Newton_solver_tolerance)
 set function for Newton_solver_tolerance More...
 
void setMaxNewtonIterations (unsigned Max_newton_iterations)
 set function for Max_newton_iterations More...
 
void setOomphTimeStep (double dt)
 set function for time step More...
 
double getOomphTimeStep () const
 get function for time step More...
 
double getOomphTime () const
 get function for current time More...
 
SolidMesh *& solid_mesh_pt ()
 Get function for the solid mesh pointer. More...
 
SolidMesh *const & solid_mesh_pt () const
 Get function for the solid mesh pointer. More...
 
SolidMesh *& traction_mesh_pt ()
 Get function for the traction mesh pointer. More...
 
SolidMesh *const & traction_mesh_pt () const
 Get function for the traction mesh pointer. More...
 
void getDomainSize (std::array< double, 3 > &min, std::array< double, 3 > &max) const
 Computes the domain size (min/max of the nodal positions in x/y/z) More...
 
void prepareForSolve ()
 
void countPinned ()
 returns statistics about pinned nodes to the console More...
 
void solveSteady (const unsigned &max_adapt=0)
 
virtual void actionsBeforeSolve ()
 
virtual void actionsAfterSolve ()
 
void solveUnsteady (double timeMax, double dt, unsigned saveCount=10, const unsigned &max_adapt=0)
 
void solveUnsteadyForgiving (double timeMax, double timeMaxMin, double dt, unsigned saveCount=10)
 
void removeOldFiles () const
 
void get_x (const Vector< double > &xi, Vector< double > &x) const
 
double getDeflection (Vector< double > xi, unsigned d) const
 
void setSolidCubicMesh (const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xMin, const double &xMax, const double &yMin, const double &yMax, const double &zMin, const double &zMax)
 
void saveSolidMesh ()
 
void loadSolidMesh (std::string infileName, bool cubic=true)
 
void writeToVTK ()
 
void getMassMomentumEnergy (double &mass, Vector< double > &com, Vector< double > &linearMomentum, Vector< double > &angularMomentum, double &elasticEnergy, double &kineticEnergy) const
 See PVDEquationsBase<DIM>::get_energy. More...
 

Private Attributes

double gripperDisplacement = 0.0
 

Additional Inherited Members

- Public Types inherited from SolidProblem< RefineableQDPVDElement< 3, 2 > >
enum  Boundary
 
- Protected Types inherited from SolidProblem< RefineableQDPVDElement< 3, 2 > >
typedef RefineableQDPVDElement< 3, 2 > ELEMENT
 
- Protected Attributes inherited from SolidProblem< RefineableQDPVDElement< 3, 2 > >
std::string name_
 
double elasticModulus_
 Elastic modulus (set via setSolid) More...
 
double poissonRatio_
 Poisson's ratio (set via setSolid) More...
 
double density_
 Density. More...
 
double gravity_
 Density. More...
 
void(* body_force_fct )(const double &time, const Vector< double > &xi, Vector< double > &b)
 Pointer to the body force function. More...
 
ConstitutiveLawconstitutive_law_pt
 Pointer to constitutive law (should be set in constructor) More...
 
SolidMeshSolid_mesh_pt
 Pointer to solid mesh. More...
 
SolidMeshTraction_mesh_pt
 Pointer to mesh of traction elements. More...
 
std::function< bool(SolidNode *, unsigned)> isPinned_
 Function to determine which nodal positions are pinned. More...
 

Constructor & Destructor Documentation

◆ SolidBag()

SolidBag::SolidBag ( )
inline
13  {
14  //read in variables from parameter file
15  double elasticModulus = 2e6;
16  double poisson = 0.4;
17  double density = 1000;
18  double length = 0.16;
19  double width = 0.13;
20  double thickness = 1e-4;
21  double resolution = 0.01;
22  double timeMax = 0.75;
23  double rim = 0.01;
24  double gripperTraverse = 0.01;
25  double gripperLength = 0.01;
26  double gripperHeight = 0.01;
27  double suctionForce = 1e3;
28 
29  setName("SolidBag1");
31  setElasticModulus(elasticModulus);
32  setPoissonRatio(poisson);
34  setSolidCubicMesh(width/resolution, 2, 2.0*length/resolution, -width / 2, width / 2, 0, thickness, -length, length);
35 
36  setIsPinned([length, gripperLength, gripperHeight, width, rim](SolidNode* n, unsigned d) {
37  if (d == 0 || d == 2)
38  { //pin gripper region in x- and z-direction
39  return ( n->is_on_boundary(Boundary::X_MIN)
40  || n->is_on_boundary(Boundary::X_MAX) )
41  && fabs(n->xi(2) - ( length - gripperLength - 0.5*gripperHeight )) < 0.51*gripperHeight;
42  }
43  else /*if (d==1)*/ { //pin rim in y-direction
44  return fabs(n->xi(0)) > width / 2 - 1.01 * rim || n->xi(2) < 1.01 * rim;
45  }
46  });
47 
48  // bend the plate into a bag
49  bendBag();
50 
53  //double d = thickness, l = width/2.0;
54  //double omega = sqrt(getElasticModulus()*std::pow(1.875*d,2)/(12*getDensity()*std::pow(l,4)));
55  //double timeScale = 2*constants::pi/omega;
56  setOomphTimeStep(0.01);
57  logger(INFO, "Time step %", getOomphTimeStep());
58 
59  // add dissipation
60  //addDissipation(getCriticalDissipation(width)); //todo: use dissipationScale?
61 
62  setSuctionAsBodyForce(suctionForce);
63 
65  linear_solver_pt()->disable_doc_time();
66  //disable_info_in_newton_solve();
68 
69  solveSteady();
70 
71  // Solve the problem
72  gripperDisplacement = gripperTraverse / timeMax * getOomphTimeStep();
73  solveUnsteady(timeMax, getOomphTimeStep(), 3);
74  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
void setSuctionAsBodyForce(double bodyForce)
Definition: SolidBag.cpp:126
void bendBag()
Definition: SolidBag.cpp:97
double gripperDisplacement
Definition: SolidBag.cpp:10
void solveSteady(const unsigned &max_adapt=0)
Definition: SolidProblem.h:421
void setElasticModulus(double elasticModulus)
set function for elasticModulus_
Definition: SolidProblem.h:133
void setName(const std::string &name)
set function for name_
Definition: SolidProblem.h:120
void prepareForSolve()
Definition: SolidProblem.h:331
void removeOldFiles() const
Definition: SolidProblem.h:516
void setSolidCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xMin, const double &xMax, const double &yMin, const double &yMax, const double &zMin, const double &zMax)
Definition: SolidProblem.h:571
void solveUnsteady(double timeMax, double dt, unsigned saveCount=10, const unsigned &max_adapt=0)
Definition: SolidProblem.h:442
void setOomphTimeStep(double dt)
set function for time step
Definition: SolidProblem.h:278
void setPoissonRatio(double poissonRatio)
set function for poissonRatio_
Definition: SolidProblem.h:188
void setDensity(double density)
set function for density_
Definition: SolidProblem.h:201
void setIsPinned(std::function< bool(SolidNode *, unsigned)> isPinned)
set function for isPinned_
Definition: SolidProblem.h:229
void setNewtonSolverTolerance(double Newton_solver_tolerance)
set function for Newton_solver_tolerance
Definition: SolidProblem.h:266
double getOomphTimeStep() const
get function for time step
Definition: SolidProblem.h:283
Definition: nodes.h:1686
density
Definition: UniformPSDSelfTest.py:19
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117

References bendBag(), UniformPSDSelfTest::density, e(), boost::multiprecision::fabs(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::getOomphTimeStep(), gripperDisplacement, INFO, logger, n, SolidProblem< RefineableQDPVDElement< 3, 2 > >::prepareForSolve(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::removeOldFiles(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setDensity(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setElasticModulus(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setIsPinned(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setName(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setNewtonSolverTolerance(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setOomphTimeStep(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setPoissonRatio(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::setSolidCubicMesh(), setSuctionAsBodyForce(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::solveSteady(), and SolidProblem< RefineableQDPVDElement< 3, 2 > >::solveUnsteady().

Member Function Documentation

◆ actionsBeforeOomphTimeStep()

void SolidBag::actionsBeforeOomphTimeStep ( )
inlineoverridevirtual

Squeeze the bag at the top from both sides by a given factor.

Parameters
distance

Reimplemented from SolidProblem< RefineableQDPVDElement< 3, 2 > >.

81  {
82  // number of nodes in mesh
83  const unsigned n_node = solid_mesh_pt()->nnode();
84  // for all nodes in mesh
85  for (unsigned i = 0; i < n_node; i++)
86  {
87  SolidNode* n_pt = solid_mesh_pt()->node_pt(i);
88  if (n_pt->position_is_pinned(0))
89  {
90  //factorMax = gripperDisplacement*dt/(0.5*W)
91  //const double factor = factorMax * n_pt->xi(2) / (Global_Physical_Variables::length.Z);
92  n_pt->x(0) += n_pt->x(0) > 0 ? -gripperDisplacement : gripperDisplacement;
93  }
94  }
95  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
SolidMesh *& solid_mesh_pt()
Get function for the solid mesh pointer.
Definition: SolidProblem.h:293
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
SolidNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global SolidNode.
Definition: mesh.h:2594
bool position_is_pinned(const unsigned &i)
Test whether the i-th coordinate is pinned, 0: false; 1: true.
Definition: nodes.h:1803

References gripperDisplacement, i, oomph::Mesh::nnode(), oomph::SolidMesh::node_pt(), oomph::SolidNode::position_is_pinned(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::solid_mesh_pt(), and oomph::Node::x().

◆ bendBag()

void SolidBag::bendBag ( )
inline
98  {
99  logger(INFO, "Bend bag");
100  double gapThickness = 1e-6;
101  // bend the plate into a bag
102  Vector<double> xi(3);
103  for (unsigned i = 0; i < solid_mesh_pt()->nnode(); i++)
104  {
105  SolidNode* n_pt = solid_mesh_pt()->node_pt(i);
106  // shift all points in y by gapThickness/2
107  n_pt->xi(1) += gapThickness / 2;
108  n_pt->x(1) += gapThickness / 2;
109  //rotate lower half (z<0) in yz-plane by 180 deg
110  if (n_pt->xi(2) < 0)
111  {
112  n_pt->xi(2) *= -1;
113  n_pt->xi(1) *= -1;
114  n_pt->x(2) *= -1;
115  n_pt->x(1) *= -1;
116  }
117  // center lowest row
118  if (n_pt->xi(2) < gapThickness)
119  {
120  n_pt->xi(1) = 0;
121  n_pt->x(1) = 0;
122  }
123  }
124  }
double & xi(const unsigned &i)
Reference to i-th Lagrangian position.
Definition: nodes.h:1883

References e(), i, INFO, logger, oomph::Mesh::nnode(), oomph::SolidMesh::node_pt(), SolidProblem< RefineableQDPVDElement< 3, 2 > >::solid_mesh_pt(), oomph::Node::x(), and oomph::SolidNode::xi().

Referenced by SolidBag().

◆ setSuctionAsBodyForce()

void SolidBag::setSuctionAsBodyForce ( double  bodyForce)
inline
127  {
128  // define a static body force
129  static double bodyForce_;
130  bodyForce_ = bodyForce;
131  logger(INFO, "Adding suction as body force, rho g = %", bodyForce);
132  body_force_fct = [](const double& time, const Vector<double>& xi, Vector<double>& b) {
133  b[0] = 0.0;
134  b[1] = xi[1] >= 0 ? bodyForce_ : -bodyForce_;
135  b[2] = 0.0;
136  };
137  }
Scalar * b
Definition: benchVecAdd.cpp:17
void(* body_force_fct)(const double &time, const Vector< double > &xi, Vector< double > &b)
Pointer to the body force function.
Definition: SolidProblem.h:81

References b, SolidProblem< RefineableQDPVDElement< 3, 2 > >::body_force_fct, INFO, and logger.

Referenced by SolidBag().

Member Data Documentation

◆ gripperDisplacement

double SolidBag::gripperDisplacement = 0.0
private

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