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

15 {
16  //general properties
17  Mercury3D dpm;
18  dpm.setName("DropletBoundarySelfTest");
19  double collisionTime = 0.005;
20  dpm.setTimeStep(collisionTime/50.);
21  dpm.setTimeMax(1.0);
22  dpm.setSaveCount(200);
23  dpm.setGravity({0,0,-1});
24  dpm.setMax({1,1,0.3});
25  dpm.setMin({0,0,0});
26 
27  //contact law and density
29  species.setDensity(6./pi);
30  species.setCollisionTimeAndRestitutionCoefficient(0.5e-2, 0.5, 1);
31  species.setLiquidBridgeVolumeMax(1e-3);
32  auto s = dpm.speciesHandler.copyAndAddObject(species);
33  species.setLiquidBridgeVolumeMax(0);
34  dpm.speciesHandler.copyAndAddObject(species);
35 
36  //walls
37  dpm.wallHandler.copyAndAddObject(InfiniteWall({0,0,-1},dpm.getMin(),s));
38 
39  //two rows of particles
40  double n = 3;
41  double dx = (dpm.getXMax()-dpm.getXMin())/n;
42  LiquidFilmParticle particle;
43  particle.setSpecies(s);
44  particle.setRadius(0.3*dx);
45  particle.fixParticle();
46  for (double x = dpm.getMin().X; x<=dpm.getMax().X+dx/2; x+=dx) {
47  particle.setPosition({x,dpm.getYMax(),dpm.getZMin()});
48  dpm.particleHandler.copyAndAddObject(particle);
49  }
50  for (double x = dpm.getMin().X+dx/2; x<=dpm.getMax().X; x+=dx) {
51  particle.setPosition({x,dpm.getYMax(),dpm.getZMin()+0.5*dx});
52  dpm.particleHandler.copyAndAddObject(particle);
53  }
54 
55  //droplets
56  double flowRate = 1e-3/60.; //m^3/s
57  double dropletRadius = 4e-3;
58  double dropletVolume = std::pow(2.0*dropletRadius,3)*constants::pi/6.0;
60  d.setGenerateDroplets([&dpm,flowRate,dropletRadius,dropletVolume] (DropletBoundary& d) {
61  static double accumulatedDropletVolume = 0;
62  while (accumulatedDropletVolume < flowRate*dpm.getTime()) {
63  Vec3D position {dpm.random.getRandomNumber(dpm.getXMin(), dpm.getXMax()), dpm.getYMax(), dpm.getZMax()};
64  Vec3D velocity {0,0,0};
65  d.droplets_.emplace_back(DropletBoundary::Droplet{position, velocity, dropletRadius});
66  accumulatedDropletVolume +=dropletVolume;
67  }
68  });
70 
71  dpm.setParticlesWriteVTK(true);
72 // dpm.wallHandler.setWriteVTK(FileType::ONE_FILE);
73  dpm.wallHandler.setWriteVTK(true);
74  dpm.boundaryHandler.setWriteVTK(true);
75  dpm.solve();
76  return 0;
77 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
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:379
void setWriteVTK(bool writeVTK)
Definition: BoundaryHandler.h:88
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:619
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:626
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:808
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
Vec3D getMax() const
Definition: DPMBase.h:670
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1118
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1452
Vec3D getMin() const
Definition: DPMBase.h:664
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:942
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:638
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1082
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1383
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:644
Supplies a 'constant heat flux' to a cuboidal region (specified by two corner points) by adding a ran...
Definition: DropletBoundary.h:26
std::vector< Droplet > droplets_
Definition: DropletBoundary.h:38
void setGenerateDroplets(std::function< void(DropletBoundary &)> generateDroplets)
Definition: DropletBoundary.h:90
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
Definition: LiquidFilmParticle.h:36
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:37
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:108
Contains material and contact force properties.
Definition: Species.h:35
Definition: Vector.h:51
Mdouble X
the vector components
Definition: Vector.h:66
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:467
const Mdouble pi
Definition: ExtendedMath.h:45
Definition: DropletBoundary.h:29

References BaseHandler< T >::copyAndAddObject(), DropletBoundary::droplets_, DPMBase::getMax(), DPMBase::getMin(), DPMBase::getTime(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getZMin(), n, DPMBase::particleHandler, constants::pi, ParticleSpecies::setDensity(), DropletBoundary::setGenerateDroplets(), DPMBase::setGravity(), DPMBase::setMax(), DPMBase::setMin(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::speciesHandler, DPMBase::wallHandler, and Vec3D::X.