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 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 ()
 
virtual void actionsBeforeSolve ()
 
virtual void actionsAfterSolve ()
 
void solveUnsteady (double timeMax, 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 name)
 
void writeToVTK ()
 
void getMassMomentumEnergy (double &mass, Vector< double > &com, Vector< double > &linearMomentum, Vector< double > &angularMomentum, double &elasticEnergy, double &kineticEnergy)
 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...
 
ConstitutiveLaw * constitutive_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
34  {
35  //read in variables from parameter file
36  double elasticModulus = 2e6;
37  double poisson = 0.4;
38  double density = 1000;
39  double length = 0.16;
40  double width = 0.13;
41  double thickness = 1e-4;
42  double resolution = 0.01;
43  double timeMax = 0.75;
44  double rim = 0.01;
45  double gripperTraverse = 0.01;
46  double gripperLength = 0.01;
47  double gripperHeight = 0.01;
48  double suctionForce = 1e3;
49 
50  setName("SolidBag1");
52  setElasticModulus(elasticModulus);
53  setPoissonRatio(poisson);
54  setDensity(density);
55  setSolidCubicMesh(width/resolution, 2, 2.0*length/resolution, -width / 2, width / 2, 0, thickness, -length, length);
56 
57  setIsPinned([length, gripperLength, gripperHeight, width, rim](SolidNode* n, unsigned d) {
58  if (d == 0 || d == 2)
59  { //pin gripper region in x- and z-direction
60  return ( n->is_on_boundary(Boundary::X_MIN)
61  || n->is_on_boundary(Boundary::X_MAX) )
62  && fabs(n->xi(2) - ( length - gripperLength - 0.5*gripperHeight )) < 0.51*gripperHeight;
63  }
64  else /*if (d==1)*/ { //pin rim in y-direction
65  return fabs(n->xi(0)) > width / 2 - 1.01 * rim || n->xi(2) < 1.01 * rim;
66  }
67  });
68 
69  // bend the plate into a bag
70  bendBag();
71 
74  //double d = thickness, l = width/2.0;
75  //double omega = sqrt(getElasticModulus()*std::pow(1.875*d,2)/(12*getDensity()*std::pow(l,4)));
76  //double timeScale = 2*constants::pi/omega;
77  setOomphTimeStep(0.01);
78  logger(INFO, "Time step %", getOomphTimeStep());
79 
80  // add dissipation
81  //addDissipation(getCriticalDissipation(width)); //todo: use dissipationScale?
82 
83  setSuctionAsBodyForce(suctionForce);
84 
86  linear_solver_pt()->disable_doc_time();
87  //disable_info_in_newton_solve();
89 
90  solveSteady();
91 
92  // Solve the problem
93  gripperDisplacement = gripperTraverse / timeMax * getOomphTimeStep();
94  solveUnsteady(timeMax, getOomphTimeStep(), 3);
95  }
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 setSuctionAsBodyForce(double bodyForce)
Definition: SolidBag1.cpp:147
void bendBag()
Definition: SolidBag1.cpp:118
double gripperDisplacement
Definition: SolidBag1.cpp:31
void setElasticModulus(double elasticModulus)
set function for elasticModulus_
Definition: SolidProblem.h:153
void setName(const std::string &name)
set function for name_
Definition: SolidProblem.h:140
void prepareForSolve()
Definition: SolidProblem.h:322
void removeOldFiles() const
Definition: SolidProblem.h:470
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:546
void solveUnsteady(double timeMax, double dt, unsigned saveCount=10)
Definition: SolidProblem.h:431
void setOomphTimeStep(double dt)
set function for time step
Definition: SolidProblem.h:269
void setPoissonRatio(double poissonRatio)
set function for poissonRatio_
Definition: SolidProblem.h:179
void setDensity(double density)
set function for density_
Definition: SolidProblem.h:192
void setIsPinned(std::function< bool(SolidNode *, unsigned)> isPinned)
set function for isPinned_
Definition: SolidProblem.h:220
void solveSteady()
Definition: SolidProblem.h:411
void setNewtonSolverTolerance(double Newton_solver_tolerance)
set function for Newton_solver_tolerance
Definition: SolidProblem.h:257
double getOomphTimeStep() const
get function for time step
Definition: SolidProblem.h:274

References bendBag(), 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 > >.

102  {
103  // number of nodes in mesh
104  const unsigned n_node = solid_mesh_pt()->nnode();
105  // for all nodes in mesh
106  for (unsigned i = 0; i < n_node; i++)
107  {
108  SolidNode* n_pt = solid_mesh_pt()->node_pt(i);
109  if (n_pt->position_is_pinned(0))
110  {
111  //factorMax = gripperDisplacement*dt/(0.5*W)
112  //const double factor = factorMax * n_pt->xi(2) / (Global_Physical_Variables::length.Z);
113  n_pt->x(0) += n_pt->x(0) > 0 ? -gripperDisplacement : gripperDisplacement;
114  }
115  }
116  }
SolidMesh *& solid_mesh_pt()
Get function for the solid mesh pointer.
Definition: SolidProblem.h:284
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

References gripperDisplacement, constants::i, and SolidProblem< RefineableQDPVDElement< 3, 2 > >::solid_mesh_pt().

◆ bendBag()

void SolidBag::bendBag ( )
inline
119  {
120  logger(INFO, "Bend bag");
121  double gapThickness = 1e-6;
122  // bend the plate into a bag
123  Vector<double> xi(3);
124  for (unsigned i = 0; i < solid_mesh_pt()->nnode(); i++)
125  {
126  SolidNode* n_pt = solid_mesh_pt()->node_pt(i);
127  // shift all points in y by gapThickness/2
128  n_pt->xi(1) += gapThickness / 2;
129  n_pt->x(1) += gapThickness / 2;
130  //rotate lower half (z<0) in yz-plane by 180 deg
131  if (n_pt->xi(2) < 0)
132  {
133  n_pt->xi(2) *= -1;
134  n_pt->xi(1) *= -1;
135  n_pt->x(2) *= -1;
136  n_pt->x(1) *= -1;
137  }
138  // center lowest row
139  if (n_pt->xi(2) < gapThickness)
140  {
141  n_pt->xi(1) = 0;
142  n_pt->x(1) = 0;
143  }
144  }
145  }

References constants::i, INFO, logger, and SolidProblem< RefineableQDPVDElement< 3, 2 > >::solid_mesh_pt().

Referenced by SolidBag().

◆ setSuctionAsBodyForce()

void SolidBag::setSuctionAsBodyForce ( double  bodyForce)
inline
148  {
149  // define a static body force
150  static double bodyForce_;
151  bodyForce_ = bodyForce;
152  logger(INFO, "Adding suction as body force, rho g = %", bodyForce);
153  body_force_fct = [](const double& time, const Vector<double>& xi, Vector<double>& b) {
154  b[0] = 0.0;
155  b[1] = xi[1] >= 0 ? bodyForce_ : -bodyForce_;
156  b[2] = 0.0;
157  };
158  }
void(* body_force_fct)(const double &time, const Vector< double > &xi, Vector< double > &b)
Pointer to the body force function.
Definition: SolidProblem.h:101

References 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: