DropletBoundary Class Reference

Supplies a 'constant heat flux' to a cuboidal region (specified by two corner points) by adding a random velocity at each time step to each particle therein, increasing the granular temperature (velocity variance). More...

#include <DropletBoundary.h>

+ Inheritance diagram for DropletBoundary:

Classes

struct  Droplet
 

Public Member Functions

 DropletBoundary ()
 
 DropletBoundary (const DropletBoundary &other)
 
 ~DropletBoundary () override
 
DropletBoundarycopy () const override
 Used to create a copy of the object NB: purely virtual function. More...
 
std::string getName () const override
 A purely virtual function. More...
 
void checkBoundaryAfterParticlesMove (ParticleHandler &pH) override
 Runs at the end of each time step. More...
 
void read (std::istream &is) override
 Reads some boundary properties from an std::istream. More...
 
void write (std::ostream &os) const override
 Writes the boundary properties to an std::ostream. More...
 
void setGenerateDroplets (std::function< void(DropletBoundary &)> generateDroplets)
 
void setRemoveDroplets (std::function< bool(const Droplet &)> removeDroplets)
 
void writeVTK (std::fstream &file) override
 
void setRemoveDropletsAtWalls (bool removeDroplets)
 
void setDropletSpecies (const ParticleSpecies *species)
 
void setDropletTemperature (double temperature)
 
void actionsBeforeTimeLoop () override
 Virtual function that does something after DPMBase::setupInitialConditions but before the first time step. More...
 
void addDroplet (const Vec3D &position, const Vec3D &velocity, double radius)
 
void addDroplet (const Vec3D &position, const Vec3D &velocity, double radius, double liquidVolume)
 
std::vector< Droplet > & getDroplets ()
 
double getDropletVolume () const
 
double getAbsorbedVolume () const
 
double getLostVolume () const
 
double getTotalInsertedVolume () const
 
void setLiquidFilmVolumeMaxFraction (double volumeFraction)
 Sets the fraction of the particle volume that indicates the maximum amount of liquid a particle may hold. More...
 
void setLiquidFilmVolumeMaxFractionFromRadiusFraction (double radiusFraction)
 Sets the fraction of the particle volume that indicates the maximum amount of liquid a particle may hold, based on a liquid film thickness specified by a fraction of the particle radius. More...
 
- Public Member Functions inherited from BaseBoundary
 BaseBoundary ()
 default constructor. More...
 
 BaseBoundary (const BaseBoundary &b)
 copy constructor More...
 
 ~BaseBoundary () override
 destructor More...
 
virtual void createPeriodicParticle (BaseParticle *p UNUSED, ParticleHandler &pH UNUSED)
 Creates a periodic particle in case of periodic boundaries in serial build. More...
 
virtual void createPeriodicParticles (ParticleHandler &pH UNUSED)
 Creates periodic copies of given particle in case of periodic boundaries. More...
 
virtual void checkBoundaryBeforeTimeStep (DPMBase *md)
 Virtual function that does things before each time step. More...
 
virtual void modifyGhostAfterCreation (BaseParticle *particle, int i)
 
void setHandler (BoundaryHandler *handler)
 Sets the boundary's BoundaryHandler. More...
 
BoundaryHandlergetHandler () const
 Returns the boundary's BoundaryHandler. More...
 
- Public Member Functions inherited from BaseObject
 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Public Attributes

unsigned checkCount = 3
 

Private Member Functions

void addHeatTransfer (BaseParticle *particle, double liquidVolume)
 
double getSpeciesHeatCapacity (const ParticleSpecies *species) const
 

Private Attributes

std::function< void(DropletBoundary &)> generateDroplets_ = [] (DropletBoundary&) {}
 
std::function< bool(const Droplet &)> removeDroplets_ = [] (const Droplet&) { return false; }
 
std::vector< Dropletdroplets_
 
double dropletVolume_ = 0
 
double absorbedVolume_ = 0
 
double lostVolume_ = 0
 
bool removeDropletsAtWalls_ = true
 
const ParticleSpeciesdropletSpecies_ = nullptr
 
double dropletTemperature_ = -1.0
 
double liquidFilmVolumeMaxFraction_ = constants::inf
 

Detailed Description

Supplies a 'constant heat flux' to a cuboidal region (specified by two corner points) by adding a random velocity at each time step to each particle therein, increasing the granular temperature (velocity variance).

Note, you need to create a species for the droplets that has liquidVolumeMax-0, or the contact happens at a non-zero distance

Constructor & Destructor Documentation

◆ DropletBoundary() [1/2]

DropletBoundary::DropletBoundary ( )
inline
46 {}

Referenced by copy().

◆ DropletBoundary() [2/2]

DropletBoundary::DropletBoundary ( const DropletBoundary other)
inline
48  {
49  droplets_ = other.droplets_;
54  lostVolume_ = other.lostVolume_;
59  }
double lostVolume_
Definition: DropletBoundary.h:196
double liquidFilmVolumeMaxFraction_
Definition: DropletBoundary.h:210
std::function< void(DropletBoundary &)> generateDroplets_
Definition: DropletBoundary.h:182
double dropletTemperature_
Definition: DropletBoundary.h:201
bool removeDropletsAtWalls_
Definition: DropletBoundary.h:198
double dropletVolume_
Definition: DropletBoundary.h:192
double absorbedVolume_
Definition: DropletBoundary.h:194
std::function< bool(const Droplet &)> removeDroplets_
Definition: DropletBoundary.h:183
std::vector< Droplet > droplets_
Definition: DropletBoundary.h:189
const ParticleSpecies * dropletSpecies_
Definition: DropletBoundary.h:199

References absorbedVolume_, droplets_, dropletSpecies_, dropletTemperature_, dropletVolume_, generateDroplets_, liquidFilmVolumeMaxFraction_, lostVolume_, removeDroplets_, and removeDropletsAtWalls_.

◆ ~DropletBoundary()

DropletBoundary::~DropletBoundary ( )
inlineoverride
61  {
62  logger(VERBOSE, "A DropletBoundary has been destroyed.");
63  }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ VERBOSE

References logger, and VERBOSE.

Member Function Documentation

◆ actionsBeforeTimeLoop()

void DropletBoundary::actionsBeforeTimeLoop ( )
inlineoverridevirtual

Virtual function that does something after DPMBase::setupInitialConditions but before the first time step.

Can be used to perform actions before the time loop, but after setupInitialConditions.

Reimplemented from BaseBoundary.

114  {
115  // When no droplet species were set, use the last species from the handler.
116  // This is fine for when the droplets are removed at the walls, if not, a warning is shown.
117  if (!dropletSpecies_)
118  {
121  logger(WARN, "DropletBoundary: Droplets should repel from wall, but no droplet species was set. Using last species from the species handler instead.");
122  }
123 
124  // When droplets should repel from the wall, it requires to be checked every time step.
126  checkCount = 1;
127 
129  logger(ERROR, "DropletBoundary: The heat capacity of the droplet species is 0. For proper heat transfer, make sure the droplets have the correct species and the heat capacity is set.");
130  }
@ WARN
@ ERROR
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
Definition: BaseBoundary.cc:122
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:733
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:642
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
double getSpeciesHeatCapacity(const ParticleSpecies *species) const
Definition: DropletBoundary.cc:165
unsigned checkCount
Definition: DropletBoundary.h:99

References checkCount, dropletSpecies_, dropletTemperature_, ERROR, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), BaseHandler< T >::getLastObject(), getSpeciesHeatCapacity(), logger, removeDropletsAtWalls_, DPMBase::speciesHandler, and WARN.

◆ addDroplet() [1/2]

void DropletBoundary::addDroplet ( const Vec3D position,
const Vec3D velocity,
double  radius 
)
inline
133  {
134  double liquidVolume = std::pow(radius, 3) * constants::pi * 4.0 / 3.0;
135  addDroplet(position, velocity, radius, liquidVolume);
136  }
void addDroplet(const Vec3D &position, const Vec3D &velocity, double radius)
Definition: DropletBoundary.h:132
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
double velocity(const double &t)
Angular velocity as function of time t.
Definition: jeffery_orbit.cc:107
radius
Definition: UniformPSDSelfTest.py:15
const Mdouble pi
Definition: ExtendedMath.h:23

References constants::pi, Eigen::bfloat16_impl::pow(), UniformPSDSelfTest::radius, and Jeffery_Solution::velocity().

Referenced by main(), read(), NozzleDemo::setupInitialConditions(), and NozzleSelfTest::setupInitialConditions().

◆ addDroplet() [2/2]

void DropletBoundary::addDroplet ( const Vec3D position,
const Vec3D velocity,
double  radius,
double  liquidVolume 
)
inline
139  {
140  droplets_.emplace_back(position, velocity, radius, liquidVolume);
141  dropletVolume_ += liquidVolume;
142  }

References droplets_, dropletVolume_, UniformPSDSelfTest::radius, and Jeffery_Solution::velocity().

◆ addHeatTransfer()

void DropletBoundary::addHeatTransfer ( BaseParticle particle,
double  liquidVolume 
)
private
144 {
145  // Skip when no droplet temperature has been set.
146  if (dropletTemperature_ < 0.0)
147  return;
148 
149  auto hfp = dynamic_cast<HeatFluidCoupledParticle*>(particle);
150  if (hfp)
151  {
152  double particleHeatCapacity = getSpeciesHeatCapacity(hfp->getSpecies());
153  double dropletHeatCapacity = getSpeciesHeatCapacity(dropletSpecies_);
154  if (particleHeatCapacity > 0.0 && dropletHeatCapacity > 0.0)
155  {
156  double transferMass = dropletSpecies_->getDensity() * liquidVolume;
157  // Tf = (mp*cp*Tp + md*cd*Td) / (mp*cp + md*cd)
158  double temperatureFinal = (hfp->getMass() * particleHeatCapacity * hfp->getTemperature() + transferMass * dropletHeatCapacity * dropletTemperature_) /
159  (hfp->getMass() * particleHeatCapacity + transferMass * dropletHeatCapacity);
160  hfp->setTemperature(temperatureFinal);
161  }
162  }
163 }
Class of particles that store both temperature and liquid volume, which is adapted for the CFD-DEM st...
Definition: HeatFluidCoupledParticle.h:25
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:98

References dropletSpecies_, dropletTemperature_, ParticleSpecies::getDensity(), and getSpeciesHeatCapacity().

Referenced by checkBoundaryAfterParticlesMove().

◆ checkBoundaryAfterParticlesMove()

void DropletBoundary::checkBoundaryAfterParticlesMove ( ParticleHandler pH)
overridevirtual

Runs at the end of each time step.

Reimplemented from BaseBoundary.

20 {
21  auto dpm = dynamic_cast<MercuryBase*>(getHandler()->getDPMBase());
22  logger.assert_always(dpm,"You can only run DropletBoundary with Mercury2D or Mercury3D, not DPMBase");
23  // generate new droplets
24  generateDroplets_(*this);
25  // integrate Newtons equation of motion
26  Vec3D g = dpm->getGravity();
27  double dt = dpm->getTimeStep();
28  for (auto& d : droplets_)
29  {
31  d.velocity += dt * (d.force + m * g) / m;
32  d.force.setZero();
33  d.position += dt*d.velocity;
34  }
35  // check for interaction with particles; this is costly, so we only do iit every 50 time steps
36  if (dpm->getNumberOfTimeSteps() % checkCount == 0)
37  {
39  p.setSpecies(dropletSpecies_);
40  for (auto &d : droplets_) {
41  p.setPosition(d.position);
42  p.setVelocity(d.velocity);
43  p.setRadius(d.radius);
44  auto q = dpm->hGridFindParticleContacts(&p);
45  if (!q.empty())
46  {
48  {
49  // No volume limit. Share droplet volume equally between particles.
50  double liquidVolumePerParticle = d.liquidVolume / q.size();
51  for (auto particle : q)
52  {
53  // should that be a static cast?
54  auto lfp = static_cast<LiquidFilmParticle *>(particle);
55  lfp->addLiquidVolume(liquidVolumePerParticle);
56  addHeatTransfer(particle, liquidVolumePerParticle);
57  }
58  absorbedVolume_ += d.liquidVolume;
59  dropletVolume_ -= d.liquidVolume;
60  d.liquidVolume = 0.0;
61  }
62  else
63  {
64  // There is a volume limit. Share droplet volume equally between particles, but any excess liquid
65  // that can't fit the particles is left in the droplet. First, ignore particles that are already
66  // fully filled, so they are not taken into account with the shared volume. Do this by adding them
67  // to a separate vector, in pairs with the allowed liquid volume, since the latter uses the full
68  // liquid volume, which loops over all interactions and does a lot of dynamic_casts, so preferably
69  // we only call it once.
70  std::vector<std::pair<LiquidFilmParticle*, double>> qq;
71  for (auto particle : q)
72  {
73  // should that be a static cast?
74  auto lfp = static_cast<LiquidFilmParticle *>(particle);
75  double allowedLiquidVolume = std::max(liquidFilmVolumeMaxFraction_ * lfp->getVolume() - lfp->getFullLiquidVolume(), 0.0);
76  if (allowedLiquidVolume > 0.0)
77  qq.emplace_back( lfp, allowedLiquidVolume );
78  }
79  double liquidVolumePerParticle = d.liquidVolume / qq.size();
80  for (auto lfp : qq)
81  {
82  double liquidVolume = std::min(lfp.second, liquidVolumePerParticle);
83  lfp.first->addLiquidVolume(liquidVolume);
84  addHeatTransfer(lfp.first, liquidVolume);
85  absorbedVolume_ += liquidVolume;
86  dropletVolume_ -= liquidVolume;
87  d.liquidVolume -= liquidVolume;
88  }
89  }
90  }
91  // Handle deletion boundaries. \todo What about other types of boundaries (e.g. periodic)?
92  for (auto bb : dpm->boundaryHandler)
93  {
94  auto b = dynamic_cast<DeletionBoundary*>(bb);
95  if (b)
96  {
97  if (b->getDistance(d.position) < 0.0)
98  {
99  lostVolume_ += d.liquidVolume;
100  dropletVolume_ -= d.liquidVolume;
101  d.liquidVolume = 0.0;
102  }
103  }
104  }
105  // check for interactions with walls
106  for (BaseWall* w : dpm->wallHandler)
107  {
108  //Checks if the particle is interacting with the current wall
109  BaseInteraction* i = w->getInteractionWith(&p, dpm->getNumberOfTimeSteps() + 1, &dpm->interactionHandler);
110  // if there is a wall interacting with the droplet
111  if (i != nullptr)
112  {
114  {
115  // set droplet liquid volume to zero
116  lostVolume_ += d.liquidVolume;
117  dropletVolume_ -= d.liquidVolume;
118  d.liquidVolume = 0.0;
119  }
120  else
121  {
122  // For some reason the species have to be set here, otherwise the force is always 0.
123  i->setSpecies(dropletSpecies_);
124  i->computeForce();
125  d.force += i->getForce();
126  }
127  }
128  }
129  // Call user defined function for removing droplets.
130  if (removeDroplets_(d))
131  {
132  lostVolume_ += d.liquidVolume;
133  dropletVolume_ -= d.liquidVolume;
134  d.liquidVolume = 0.0;
135  }
136  }
137  // erase all droplets with liquid volume 0
138  droplets_.erase(std::remove_if(droplets_.begin(), droplets_.end(),
139  [](const Droplet &d) { return d.liquidVolume <= 0; }), droplets_.end());
140  }
141 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
RowVector3d w
Definition: Matrix_resize_int.cpp:3
float * p
Definition: Tutorial_Map_using.cpp:9
Scalar * b
Definition: benchVecAdd.cpp:17
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
Basic class for walls.
Definition: BaseWall.h:28
Used for removing particles from the problem. Inherits from BaseBoundary. By default,...
Definition: DeletionBoundary.h:23
void addHeatTransfer(BaseParticle *particle, double liquidVolume)
Definition: DropletBoundary.cc:143
Definition: LiquidFilmParticle.h:15
void addLiquidVolume(Mdouble liquidVolume)
Definition: LiquidFilmParticle.h:94
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
Definition: MercuryBase.h:105
Mdouble getMassFromRadius(Mdouble radius) const
Definition: ParticleSpecies.cc:103
Definition: Kernel/Math/Vector.h:30
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23
int * m
Definition: level2_cplx_impl.h:294
EIGEN_DEVICE_FUNC const Scalar & q
Definition: SpecialFunctionsImpl.h:2019
const Mdouble inf
Definition: GeneralDefine.h:23

References absorbedVolume_, addHeatTransfer(), LiquidFilm< Particle >::addLiquidVolume(), b, checkCount, droplets_, dropletSpecies_, dropletVolume_, generateDroplets_, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), ParticleSpecies::getMassFromRadius(), i, constants::inf, liquidFilmVolumeMaxFraction_, logger, lostVolume_, m, max, min, p, Eigen::numext::q, removeDroplets_, removeDropletsAtWalls_, and w.

◆ copy()

DropletBoundary* DropletBoundary::copy ( ) const
inlineoverridevirtual

Used to create a copy of the object NB: purely virtual function.

Implements BaseBoundary.

65  {
66  return new DropletBoundary(*this);
67  }
DropletBoundary()
Definition: DropletBoundary.h:46

References DropletBoundary().

◆ getAbsorbedVolume()

double DropletBoundary::getAbsorbedVolume ( ) const
inline
152  {
153  return absorbedVolume_;
154  }

References absorbedVolume_.

◆ getDroplets()

std::vector<Droplet>& DropletBoundary::getDroplets ( )
inline
144  {
145  return droplets_;
146  }

References droplets_.

Referenced by NozzleDemo::printTime(), and NozzleSelfTest::printTime().

◆ getDropletVolume()

double DropletBoundary::getDropletVolume ( ) const
inline
148  {
149  return dropletVolume_;
150  }

References dropletVolume_.

◆ getLostVolume()

double DropletBoundary::getLostVolume ( ) const
inline
156  {
157  return lostVolume_;
158  }

References lostVolume_.

◆ getName()

std::string DropletBoundary::getName ( ) const
inlineoverridevirtual

A purely virtual function.

Implements BaseObject.

69  {
70  return "DropletBoundary";
71  }

◆ getSpeciesHeatCapacity()

double DropletBoundary::getSpeciesHeatCapacity ( const ParticleSpecies species) const
private
166 {
167  // We only care about the ThermalSpecies part, but because it's a templated class we have to specify a
168  // NormalForceSpecies to be able to cast. Templates don't allow for using e.g. BaseNormalForce, instead we really
169  // have to specify the correct NormalForceSpecies. Therefore, try a few and give a warning when not successful, so
170  // people may add missing classes.
171 
172  auto s0 = dynamic_cast<const ThermalSpecies<LinearViscoelasticNormalSpecies>*>(species);
173  if (s0)
174  return s0->getHeatCapacity();
175 
176  auto s1 = dynamic_cast<const ThermalSpecies<LinearPlasticViscoelasticNormalSpecies>*>(species);
177  if (s1)
178  return s1->getHeatCapacity();
179 
180  auto s2 = dynamic_cast<const ThermalSpecies<HertzianViscoelasticNormalSpecies>*>(species);
181  if (s2)
182  return s2->getHeatCapacity();
183 
184  logger(WARN, "DropletBoundary::getSpeciesHeatCapacity(): Failed to cast species to ThermalSpecies<T>. Returning 0.");
185  return 0.0;
186 }
Definition: ThermalSpecies.h:14
Mdouble getHeatCapacity() const
Allows heatCapacity_ to be accessed.
Definition: ThermalSpecies.h:232

References ThermalSpecies< NormalForceSpecies >::getHeatCapacity(), logger, and WARN.

Referenced by actionsBeforeTimeLoop(), and addHeatTransfer().

◆ getTotalInsertedVolume()

double DropletBoundary::getTotalInsertedVolume ( ) const
inline

◆ read()

void DropletBoundary::read ( std::istream &  is)
overridevirtual

Reads some boundary properties from an std::istream.

Reads a number of boundary properties from the given std::istream.

Parameters
[in,out]isthe istream

Implements BaseBoundary.

193 {
194  BaseBoundary::read(is);
195  std::string dummy;
196  size_t n;
197  Vec3D position, velocity;
198  double radius, volume;
199  is >> dummy >> checkCount;
200  is >> dummy >> n;
201  droplets_.clear();
202  droplets_.reserve(n);
203 
204  // For backwards compatibility. Previous restart files do not have the droplet liquid volume written.
205  // Skip the next 7n values (position (3), velocity (3), radius (1)).
206  // If the value after that is equal to "dropletVolume", we are dealing with an old restart file.
207  bool restartFileWithoutDropletLiquidVolume = helpers::lookAhead(is, "dropletVolume", 7*n+1);
208  for (int i = 0; i < n; ++i)
209  {
210  is >> position >> velocity >> radius;
211  if (restartFileWithoutDropletLiquidVolume)
212  addDroplet(position, velocity, radius);
213  else
214  {
215  is >> volume;
216  addDroplet(position, velocity, radius, volume);
217  }
218  }
219 
220  is >> dummy >> dropletVolume_ >> dummy >> absorbedVolume_ >> dummy >> lostVolume_;
221  if (helpers::isNext(is, "removeDropletsAtWalls")) // For backwards compatibility.
223  if (helpers::isNext(is, "liquidFilmVolumeMaxFraction"))
225 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
void read(std::istream &is) override=0
Reads the object's id_ from given istream NB: purely virtual function, overriding the version of Base...
Definition: BaseBoundary.cc:40
bool lookAhead(std::istream &is, const std::string &name, int number)
Checks if the nth argument from the current position in the input stream equals a certain string....
Definition: StringHelpers.cc:86
bool isNext(std::istream &is, const std::string &name)
Checks if the next argument in the input stream equals a certain string. When true,...
Definition: StringHelpers.cc:57
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References absorbedVolume_, addDroplet(), checkCount, droplets_, dropletTemperature_, dropletVolume_, i, helpers::isNext(), liquidFilmVolumeMaxFraction_, helpers::lookAhead(), lostVolume_, n, UniformPSDSelfTest::radius, BaseBoundary::read(), removeDropletsAtWalls_, oomph::Global_string_for_annotation::string(), and Jeffery_Solution::velocity().

◆ setDropletSpecies()

void DropletBoundary::setDropletSpecies ( const ParticleSpecies species)
inline
105  {
106  dropletSpecies_ = species;
107  }

References dropletSpecies_.

◆ setDropletTemperature()

void DropletBoundary::setDropletTemperature ( double  temperature)
inline
109  {
110  dropletTemperature_ = temperature;
111  }

References dropletTemperature_.

◆ setGenerateDroplets()

void DropletBoundary::setGenerateDroplets ( std::function< void(DropletBoundary &)>  generateDroplets)
inline

◆ setLiquidFilmVolumeMaxFraction()

void DropletBoundary::setLiquidFilmVolumeMaxFraction ( double  volumeFraction)
inline

Sets the fraction of the particle volume that indicates the maximum amount of liquid a particle may hold.

167  {
168  logger.assert_always(volumeFraction > 0.0, "Error in DropletBoundary::setLiquidFilmVolumeFraction(%), volumeFraction must > 0.", volumeFraction);
169  liquidFilmVolumeMaxFraction_ = volumeFraction;
170  }

References liquidFilmVolumeMaxFraction_, and logger.

◆ setLiquidFilmVolumeMaxFractionFromRadiusFraction()

void DropletBoundary::setLiquidFilmVolumeMaxFractionFromRadiusFraction ( double  radiusFraction)
inline

Sets the fraction of the particle volume that indicates the maximum amount of liquid a particle may hold, based on a liquid film thickness specified by a fraction of the particle radius.

176  {
177  logger.assert_always(radiusFraction > 0.0, "Error in DropletBoundary::setLiquidFilmVolumeFractionFromRadiusFraction(%), radiusFraction must > 0.", radiusFraction);
178  liquidFilmVolumeMaxFraction_ = std::pow(1.0 + radiusFraction, 3) - 1.0;
179  }

References liquidFilmVolumeMaxFraction_, logger, and Eigen::bfloat16_impl::pow().

◆ setRemoveDroplets()

void DropletBoundary::setRemoveDroplets ( std::function< bool(const Droplet &)>  removeDroplets)
inline
92  {
93  removeDroplets_ = removeDroplets;
94  }

References removeDroplets_.

◆ setRemoveDropletsAtWalls()

void DropletBoundary::setRemoveDropletsAtWalls ( bool  removeDroplets)
inline
101  {
102  removeDropletsAtWalls_ = removeDroplets;
103  }

References removeDropletsAtWalls_.

◆ write()

void DropletBoundary::write ( std::ostream &  os) const
overridevirtual

Writes the boundary properties to an std::ostream.

Writes the boundary properties to an std::ostream.

Parameters
[out]osthe ostream the properties are to be written to.

Implements BaseBoundary.

232 {
234  os << " checkCount " << checkCount;
235  os << " n " << droplets_.size();
236  for (auto& d : droplets_)
237  {
238  os << " " << d.position;
239  os << " " << d.velocity;
240  os << " " << d.radius;
241  os << " " << d.liquidVolume;
242  }
243  os << " dropletVolume " << dropletVolume_ << " absorbedVolume " << absorbedVolume_ << " lostVolume " << lostVolume_;
244  // Droplet species not written, so should be set in actionsOnRestart() if needed.
245  os << " removeDropletsAtWalls " << removeDropletsAtWalls_ << " dropletTemperature " << dropletTemperature_;
246  os << " liquidFilmVolumeMaxFraction " << liquidFilmVolumeMaxFraction_;
247 }
void write(std::ostream &os) const override=0
Adds object's id_ to given ostream NB: purely virtual function, overriding the version of BaseObject.
Definition: BaseBoundary.cc:49

References absorbedVolume_, checkCount, droplets_, dropletTemperature_, dropletVolume_, liquidFilmVolumeMaxFraction_, lostVolume_, removeDropletsAtWalls_, and BaseBoundary::write().

◆ writeVTK()

void DropletBoundary::writeVTK ( std::fstream &  file)
overridevirtual

Reimplemented from BaseBoundary.

249  {
250  file << "<Piece NumberOfPoints=\"" << droplets_.size() << "\" NumberOfCells=\"" << 0 << "\">\n";
251  file << "<Points>\n";
252  file << " <DataArray type=\"Float32\" Name=\"Position\" NumberOfComponents=\"3\" format=\"ascii\">\n";
253  for (const auto& d : droplets_) file << '\t' << (float)d.position.X << ' ' << (float)d.position.Y << ' ' << (float)d.position.Z << '\n';
254  file << " </DataArray>\n";
255  file << "</Points>\n";
256  file << "<PointData Vectors=\"vector\">\n";
257  file << " <DataArray type=\"Float32\" Name=\"Velocity\" NumberOfComponents=\"3\" format=\"ascii\">\n";
258  for (const auto& d : droplets_) file << '\t' << (float)d.velocity.X << ' ' << (float)d.velocity.Y << ' ' << (float)d.velocity.Z << '\n';
259  file << " </DataArray>\n";
260  file << " <DataArray type=\"Float32\" Name=\"Radius\" format=\"ascii\">\n";
261  for (const auto& d : droplets_) file << '\t' << (float)d.radius << '\n';
262  file << " </DataArray>\n";
263  file << " <DataArray type=\"Float32\" Name=\"LiquidVolume\" format=\"ascii\">\n";
264  for (const auto& d : droplets_) file << '\t' << (float)d.liquidVolume << '\n';
265  file << " </DataArray>\n";
266  file << "</PointData>\n";
267 }
for(int j=0;j< nb;++j)
Definition: level2_impl.h:287

References droplets_, and for().

Member Data Documentation

◆ absorbedVolume_

double DropletBoundary::absorbedVolume_ = 0
private

◆ checkCount

unsigned DropletBoundary::checkCount = 3

◆ droplets_

std::vector<Droplet> DropletBoundary::droplets_
private

◆ dropletSpecies_

const ParticleSpecies* DropletBoundary::dropletSpecies_ = nullptr
private

◆ dropletTemperature_

double DropletBoundary::dropletTemperature_ = -1.0
private

◆ dropletVolume_

◆ generateDroplets_

std::function<void(DropletBoundary&)> DropletBoundary::generateDroplets_ = [] (DropletBoundary&) {}
private

◆ liquidFilmVolumeMaxFraction_

◆ lostVolume_

double DropletBoundary::lostVolume_ = 0
private

◆ removeDroplets_

std::function<bool(const Droplet&)> DropletBoundary::removeDroplets_ = [] (const Droplet&) { return false; }
private

◆ removeDropletsAtWalls_

bool DropletBoundary::removeDropletsAtWalls_ = true
private

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