DropletBoundary.h
Go to the documentation of this file.
1 #ifndef DROPLETBOUNDARY_H
2 #define DROPLETBOUNDARY_H
3 
4 #include "DPMBase.h"
5 #include "BaseBoundary.h"
6 #include "Math/Vector.h"
7 #include "Math/RNG.h"
8 
9 class DPMBase;
10 
11 class ParticleHandler;
12 
13 class BaseParticle;
14 
15 class RNG;
16 
26 {
27 public:
28 
29  struct Droplet {
32  double radius;
33 
34  // Used for when not to repel at walls.
36  };
37 
38  std::vector<Droplet> droplets_;
39 
40  // volume of liquid stored in droplets
41  double dropletVolume = 0;
42  // volume of liquid absorbed by particles
43  double absorbedVolume = 0;
44  // volume of liquid lost at walls
45  double lostVolume = 0;
46 
47 private:
48 
49  std::function<void(DropletBoundary&)> generateDroplets_
50  = [] (DropletBoundary&) {};
51 
52 public:
53 
55 
57  droplets_ = other.droplets_;
61  }
62 
63  ~DropletBoundary() override {
64  logger(VERBOSE, "A DropletBoundary has been destroyed.");
65  }
66 
67  DropletBoundary* copy() const override {
68  return new DropletBoundary(*this);
69  }
70 
71  std::string getName() const override {
72  return "DropletBoundary";
73  }
74 
79 
83  void read(std::istream& is) override;
84 
88  void write(std::ostream& os) const override;
89 
90  void setGenerateDroplets(std::function<void(DropletBoundary&)> generateDroplets) {
91  generateDroplets_=generateDroplets;
92  }
93 
94  void writeVTK(std::fstream& file) override;
95 
96  // this is the number of timesteps between checks whether the droplet is in contact with a particle or wall.
97  unsigned checkCount = 3;
98 
99  void setRemoveDropletsAtWalls(bool removeDroplets) {
100  removeDropletsAtWalls_ = removeDroplets;
101  }
102 
103  void setDropletSpecies(const ParticleSpecies* species) {
104  dropletSpecies_ = species;
105  }
106 
107  void actionsBeforeTimeLoop() override
108  {
109  // When no droplet species were set, use the last species from the handler.
110  // This is fine for when the droplets are removed at the walls, if not, a warning is shown.
111  if (!dropletSpecies_)
112  {
115  logger(WARN, "DropletBoundary: Droplets should repel from wall, but no droplet species was set. Using last species from the species handler instead.");
116  }
117 
118  // When droplets should repel from the wall, it requires to be checked every time step.
120  checkCount = 1;
121  }
122 
123 private:
126 };
127 
128 #endif
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ WARN
@ VERBOSE
Definition: BaseBoundary.h:49
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
Definition: BaseBoundary.cc:143
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:634
Definition: BaseParticle.h:54
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
Supplies a 'constant heat flux' to a cuboidal region (specified by two corner points) by adding a ran...
Definition: DropletBoundary.h:26
double dropletVolume
Definition: DropletBoundary.h:41
double lostVolume
Definition: DropletBoundary.h:45
DropletBoundary(const DropletBoundary &other)
Definition: DropletBoundary.h:56
void write(std::ostream &os) const override
Writes the boundary properties to an std::ostream.
Definition: DropletBoundary.cc:94
std::function< void(DropletBoundary &)> generateDroplets_
Definition: DropletBoundary.h:50
void setRemoveDropletsAtWalls(bool removeDroplets)
Definition: DropletBoundary.h:99
DropletBoundary * copy() const override
Used to create a copy of the object NB: purely virtual function.
Definition: DropletBoundary.h:67
bool removeDropletsAtWalls_
Definition: DropletBoundary.h:124
double absorbedVolume
Definition: DropletBoundary.h:43
DropletBoundary()
Definition: DropletBoundary.h:54
void setDropletSpecies(const ParticleSpecies *species)
Definition: DropletBoundary.h:103
void read(std::istream &is) override
Reads some boundary properties from an std::istream.
Definition: DropletBoundary.cc:73
~DropletBoundary() override
Definition: DropletBoundary.h:63
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Runs at the end of each time step.
Definition: DropletBoundary.cc:7
std::string getName() const override
A purely virtual function.
Definition: DropletBoundary.h:71
unsigned checkCount
Definition: DropletBoundary.h:97
std::vector< Droplet > droplets_
Definition: DropletBoundary.h:38
void setGenerateDroplets(std::function< void(DropletBoundary &)> generateDroplets)
Definition: DropletBoundary.h:90
void writeVTK(std::fstream &file) override
Definition: DropletBoundary.cc:106
const ParticleSpecies * dropletSpecies_
Definition: DropletBoundary.h:125
void actionsBeforeTimeLoop() override
Virtual function that does something after DPMBase::setupInitialConditions but before the first time ...
Definition: DropletBoundary.h:107
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
Definition: ParticleSpecies.h:37
This is a class that generates random numbers i.e. named the Random Number Generator (RNG).
Definition: RNG.h:53
Definition: Vector.h:51
Definition: DropletBoundary.h:29
double radius
Definition: DropletBoundary.h:32
Vec3D force
Definition: DropletBoundary.h:35
Vec3D velocity
Definition: DropletBoundary.h:31
Vec3D position
Definition: DropletBoundary.h:30