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 ()
 
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 ()
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ CoupledProblem()

CoupledProblem::CoupledProblem ( )
inline
36  {
37  //set name
38  setName("SolidOnParticleBed");
39  //remove existing output files
41 
42  // setup steps
43  setupOomph();
44  setupMercury();
45  setOomphTimeStep(getTimeStep());
46  setTimeMax(2000*getTimeStep());
47  setSaveCount(10);
48  logger(INFO,"Time step %", getTimeStep());
49 
50  // Solve the problem
51  writeToVTK();
53  saveSolidMesh();
54 
55  helpers::writeToFile(getName()+".gnu","set key autotitle columnheader\n"
56  "p '" + getName() + ".def' u 1:2");
57  }
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:64
void removeOldFiles() const
Definition: BaseCoupling.h:68
void setName(std::string name)
Definition: BaseCoupling.h:59
void setupMercury()
Definition: SolidOnParticleBed.cpp:94
void setupOomph()
Definition: SolidOnParticleBed.cpp:59
void solveSurfaceCoupling()
Definition: SCoupling.h:72
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58

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
140  {
142  }
void getSolidDeflection()
Definition: SolidOnParticleBed.cpp:144

References getSolidDeflection().

◆ getSolidDeflection()

void CoupledProblem::getSolidDeflection ( )
inline
144  {
145  std::array<double,3> min;
146  std::array<double,3> max;
147  getDomainSize(min, max);
148 
149  Vector<double> xi(3);
150  xi[0] = 0.5*(max[0]+min[0]);
151  xi[1] = 0.5*(max[1]+min[1]);
152  xi[2] = min[2];
153  double deflection = getDeflection(xi,2);
154 
155  static std::ofstream file(getName()+".def");
156  file << getTime() << " " << deflection << std::endl;
157  }

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

Referenced by actionsAfterTimeStep().

◆ setupMercury()

void CoupledProblem::setupMercury ( )
inline
94  {
95  //set domain for visualisation
96  std::array<double, 3> min;
97  std::array<double, 3> max;
99  const double radius = 10e-3; //10mm radius
100  min[2] = -2.5*radius;
101  Mercury3D::setDomain(min, max);
102  // add elastic species
103  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSlidingFrictionSpecies());
104  species->setDensity(1000);
105  species->setStiffness(9.8*250.0); //should result in 1mm overlap
106  const double mass = species->getMassFromRadius(radius);
107  double tc = species->getCollisionTime(mass);
108  species->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(tc, 1, 1, mass);
109  species->setSlidingFrictionCoefficient(0.2);
110  // set time step
111  setTimeStep(0.05*tc);
112  // add particle
113  SphericalParticle p(species);
114  p.setRadius(radius);
115  double x = 0.5*max[0], y = 0.8*max[1];
116  p.setPosition({x, y, -radius});
117  particleHandler.copyAndAddObject(p);
118  p.setPosition({-x, y, -radius});
119  particleHandler.copyAndAddObject(p);
120  p.setPosition({x, -y, -radius});
121  particleHandler.copyAndAddObject(p);
122  p.setPosition({-x, -y, -radius});
123  particleHandler.copyAndAddObject(p);
124  // add bottom wall
125  InfiniteWall w(species);
126  w.set({0,0,-1},{0,0,-2.0*radius});
127  wallHandler.copyAndAddObject(w);
128  // set output file properties
129  setParticlesWriteVTK(true);
130  wallHandler.setWriteVTK(true);
131  setFileType(FileType::NO_FILE);
132  restartFile.setFileType(FileType::ONE_FILE);
133  restartFile.writeFirstAndLastTimeStep();
134  dataFile.setFileType(FileType::ONE_FILE);
135  fStatFile.setFileType(FileType::ONE_FILE);
136  // add gravity
137  setGravity({0,0,-9.8});
138  }
@ 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:34
void setDomain(const Vec3D &min, const Vec3D &max)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1098
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
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)
Definition: SolidProblem.h:296
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37

References SolidProblem< ELEMENT_TYPE >::getDomainSize(), NO_FILE, ONE_FILE, InfiniteWall::set(), DPMBase::setDomain(), BaseInteractable::setPosition(), and BaseParticle::setRadius().

Referenced by CoupledProblem().

◆ setupOomph()

void CoupledProblem::setupOomph ( )
inline
59  {
60  // set stiffness
61  setElasticModulus(1e6);
62  // set density
63  setDensity(1000);
64  // set solid dimensions
65  unsigned nx=2, ny=2, nz=2;
66  double xMax=5e-2, xMin=-xMax; // one litre of material, density 1000 -> 1 kg
67  double yMax=5e-2, yMin=-yMax;
68  double zMax=10e-2, zMin=0;
69  setSolidCubicMesh(nx, ny, nz, xMin, xMax, yMin, yMax, zMin, zMax);
70  // no pinned boundaries
71  setIsPinned([](SolidNode* n, unsigned d) {
72  return false;
73  });
74  // set dissipation
75  setDissipation(0.0);
76  // set gravity
77  setBodyForceAsGravity();
78  // set solver properties
79  setNewtonSolverTolerance(3e-8);
80  disable_info_in_newton_solve();
81  linear_solver_pt()->disable_doc_time();
82  // assemble
83  prepareForSolve();
84  // couple all boundaries
85  coupleBoundary(Boundary::Z_MIN);
86 
87  double mass, elasticEnergy, kineticEnergy;
88  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
89  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
90  logger(INFO, "mass %, linearMomentum %, angularMomentum %, elasticEnergy %, totalEnergy %",
91  mass, linearMomentum, angularMomentum, elasticEnergy, elasticEnergy+kineticEnergy);
92  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
void coupleBoundary(unsigned b)
Definition: SCoupling.h:681

References SCoupling< M, O >::coupleBoundary(), INFO, logger, and n.

Referenced by CoupledProblem().


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