DropletBoundarySelfTest.cpp File Reference

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

A new test for the insertion of liquid droplets. Note, you need to create a species for the droplets that has liquidVolumeMax-0

19 {
20  //general properties
21  Mercury3D dpm;
22  dpm.setName("DropletBoundarySelfTest");
23  double collisionTime = 0.005;
24  dpm.setTimeStep(collisionTime/50.);
25  dpm.setTimeMax(1.0);
26  dpm.setSaveCount(200);
27  dpm.setGravity({0,0,-1});
28  dpm.setMax({1,1,0.3});
29  dpm.setMin({0,0,0});
30 
31  //contact law and density
33  species.setDensity(6./pi);
34  species.setCollisionTimeAndRestitutionCoefficient(0.5e-2, 0.5, 1);
35  species.setLiquidBridgeVolumeMax(1e-3);
36  auto s = dpm.speciesHandler.copyAndAddObject(species);
37  species.setLiquidBridgeVolumeMax(0);
38  dpm.speciesHandler.copyAndAddObject(species);
39 
40  //walls
41  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,0,-1},dpm.getMin(),s));
42 
43  //two rows of particles
44  double n = 3;
45  double dx = (dpm.getXMax()-dpm.getXMin())/n;
46  LiquidFilmParticle particle;
47  particle.setSpecies(s);
48  particle.setRadius(0.3*dx);
49  particle.fixParticle();
50  for (double x = dpm.getMin().X; x<=dpm.getMax().X+dx/2; x+=dx) {
51  particle.setPosition({x,dpm.getYMax(),dpm.getZMin()});
52  dpm.particleHandler.copyAndAddObject(particle);
53  }
54  for (double x = dpm.getMin().X+dx/2; x<=dpm.getMax().X; x+=dx) {
55  particle.setPosition({x,dpm.getYMax(),dpm.getZMin()+0.5*dx});
56  dpm.particleHandler.copyAndAddObject(particle);
57  }
58 
59  //droplets
60  double flowRate = 1e-3/60.; //m^3/s
61  double dropletRadius = 4e-3;
63  d.setGenerateDroplets([&dpm,flowRate,dropletRadius] (DropletBoundary& d) {
64  while (d.getTotalInsertedVolume() < flowRate*dpm.getTime()) {
65  Vec3D position {dpm.random.getRandomNumber(dpm.getXMin(), dpm.getXMax()), dpm.getYMax(), dpm.getZMax()};
66  Vec3D velocity {0,0,0};
67  d.addDroplet(position, velocity, dropletRadius);
68  }
69  });
71 
72  dpm.setParticlesWriteVTK(true);
73 // dpm.wallHandler.setWriteVTK(FileType::ONE_FILE);
74  dpm.wallHandler.setWriteVTK(true);
75  dpm.boundaryHandler.setWriteVTK(true);
76  dpm.solve();
77  return 0;
78 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:360
void setWriteVTK(bool writeVTK)
Definition: BoundaryHandler.h:66
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:603
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:610
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:799
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1453
Vec3D getMax() const
Returns the maximum coordinates of the problem domain.
Definition: DPMBase.h:659
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1109
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1458
Vec3D getMin() const
Returns the minimum coordinates of the problem domain.
Definition: DPMBase.h:653
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:933
RNG random
This is a random generator, often used for setting up the initial conditions etc.....
Definition: DPMBase.h:1438
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:622
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1073
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:634
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:628
Supplies a 'constant heat flux' to a cuboidal region (specified by two corner points) by adding a ran...
Definition: DropletBoundary.h:30
double getTotalInsertedVolume() const
Definition: DropletBoundary.h:160
void addDroplet(const Vec3D &position, const Vec3D &velocity, double radius)
Definition: DropletBoundary.h:132
void setGenerateDroplets(std::function< void(DropletBoundary &)> generateDroplets)
Definition: DropletBoundary.h:88
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:27
Definition: LiquidFilmParticle.h:15
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:16
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:123
Contains material and contact force properties.
Definition: Species.h:14
Definition: Kernel/Math/Vector.h:30
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:445
RealScalar s
Definition: level1_cplx_impl.h:130
double velocity(const double &t)
Angular velocity as function of time t.
Definition: jeffery_orbit.cc:107
const Mdouble pi
Definition: ExtendedMath.h:23
list x
Definition: plotDoE.py:28

References DropletBoundary::addDroplet(), DPMBase::boundaryHandler, BaseHandler< T >::copyAndAddObject(), e(), DPMBase::getMax(), DPMBase::getMin(), RNG::getRandomNumber(), DPMBase::getTime(), DropletBoundary::getTotalInsertedVolume(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getZMax(), DPMBase::getZMin(), n, DPMBase::particleHandler, constants::pi, DPMBase::random, s, ParticleSpecies::setDensity(), DropletBoundary::setGenerateDroplets(), DPMBase::setGravity(), DPMBase::setMax(), DPMBase::setMin(), DPMBase::setName(), DPMBase::setParticlesWriteVTK(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), BoundaryHandler::setWriteVTK(), WallHandler::setWriteVTK(), DPMBase::solve(), DPMBase::speciesHandler, Jeffery_Solution::velocity(), DPMBase::wallHandler, plotDoE::x, and Vec3D::X.