CoupledProblem Class Reference
+ Inheritance diagram for CoupledProblem:

Public Member Functions

 CoupledProblem ()
 
void setupOomph ()
 
void setupMercury ()
 
void actionsAfterTimeStep () override
 
void getSolidDeflection ()
 
- 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 ()
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ CoupledProblem()

CoupledProblem::CoupledProblem ( )
inline
15  {
16  //set name
17  setName("SolidOnParticleBed");
18  //remove existing output files
20 
21  // setup steps
22  setupOomph();
23  setupMercury();
24  setOomphTimeStep(getTimeStep());
25  setTimeMax(2000*getTimeStep());
26  setSaveCount(10);
27  logger(INFO,"Time step %", getTimeStep());
28 
29  // Solve the problem
30  writeToVTK();
32  saveSolidMesh();
33 
34  helpers::writeToFile(getName()+".gnu","set key autotitle columnheader\n"
35  "p '" + getName() + ".def' u 1:2");
36  }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
std::string getName() const
Definition: BaseCoupling.h:43
void removeOldFiles() const
Definition: BaseCoupling.h:47
void setName(std::string name)
Definition: BaseCoupling.h:38
void setupMercury()
Definition: SolidOnParticleBed.cpp:73
void setupOomph()
Definition: SolidOnParticleBed.cpp:38
void solveSurfaceCoupling(const unsigned max_adapt=0)
Definition: SCoupling.h:51
bool writeToFile(const std::string &filename, const std::string &filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:29

References BaseCoupling< M, O >::getName(), INFO, logger, BaseCoupling< M, O >::removeOldFiles(), BaseCoupling< M, O >::setName(), setupMercury(), setupOomph(), SCoupling< M, O >::solveSurfaceCoupling(), and helpers::writeToFile().

Member Function Documentation

◆ actionsAfterTimeStep()

void CoupledProblem::actionsAfterTimeStep ( )
inlineoverride
123  {
125  }
void getSolidDeflection()
Definition: SolidOnParticleBed.cpp:127

References getSolidDeflection().

◆ getSolidDeflection()

void CoupledProblem::getSolidDeflection ( )
inline
127  {
128  std::array<double,3> min;
129  std::array<double,3> max;
130  getDomainSize(min, max);
131 
132  Vector<double> xi(3);
133  xi[0] = 0.5*(max[0]+min[0]);
134  xi[1] = 0.5*(max[1]+min[1]);
135  xi[2] = min[2];
136  double deflection = getDeflection(xi,2);
137 
138  static std::ofstream file(getName()+".def");
139  file << getTime() << " " << deflection << std::endl;
140  }
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23

References BaseCoupling< M, O >::getName(), max, and min.

Referenced by actionsAfterTimeStep().

◆ setupMercury()

void CoupledProblem::setupMercury ( )
inline
73  {
74  // set domain min, max. Used to getDomainSize
75  std::array<double, 3> min;
76  std::array<double, 3> max;
77  getDomainSize(min, max);
78  const double radius = 10e-3; //10mm radius
79  min[2] = -2.5*radius;
80  // Translating the array into a Vec3D. Mercury works with Vec3D to set the domain
81  Vec3D minVec(min);
82  Vec3D maxVec(max);
83  // set domain in Mercury
84  setDomain(minVec, maxVec);
85  // add elastic species
86  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSlidingFrictionSpecies());
87  species->setDensity(1000);
88  species->setStiffness(9.8*250.0); //should result in 1mm overlap
89  const double mass = species->getMassFromRadius(radius);
90  double tc = species->getCollisionTime(mass);
91  species->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(tc, 1, 1, mass);
92  species->setSlidingFrictionCoefficient(0.2);
93  // set time step
94  setTimeStep(0.05*tc);
95  // add particle
96  SphericalParticle p(species);
97  p.setRadius(radius);
98  double x = 0.5*max[0], y = 0.8*max[1];
99  p.setPosition({x, y, -radius});
100  particleHandler.copyAndAddObject(p);
101  p.setPosition({-x, y, -radius});
102  particleHandler.copyAndAddObject(p);
103  p.setPosition({x, -y, -radius});
104  particleHandler.copyAndAddObject(p);
105  p.setPosition({-x, -y, -radius});
106  particleHandler.copyAndAddObject(p);
107  // add bottom wall
108  InfiniteWall w(species);
109  w.set({0,0,-1},{0,0,-2.0*radius});
110  wallHandler.copyAndAddObject(w);
111  // set output file properties
112  setParticlesWriteVTK(true);
113  wallHandler.setWriteVTK(true);
114  setFileType(FileType::NO_FILE);
115  restartFile.setFileType(FileType::ONE_FILE);
116  restartFile.writeFirstAndLastTimeStep();
117  dataFile.setFileType(FileType::ONE_FILE);
118  fStatFile.setFileType(FileType::ONE_FILE);
119  // add gravity
120  setGravity({0,0,-9.8});
121  }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
@ NO_FILE
file will not be created/read
@ ONE_FILE
all data will be written into/ read from a single file called name_
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
Definition: LinearViscoelasticSlidingFrictionSpecies.h:12
RowVector3d w
Definition: Matrix_resize_int.cpp:3
float * p
Definition: Tutorial_Map_using.cpp:9
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:27
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
Definition: Kernel/Math/Vector.h:30
Scalar * y
Definition: level1_cplx_impl.h:128
radius
Definition: UniformPSDSelfTest.py:15
string dataFile
Definition: calibrate.py:175
list x
Definition: plotDoE.py:28

References calibrate::dataFile, e(), max, min, NO_FILE, ONE_FILE, p, UniformPSDSelfTest::radius, w, plotDoE::x, and y.

Referenced by CoupledProblem().

◆ setupOomph()

void CoupledProblem::setupOomph ( )
inline
38  {
39  // set stiffness
40  setElasticModulus(1e6);
41  // set density
42  setDensity(1000);
43  // set solid dimensions
44  unsigned nx=2, ny=2, nz=2;
45  double xMax=5e-2, xMin=-xMax; // one litre of material, density 1000 -> 1 kg
46  double yMax=5e-2, yMin=-yMax;
47  double zMax=10e-2, zMin=0;
48  setSolidCubicMesh(nx, ny, nz, xMin, xMax, yMin, yMax, zMin, zMax);
49  // no pinned boundaries
50  setIsPinned([](SolidNode* n, unsigned d) {
51  return false;
52  });
53  // set dissipation
54  setDissipation(0.0);
55  // set gravity
56  setBodyForceAsGravity();
57  // set solver properties
58  setNewtonSolverTolerance(3e-8);
59  disable_info_in_newton_solve();
60  linear_solver_pt()->disable_doc_time();
61  // assemble
62  prepareForSolve();
63  // couple all boundaries
64  coupleBoundary(Boundary::Z_MIN);
65 
66  double mass, elasticEnergy, kineticEnergy;
67  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
68  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
69  logger(INFO, "mass %, linearMomentum %, angularMomentum %, elasticEnergy %, totalEnergy %",
70  mass, linearMomentum, angularMomentum, elasticEnergy, elasticEnergy+kineticEnergy);
71  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
void coupleBoundary(unsigned b)
Definition: SCoupling.h:692
Definition: nodes.h:1686
const unsigned nz
Definition: ConstraintElementsUnitTest.cpp:32
const unsigned nx
Definition: ConstraintElementsUnitTest.cpp:30
const unsigned ny
Definition: ConstraintElementsUnitTest.cpp:31

References SCoupling< M, O >::coupleBoundary(), e(), INFO, logger, n, Mesh_Parameters::nx, Mesh_Parameters::ny, and Mesh_Parameters::nz.

Referenced by CoupledProblem().


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