CylinderInsertionBoundary Class Reference

Inserts particles in a cylinder with a given radius, height and azimuthal radius at a specific origin which is 0 by default. More...

#include <CylinderInsertionBoundary.h>

+ Inheritance diagram for CylinderInsertionBoundary:

Public Member Functions

 CylinderInsertionBoundary ()
 Constructor; sets everything to 0. More...
 
 CylinderInsertionBoundary (const CylinderInsertionBoundary &other)
 Copy constructor with deep copy. More...
 
 ~CylinderInsertionBoundary () override
 Destructor: default destructor. More...
 
CylinderInsertionBoundarycopy () const override
 Creates a copy on the heap and returns a pointer. More...
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed, Mdouble rMin, Mdouble rMax, Mdouble hMin, Mdouble hMax, Vec3D normal={0, 0, 1}, Mdouble thetaMin=-constants::pi, Mdouble thetaMax=constants::pi, Vec3D velMin={0, 0, 0}, Vec3D velMax={0, 0, 0})
 Sets the properties of the InsertionBoundary for mutliple different particle types. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Mdouble rMin, Mdouble rMax, Mdouble hMin, Mdouble hMax, Vec3D normal={0, 0, 1}, Mdouble thetaMin=-constants::pi, Mdouble thetaMax=constants::pi, Vec3D velMin={0, 0, 0}, Vec3D velMax={0, 0, 0})
 
void set (std::vector< BaseParticle * > particleToCopy, unsigned int maxFailed, Mdouble rMin, Mdouble rMax, Mdouble hMin, Mdouble hMax, Vec3D normal={0, 0, 1}, Mdouble thetaMin=-constants::pi, Mdouble thetaMax=constants::pi, Vec3D velMin={0, 0, 0}, Vec3D velMax={0, 0, 0})
 Sets the properties of the InsertionBoundary for a single particle type. More...
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed, Mdouble radMin, Mdouble radMax, Mdouble hMin, Mdouble hMax, Vec3D normal, Mdouble thetaMin, Mdouble thetaMax, Vec3D velMin, Vec3D velMax, Mdouble particleRMin, Mdouble particleRMax)
 old style set function which assumes a uniform psd. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Mdouble radMin, Mdouble radMax, Mdouble hMin, Mdouble hMax, Vec3D normal, Mdouble thetaMin, Mdouble thetaMax, Vec3D velMin, Vec3D velMax, Mdouble particleRMin, Mdouble particleRMax)
 old style set function which assumes a uniform psd. More...
 
void setGeometry (Mdouble rMin, Mdouble rMax, Mdouble hMin, Mdouble hMax, Mdouble thetaMin, Mdouble thetaMax, Vec3D normal)
 Sets the geometry (position and orientation) of the CylinderInsertionBoundary. More...
 
void setOrientation (Vec3D normal)
 sets the orientation of the Cylinder More...
 
Matrix3D getRotationMatrixX (Mdouble rotationAngle)
 gets the rotationMatrix for a rotation around the X axis by a certain angle More...
 
Matrix3D getRotationMatrixY (Mdouble rotationAngle)
 gets the rotationMatrix for a rotation around the Y axis by a certain angle More...
 
Matrix3D getRotationMatrixZ (Mdouble rotationAngle)
 gets the rotationMatrix for a rotation around the Z axis by a certain angle More...
 
Vec3D getOrigin () const
 Returns the origin of the cylinders coordinate system. More...
 
Matrix3D getOrientationMatrix () const
 Returns the orientation matrix of the cylinder. More...
 
void shiftBoundary (Vec3D shift) override
 shift the origin of the cylinder in the cartesian coordinate system More...
 
void rotateBoundary (Vec3D angle) override
 rotate the cylinder around its origin More...
 
void placeParticle (BaseParticle *p, RNG &random) override
 Generates a random position, velocity for the particle p. More...
 
void read (std::istream &is) override
 reads boundary properties from istream More...
 
void write (std::ostream &os) const override
 writes boundary properties to ostream More...
 
- Public Member Functions inherited from InsertionBoundary
 InsertionBoundary ()
 
 InsertionBoundary (const InsertionBoundary &other)
 Copy constructor (with deep copy) More...
 
 ~InsertionBoundary () override
 Destructor: delete the particle that has to be copied at every insertion. More...
 
virtual BaseParticlegenerateParticle (RNG &random)
 Sets the properties of the InsertionBoundary for a single particle type ‍/ virtual void set(BaseParticle* particleToCopy, unsigned int maxFailed, Vec3D velMin, Vec3D velMax, double radMin, double radMax)=0;. More...
 
void checkBoundaryBeforeTimeStep (DPMBase *md) override
 Fills the boundary with particles. More...
 
void insertParticles (DPMBase *md)
 Fill a certain domain with particles. More...
 
unsigned int getNumberOfParticlesInserted () const
 Gets the number of particles inserted by the boundary. More...
 
Mdouble getMassOfParticlesInserted () const
 Gets the mass of particles inserted by the boundary. More...
 
Mdouble getVolumeOfParticlesInserted () const
 Gets the volume of particles inserted by the boundary. More...
 
void reset ()
 resets particle property counter variables. More...
 
void activate ()
 Turns on the InsertionBoundary. More...
 
void deactivate ()
 Turns off the InsertionBoundary. More...
 
bool isActivated ()
 Returns whether the InsertionBoundary is activated. More...
 
unsigned int getMaxFailed () const
 Gets the number of times that the boundary may fail to insert a particle. More...
 
void setParticleToCopy (std::vector< BaseParticle * > particleToCopy)
 Sets multiple different particles that will be inserted through the insertion boundary. More...
 
void setParticleToCopy (BaseParticle *particleToCopy)
 Sets the particle that will be inserted through the insertion boundary. More...
 
std::vector< BaseParticle * > getParticleToCopy ()
 Gets the particles that will be inserted through the insertion boundary. More...
 
void read (std::istream &is) override
 Reads the boundary's id_ and maxFailed_. More...
 
void write (std::ostream &os) const override
 Writes the boundary's id_ and maxFailed_. More...
 
Mdouble getVolumeFlowRate () const
 Gets the volume flow rate of the insertion routine. More...
 
void setVolumeFlowRate (Mdouble volumeFlowRate)
 Sets the volume flow rate of the insertion routine. More...
 
Mdouble getInitialVolume () const
 Gets the initialVolume() . More...
 
void setInitialVolume (Mdouble initialVolume)
 Gets the Volume which should be inserted by the insertion routine. More...
 
void setPSD (const PSD psd)
 Sets the range of particle radii that may be generated from a user defined PSD. More...
 
void setPSD (std::vector< PSD > psd, std::vector< Mdouble > probability)
 Sets the ranges of particle radii that may be generated from user defined PSDs. More...
 
std::vector< PSDgetPSD ()
 Gets the particle size distributions set by the user. More...
 
void setVariableVolumeFlowRate (const std::vector< Mdouble > &variableCumulativeVolumeFlowRate, Mdouble samplingInterval)
 Sets a variable volume flow rate. More...
 
bool insertParticle (Mdouble time)
 Checks the inserted total volume and returns if a particle is still allowed to be inserted. More...
 
bool getCheckParticleForInteraction () const
 Gets the variable that checks if a particle has an interaction. More...
 
void setCheckParticleForInteraction (bool checkParticleForInteraction)
 Sets the variable that checks if a particle has an interaction. More...
 
void setManualInsertion (bool manualInsertion)
 Set the flag for a manual PSD insertion routine. 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 checkBoundaryAfterParticlesMove (ParticleHandler &pH)
 Virtual function that does things to particles, each time step after particles have moved. More...
 
virtual void actionsBeforeTimeLoop ()
 Virtual function that does something after DPMBase::setupInitialConditions but before the first time step. More...
 
virtual void modifyGhostAfterCreation (BaseParticle *particle, int i)
 
virtual void writeVTK (std::fstream &file)
 
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
 

Protected Attributes

Mdouble thetaMin_
 Minimal and maximal azimuth angle in range [-pi,pi] defining the circle of the cylinder in which insertion should happen. More...
 
Mdouble thetaMax_
 
Mdouble radMin_
 Minimal and maximal radius defining the inner and outer circle of the cylinder in which insertion should happen. More...
 
Mdouble radMax_
 
Mdouble hMin_
 Minimal and maximal height defining the cylinder in which insertion should happen. More...
 
Mdouble hMax_
 
Matrix3D orientationMatrix_
 Orientation matrix which rotates the cylinder based on the chosen normal axis (the height axis of the cylinder). More...
 
Vec3D origin_
 origin of the cylinder. More...
 

Private Member Functions

std::string getName () const override
 Returns the name of the object. More...
 

Additional Inherited Members

- Public Attributes inherited from InsertionBoundary
std::vector< BaseParticle * > particleToCopy_
 read Distribution class from file. ‍/ friend std::istream& operator>>(std::istream& is, InsertionBoundary::Distribution& type); More...
 
unsigned int maxFailed_
 Number of times that the wall may fail to insert a particle. More...
 
unsigned int numberOfParticlesInserted_
 Number of particles that are already inserted. More...
 
Mdouble massInserted_
 Total mass of particles inserted. More...
 
Mdouble volumeInserted_
 Total volume of particles inserted. More...
 
bool isActivated_
 The InsertionBoundary is activated by default. If the InsertionBoundary is deactivated, then it introduces no particles (useful for trying to maintain a certain insertion rate). More...
 
Mdouble volumeFlowRate_
 
Mdouble initialVolume_
 
std::vector< MdoublevariableCumulativeVolumeFlowRate_
 
Mdouble samplingInterval_
 
bool checkParticleForInteraction_
 Checks if a particle has an interaction with a wall or other particles. More...
 
std::vector< PSDparticleSizeDistributionVector_
 Defines a particle size distribution as an object of the PSD class; if particleSizeDistributionVector_ is empty, distribution_ is used instead. More...
 
Vec3D velMin_
 Minimum and maximum velocity of the particles to be inserted. More...
 
Vec3D velMax_
 
bool isManuallyInserting_
 A flag to enable a top-down class-by-class manual insertion of a PSD; default is FALSE. More...
 
std::vector< Mdoubleprobability_
 vector of probabilities in range [0,1] which determine the mixing ratio of partice size distributions. More...
 
int chosenSpecies_
 stores the chosen species for each timestep. More...
 
BaseParticlep0 = nullptr
 pointer to the next particle that should be inserted (needs to be stored across time steps). More...
 

Detailed Description

Inserts particles in a cylinder with a given radius, height and azimuthal radius at a specific origin which is 0 by default.

Constructor & Destructor Documentation

◆ CylinderInsertionBoundary() [1/2]

CylinderInsertionBoundary::CylinderInsertionBoundary ( )

Constructor; sets everything to 0.

Default constructor; sets every data member to 0.

14 {
15  radMin_ = 0.0;
16  radMax_ = 0.0;
17  hMin_ = 0.0;
18  hMax_ = 0.0;
19  thetaMin_ = 0.0;
20  thetaMax_ = 0.0;
21  origin_.setZero();
23 }
Mdouble radMax_
Definition: CylinderInsertionBoundary.h:156
Mdouble radMin_
Minimal and maximal radius defining the inner and outer circle of the cylinder in which insertion sho...
Definition: CylinderInsertionBoundary.h:156
Mdouble thetaMax_
Definition: CylinderInsertionBoundary.h:151
Mdouble thetaMin_
Minimal and maximal azimuth angle in range [-pi,pi] defining the circle of the cylinder in which inse...
Definition: CylinderInsertionBoundary.h:151
Matrix3D orientationMatrix_
Orientation matrix which rotates the cylinder based on the chosen normal axis (the height axis of the...
Definition: CylinderInsertionBoundary.h:166
Mdouble hMax_
Definition: CylinderInsertionBoundary.h:161
Vec3D origin_
origin of the cylinder.
Definition: CylinderInsertionBoundary.h:171
Mdouble hMin_
Minimal and maximal height defining the cylinder in which insertion should happen.
Definition: CylinderInsertionBoundary.h:161
InsertionBoundary()
Definition: InsertionBoundary.cc:17
void setZero()
Sets all elements to zero.
Definition: Matrix.cc:54
void setZero()
Sets all elements to zero.
Definition: Vector.cc:23

References hMax_, hMin_, orientationMatrix_, origin_, radMax_, radMin_, Matrix3D::setZero(), Vec3D::setZero(), thetaMax_, and thetaMin_.

Referenced by copy().

◆ CylinderInsertionBoundary() [2/2]

CylinderInsertionBoundary::CylinderInsertionBoundary ( const CylinderInsertionBoundary other)

Copy constructor with deep copy.

Copy constructor

29  : InsertionBoundary(other)
30 {
31  radMin_ = other.radMin_;
32  radMax_ = other.radMax_;
33  hMin_ = other.hMin_;
34  hMax_ = other.hMax_;
35  thetaMin_ = other.thetaMin_;
36  thetaMax_ = other.thetaMax_;
37  origin_ = other.origin_;
39 }

References hMax_, hMin_, orientationMatrix_, origin_, radMax_, radMin_, thetaMax_, and thetaMin_.

◆ ~CylinderInsertionBoundary()

CylinderInsertionBoundary::~CylinderInsertionBoundary ( )
overridedefault

Destructor: default destructor.

Destructor. Since there are no pointers in this class, there is no need for any actions here.

Member Function Documentation

◆ copy()

CylinderInsertionBoundary * CylinderInsertionBoundary::copy ( ) const
overridevirtual

Creates a copy on the heap and returns a pointer.

Copy method; creates a copy on the heap and returns its pointer.

Returns
pointer to the copy on the heap

Implements BaseBoundary.

53 {
54 #ifdef DEBUG_CONSTRUCTOR
55  std::cout << "CylinderInsertionBoundary::copy() const finished" << std::endl;
56 #endif
57  return new CylinderInsertionBoundary(*this);
58 }
CylinderInsertionBoundary()
Constructor; sets everything to 0.
Definition: CylinderInsertionBoundary.cc:13

References CylinderInsertionBoundary().

◆ getName()

std::string CylinderInsertionBoundary::getName ( ) const
overrideprivatevirtual

Returns the name of the object.

Returns the name of the object class

Returns
the object's class' name, i.e. 'CylinderInsertionBoundary'

Implements BaseObject.

367 {
368  return "CylinderInsertionBoundary";
369 }

◆ getOrientationMatrix()

Matrix3D CylinderInsertionBoundary::getOrientationMatrix ( ) const

Returns the orientation matrix of the cylinder.

Returns the orientation matrix of the cylinder

Returns
orientationMatrix_ the orientation matrix which rotates the particles inserted into the cylinder to the right spot
318 {
319  return orientationMatrix_;
320 }

References orientationMatrix_.

Referenced by PSDSelfTest::setupInitialConditions().

◆ getOrigin()

Vec3D CylinderInsertionBoundary::getOrigin ( ) const

Returns the origin of the cylinders coordinate system.

Returns the origin of the cylinders coordinate system

Returns
origin_ the origin of the cylinders coordinate system
309 {
310  return origin_;
311 }

References origin_.

Referenced by PSDSelfTest::setupInitialConditions().

◆ getRotationMatrixX()

Matrix3D CylinderInsertionBoundary::getRotationMatrixX ( Mdouble  rotationAngle)

gets the rotationMatrix for a rotation around the X axis by a certain angle

gets the rotationMatrix for a rotation around the X axis by a certain angle

Parameters
[in]rotationAnglethe angle by which the rotation should happen
Returns
the rotation matrix in X direction
207  {
208  Matrix3D rotationMatrix;
209  rotationMatrix.XX = 1.0;
210  rotationMatrix.YY = cos(rotationAngle);
211  rotationMatrix.YZ = -sin(rotationAngle);
212  rotationMatrix.ZY = sin(rotationAngle);
213  rotationMatrix.ZZ = cos(rotationAngle);
214  return rotationMatrix;
215 }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
Implementation of a 3D matrix.
Definition: Kernel/Math/Matrix.h:17
Mdouble YY
Definition: Kernel/Math/Matrix.h:22
Mdouble ZY
Definition: Kernel/Math/Matrix.h:22
Mdouble ZZ
Definition: Kernel/Math/Matrix.h:22
Mdouble YZ
Definition: Kernel/Math/Matrix.h:22
Mdouble XX
all nine matrix elements
Definition: Kernel/Math/Matrix.h:22

References cos(), sin(), Matrix3D::XX, Matrix3D::YY, Matrix3D::YZ, Matrix3D::ZY, and Matrix3D::ZZ.

Referenced by rotateBoundary(), and setOrientation().

◆ getRotationMatrixY()

Matrix3D CylinderInsertionBoundary::getRotationMatrixY ( Mdouble  rotationAngle)

gets the rotationMatrix for a rotation around the Y axis by a certain angle

gets the rotationMatrix for a rotation around the Y axis by a certain angle

Parameters
[in]rotationAnglethe angle by which the rotation should happen
Returns
the rotation matrix in Y direction
222  {
223  Matrix3D rotationMatrix;
224  rotationMatrix.XX = cos(rotationAngle);
225  rotationMatrix.XZ = sin(rotationAngle);
226  rotationMatrix.YY = 1.0;
227  rotationMatrix.ZX = -sin(rotationAngle);
228  rotationMatrix.ZZ = cos(rotationAngle);
229  return rotationMatrix;
230 }
Mdouble ZX
Definition: Kernel/Math/Matrix.h:22
Mdouble XZ
Definition: Kernel/Math/Matrix.h:22

References cos(), sin(), Matrix3D::XX, Matrix3D::XZ, Matrix3D::YY, Matrix3D::ZX, and Matrix3D::ZZ.

Referenced by rotateBoundary(), and setOrientation().

◆ getRotationMatrixZ()

Matrix3D CylinderInsertionBoundary::getRotationMatrixZ ( Mdouble  rotationAngle)

gets the rotationMatrix for a rotation around the Z axis by a certain angle

gets the rotationMatrix for a rotation around the Z axis by a certain angle

Parameters
[in]rotationAnglethe angle by which the rotation should happen
Returns
the rotation matrix in Z direction
237  {
238  Matrix3D rotationMatrix;
239  rotationMatrix.XX = cos(rotationAngle);
240  rotationMatrix.XY = -sin(rotationAngle);
241  rotationMatrix.YX = sin(rotationAngle);
242  rotationMatrix.YY = cos(rotationAngle);
243  rotationMatrix.ZZ = 1.0;
244  return rotationMatrix;
245 }
Mdouble YX
Definition: Kernel/Math/Matrix.h:22
Mdouble XY
Definition: Kernel/Math/Matrix.h:22

References cos(), sin(), Matrix3D::XX, Matrix3D::XY, Matrix3D::YX, Matrix3D::YY, and Matrix3D::ZZ.

Referenced by rotateBoundary(), and setOrientation().

◆ placeParticle()

void CylinderInsertionBoundary::placeParticle ( BaseParticle p,
RNG random 
)
overridevirtual

Generates a random position, velocity for the particle p.

places a particle with random position (although within the boundary, of course), velocity and radius and returns its pointer.

Parameters
[in]randomRandom number generator

Implements InsertionBoundary.

265 {
266  // create vectors for cartesian position and velocity and cylindrical position
267  Vec3D pos, vel, posCylindrical;
268 
269  // draw random numbers in cartesian coordinates and make sure they are inside the cylinder sphere
270  do
271  {
272  pos.X = random.getRandomNumber(-radMax_,radMax_);
273  pos.Y = random.getRandomNumber(-radMax_,radMax_);
274  pos.Z = random.getRandomNumber(hMin_, hMax_);
275  posCylindrical = pos.getCylindricalCoordinates();
276  }
277  // make sure particle stay inside the sphere of our cylinder
278  while (posCylindrical.X > radMax_ ||
279  posCylindrical.X < radMin_ ||
280  posCylindrical.Y < thetaMin_ ||
281  posCylindrical.Y >= thetaMax_);
282 
283  // rotate cylindrical coordinates by the orientationMatrix
284  pos = orientationMatrix_*pos;
285 
286  // set the velocity in cartesian coordinates
287  vel.X = random.getRandomNumber(velMin_.X, velMax_.X);
288  vel.Y = random.getRandomNumber(velMin_.Y, velMax_.Y);
289  vel.Z = random.getRandomNumber(velMin_.Z, velMax_.Z);
290 
291  p->setPosition(pos + origin_);
292  p->setVelocity(vel);
293 }
float * p
Definition: Tutorial_Map_using.cpp:9
Vec3D velMin_
Minimum and maximum velocity of the particles to be inserted.
Definition: InsertionBoundary.h:329
Vec3D velMax_
Definition: InsertionBoundary.h:329
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:123
Definition: Kernel/Math/Vector.h:30
Mdouble Y
Definition: Kernel/Math/Vector.h:45
Mdouble Z
Definition: Kernel/Math/Vector.h:45
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
Vec3D getCylindricalCoordinates() const
Returns the representation of this Vec3D in cylindrical coordinates.
Definition: Vector.cc:270

References Vec3D::getCylindricalCoordinates(), RNG::getRandomNumber(), hMax_, hMin_, orientationMatrix_, origin_, p, radMax_, radMin_, thetaMax_, thetaMin_, InsertionBoundary::velMax_, InsertionBoundary::velMin_, Vec3D::X, Vec3D::Y, and Vec3D::Z.

◆ read()

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

reads boundary properties from istream

Reads the boundary properties from an istream

Parameters
[in,out]isthe istream

Implements BaseBoundary.

328 {
330  std::string dummy;
331  is >> dummy >> radMin_
332  >> dummy >> radMax_;
333  is >> dummy >> hMin_
334  >> dummy >> hMax_;
335  is >> dummy >> thetaMin_
336  >> dummy >> thetaMax_;
337  is >> dummy >> orientationMatrix_;
338  is >> dummy >> velMin_
339  >> dummy >> velMax_;
340  is >> dummy >> origin_;
341 }
void read(std::istream &is) override
Reads the boundary's id_ and maxFailed_.
Definition: InsertionBoundary.cc:448
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References hMax_, hMin_, orientationMatrix_, origin_, radMax_, radMin_, InsertionBoundary::read(), oomph::Global_string_for_annotation::string(), thetaMax_, thetaMin_, InsertionBoundary::velMax_, and InsertionBoundary::velMin_.

◆ rotateBoundary()

void CylinderInsertionBoundary::rotateBoundary ( Vec3D  angle)
overridevirtual

rotate the cylinder around its origin

rotate the cylinder around its origin by an XYZ rotation. The cylinder first gets rotated around X axis by angle.X then around the Y axis by angle.Y and finally around the Z axis by angle.Z.

Parameters
[in]angleDefines the angles of rotation in rad

Reimplemented from InsertionBoundary.

254 {
256 }
Matrix3D getRotationMatrixX(Mdouble rotationAngle)
gets the rotationMatrix for a rotation around the X axis by a certain angle
Definition: CylinderInsertionBoundary.cc:207
Matrix3D getRotationMatrixY(Mdouble rotationAngle)
gets the rotationMatrix for a rotation around the Y axis by a certain angle
Definition: CylinderInsertionBoundary.cc:222
Matrix3D getRotationMatrixZ(Mdouble rotationAngle)
gets the rotationMatrix for a rotation around the Z axis by a certain angle
Definition: CylinderInsertionBoundary.cc:237
double angle(const double &t)
Angular position as a function of time t.
Definition: jeffery_orbit.cc:98

References Jeffery_Solution::angle(), getRotationMatrixX(), getRotationMatrixY(), getRotationMatrixZ(), and orientationMatrix_.

Referenced by PSDSelfTest::setupInitialConditions().

◆ set() [1/5]

void CylinderInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Mdouble  radMin,
Mdouble  radMax,
Mdouble  hMin,
Mdouble  hMax,
Vec3D  normal,
Mdouble  thetaMin,
Mdouble  thetaMax,
Vec3D  velMin,
Vec3D  velMax,
Mdouble  particleRMin,
Mdouble  particleRMax 
)

old style set function which assumes a uniform psd.

144 {
145  PSD uniformPSD;
146  uniformPSD.setDistributionUniform(particleRMin, particleRMax, 2);
147  setPSD(uniformPSD);
148  set(particleToCopy, maxFailed, radMin, radMax, hMin, hMax, normal, thetaMin, thetaMax, velMin, velMax);
149 }
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Mdouble rMin, Mdouble rMax, Mdouble hMin, Mdouble hMax, Vec3D normal={0, 0, 1}, Mdouble thetaMin=-constants::pi, Mdouble thetaMax=constants::pi, Vec3D velMin={0, 0, 0}, Vec3D velMax={0, 0, 0})
Sets the properties of the InsertionBoundary for mutliple different particle types.
Definition: CylinderInsertionBoundary.cc:109
void setPSD(const PSD psd)
Sets the range of particle radii that may be generated from a user defined PSD.
Definition: InsertionBoundary.cc:652
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD)
Definition: PSD.h:47
void setDistributionUniform(Mdouble radMin, Mdouble radMax, int numberOfBins)
create a PSD vector for a uniform distribution.
Definition: PSD.cc:294
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65

References WallFunction::normal(), set(), PSD::setDistributionUniform(), and InsertionBoundary::setPSD().

◆ set() [2/5]

void CylinderInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Mdouble  rMin,
Mdouble  rMax,
Mdouble  hMin,
Mdouble  hMax,
Vec3D  normal = {0, 0, 1},
Mdouble  thetaMin = -constants::pi,
Mdouble  thetaMax = constants::pi,
Vec3D  velMin = {0, 0, 0},
Vec3D  velMax = {0, 0, 0} 
)
123 {
124  set(&particleToCopy, maxFailed, radMin, radMax, hMin, hMax, normal, thetaMin, thetaMax, velMin, velMax);
125 }

References WallFunction::normal(), and set().

◆ set() [3/5]

void CylinderInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Mdouble  radMin,
Mdouble  radMax,
Mdouble  hMin,
Mdouble  hMax,
Vec3D  normal,
Mdouble  thetaMin,
Mdouble  thetaMax,
Vec3D  velMin,
Vec3D  velMax,
Mdouble  particleRMin,
Mdouble  particleRMax 
)

old style set function which assumes a uniform psd.

old style set function which also assumes a uniform psd. Note if you want a specific PSD do not use but this is quicker for a uniform in size PSD

134 {
135  PSD uniformPSD;
136  uniformPSD.setDistributionUniform(particleRMin, particleRMax, 2);
137  setPSD(uniformPSD);
138  set(particleToCopy, maxFailed, radMin, radMax, hMin, hMax, normal, thetaMin, thetaMax, velMin, velMax);
139 }

References WallFunction::normal(), set(), PSD::setDistributionUniform(), and InsertionBoundary::setPSD().

◆ set() [4/5]

void CylinderInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Mdouble  radMin,
Mdouble  radMax,
Mdouble  hMin,
Mdouble  hMax,
Vec3D  normal = {0, 0, 1},
Mdouble  thetaMin = -constants::pi,
Mdouble  thetaMax = constants::pi,
Vec3D  velMin = {0, 0, 0},
Vec3D  velMax = {0, 0, 0} 
)

Sets the properties of the InsertionBoundary for mutliple different particle types.

Sets all the properties of the cylindrical insertion boundary.

Parameters
[in]particleToCopyPointer to the BaseParticle which is used as a basis for the particles to be inserted
[in]maxFailedThe maximum number of times the insertion of a particle may be tried and failed before the insertion of particles is considered done NB: this property is used in the parent's InsertionBoundary::checkBoundaryBeforeTimeStep().
[in]radMinminimal radius defining of the cylinder boundary
[in]radMaxmaximal radius of the cylinder boundary
[in]hMinminimal height of the cylinder boundary
[in]hMaxmaximal height of the cylinder boundary
[in]thetaMinminimal azimuth angle of the cylinder boundary
[in]thetaMaxmaximal azimuth angle of the cylinder boundary
[in]normalnormal position of the Z-axis (height) of the cylinder
[in]velMinMinimum velocity of inserted particles
[in]velMaxMaximum velocity of inserted particles
112 {
113  velMin_ = velMin;
114  velMax_ = velMax;
115  maxFailed_ = maxFailed;
116  setParticleToCopy(particleToCopy);
117  setGeometry(radMin, radMax, hMin, hMax, thetaMin, thetaMax, normal);
118 }
void setGeometry(Mdouble rMin, Mdouble rMax, Mdouble hMin, Mdouble hMax, Mdouble thetaMin, Mdouble thetaMax, Vec3D normal)
Sets the geometry (position and orientation) of the CylinderInsertionBoundary.
Definition: CylinderInsertionBoundary.cc:161
void setParticleToCopy(std::vector< BaseParticle * > particleToCopy)
Sets multiple different particles that will be inserted through the insertion boundary.
Definition: InsertionBoundary.cc:378
unsigned int maxFailed_
Number of times that the wall may fail to insert a particle.
Definition: InsertionBoundary.h:265

References InsertionBoundary::maxFailed_, WallFunction::normal(), setGeometry(), InsertionBoundary::setParticleToCopy(), InsertionBoundary::velMax_, and InsertionBoundary::velMin_.

Referenced by set(), InsertionBoundarySelfTest::setupInitialConditions(), and PSDSelfTest::setupInitialConditions().

◆ set() [5/5]

void CylinderInsertionBoundary::set ( std::vector< BaseParticle * >  particleToCopy,
unsigned int  maxFailed,
Mdouble  radMin,
Mdouble  radMax,
Mdouble  hMin,
Mdouble  hMax,
Vec3D  normal = {0, 0, 1},
Mdouble  thetaMin = -constants::pi,
Mdouble  thetaMax = constants::pi,
Vec3D  velMin = {0, 0, 0},
Vec3D  velMax = {0,0,0} 
)

Sets the properties of the InsertionBoundary for a single particle type.

Sets all the properties of the cylindrical insertion boundary.

Parameters
[in]particleToCopyvector of pointers to the BaseParticles which are used as a basis for the particle types (species) to be inserted
[in]maxFailedThe maximum number of times the insertion of a particle may be tried and failed before the insertion of particles is considered done NB: this property is used in the parent's InsertionBoundary::checkBoundaryBeforeTimeStep().
[in]radMinminimal radius defining of the cylinder boundary
[in]radMaxmaximal radius of the cylinder boundary
[in]hMinminimal height of the cylinder boundary
[in]hMaxmaximal height of the cylinder boundary
[in]thetaMinminimal azimuth angle of the cylinder boundary
[in]thetaMaxmaximal azimuth angle of the cylinder boundary
[in]normalnormal position of the Z-axis (height) of the cylinder
[in]velMinMinimum velocity of inserted particles
[in]velMaxMaximum velocity of inserted particles
82 {
83  velMin_ = velMin;
84  velMax_ = velMax;
85  maxFailed_ = maxFailed;
86  setParticleToCopy(particleToCopy);
87  setGeometry(radMin, radMax, hMin, hMax, thetaMin, thetaMax, normal);
88 }

References InsertionBoundary::maxFailed_, WallFunction::normal(), setGeometry(), InsertionBoundary::setParticleToCopy(), InsertionBoundary::velMax_, and InsertionBoundary::velMin_.

◆ setGeometry()

void CylinderInsertionBoundary::setGeometry ( Mdouble  rMin,
Mdouble  rMax,
Mdouble  hMin,
Mdouble  hMax,
Mdouble  thetaMin,
Mdouble  thetaMax,
Vec3D  normal 
)

Sets the geometry (position and orientation) of the CylinderInsertionBoundary.

set the geometry of the Cylindrical insertion boundary by setting the position and orientation.

Parameters
[in]rMinminimal radius defining an inner radius of the cylinder boundary
[in]rMaxmaximal outer radius of the cylinder boundary
[in]hMinminimal height of the cylinder boundary
[in]hMaxmaximal height of the cylinder boundary
[in]thetaMinminimal azimuth angle of the cylinder boundary
[in]thetaMaxmaximal azimuth angle of the cylinder boundary
[in]normalnormal position of the Z-axis (height) of the cylinder
162 {
163  radMin_ = rMin;
164  radMax_ = rMax;
165  hMin_ = hMin;
166  hMax_ = hMax;
167  thetaMin_ = thetaMin;
168  thetaMax_ = thetaMax;
170 }
void setOrientation(Vec3D normal)
sets the orientation of the Cylinder
Definition: CylinderInsertionBoundary.cc:177

References hMax_, hMin_, WallFunction::normal(), radMax_, radMin_, setOrientation(), thetaMax_, and thetaMin_.

Referenced by set().

◆ setOrientation()

void CylinderInsertionBoundary::setOrientation ( Vec3D  normal)

sets the orientation of the Cylinder

set the orientation of the cylinder by rotating it around the X, Y and Z axis. The order of rotation is first X, then Y, then Z.

Parameters
[in]normalDefines the angle of rotation in rad
178 {
179  logger.assert_always(!normal.isZero(),"no normal vector defined. Please define a normal vector to determine the coordinate system for the cylinder");
180  logger.assert_always(normal.X == 0 || normal.X == 1,"the normal in X direction has to be either set to 0 or 1");
181  logger.assert_always(normal.Y == 0 || normal.Y == 1,"the normal in Y direction has to be either set to 0 or 1");
182  logger.assert_always(normal.Z == 0 || normal.Z == 1,"the normal in Z direction has to be either set to 0 or 1");
183  logger.assert_always(normal.getLength() == 1, "The normal can only point to a single direction. Please set the normal to point to the X, Y or Z coordinate.");
184  if (normal.Z)
185  {
186  // do nothing
188  }
189  if (normal.Y)
190  {
191  // rotate around X to get the Z coordinate pointing to Y
193  }
194  if (normal.X)
195  {
196  // rotate around Y to get the Z coordinate pointing to X
198  }
199 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
const Mdouble pi
Definition: ExtendedMath.h:23

References getRotationMatrixX(), getRotationMatrixY(), getRotationMatrixZ(), logger, WallFunction::normal(), orientationMatrix_, and constants::pi.

Referenced by setGeometry().

◆ shiftBoundary()

void CylinderInsertionBoundary::shiftBoundary ( Vec3D  shift)
overridevirtual

shift the origin of the cylinder in the cartesian coordinate system

shifts the cylinder by a translation vector in the cartesian coordinate system

Parameters
[in]shifttranslation vector which shifts the cylinder by certain X,Y,Z coordinates

Reimplemented from InsertionBoundary.

300 {
301  origin_ += shift;
302 }

References origin_.

Referenced by PSDSelfTest::setupInitialConditions().

◆ write()

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

writes boundary properties to ostream

Writes boundary's properties to an ostream

Parameters
[in]osthe ostream

Implements BaseBoundary.

348 {
350  os << " radMin " << radMin_
351  << " radMax " << radMax_
352  << " hMin " << hMin_
353  << " hMax " << hMax_
354  << " thetaMin " << thetaMin_
355  << " thetaMax " << thetaMax_
356  << " orientationMatrix " << orientationMatrix_
357  << " velMin " << velMin_
358  << " velMax " << velMax_
359  << " origin " << origin_;
360 }
void write(std::ostream &os) const override
Writes the boundary's id_ and maxFailed_.
Definition: InsertionBoundary.cc:536

References hMax_, hMin_, orientationMatrix_, origin_, radMax_, radMin_, thetaMax_, thetaMin_, InsertionBoundary::velMax_, InsertionBoundary::velMin_, and InsertionBoundary::write().

Member Data Documentation

◆ hMax_

Mdouble CylinderInsertionBoundary::hMax_
protected

◆ hMin_

Mdouble CylinderInsertionBoundary::hMin_
protected

Minimal and maximal height defining the cylinder in which insertion should happen.

Referenced by CylinderInsertionBoundary(), placeParticle(), read(), setGeometry(), and write().

◆ orientationMatrix_

Matrix3D CylinderInsertionBoundary::orientationMatrix_
protected

Orientation matrix which rotates the cylinder based on the chosen normal axis (the height axis of the cylinder).

Referenced by CylinderInsertionBoundary(), getOrientationMatrix(), placeParticle(), read(), rotateBoundary(), setOrientation(), and write().

◆ origin_

Vec3D CylinderInsertionBoundary::origin_
protected

origin of the cylinder.

Referenced by CylinderInsertionBoundary(), getOrigin(), placeParticle(), read(), shiftBoundary(), and write().

◆ radMax_

Mdouble CylinderInsertionBoundary::radMax_
protected

◆ radMin_

Mdouble CylinderInsertionBoundary::radMin_
protected

Minimal and maximal radius defining the inner and outer circle of the cylinder in which insertion should happen.

Referenced by CylinderInsertionBoundary(), placeParticle(), read(), setGeometry(), and write().

◆ thetaMax_

Mdouble CylinderInsertionBoundary::thetaMax_
protected

◆ thetaMin_

Mdouble CylinderInsertionBoundary::thetaMin_
protected

Minimal and maximal azimuth angle in range [-pi,pi] defining the circle of the cylinder in which insertion should happen.

Referenced by CylinderInsertionBoundary(), placeParticle(), read(), setGeometry(), and write().


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