FluxBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef FLUXBOUNDARY_H
27 #define FLUXBOUNDARY_H
28 
29 #include "BaseBoundary.h"
30 #include "Math/Vector.h"
31 
32 class ParticleHandler;
33 
34 class BaseParticle;
35 
41 class FluxBoundary : public BaseBoundary
42 {
43 public:
47  FluxBoundary();
48 
52  ~FluxBoundary() override;
53 
57  FluxBoundary* copy() const override;
58 
62  void set(const Vec3D& normal, Mdouble distance);
63 
67  void reset();
68 
72  void move(Mdouble position);
73 
77  Mdouble getDistance(const Vec3D& position) const;
78 
83 
88 
92  unsigned int getNumberOfParticlesCrossedForw() const;
93 
94  unsigned int getNumberOfParticlesCrossedBack() const;
95 
96  unsigned int getNumberOfParticlesCrossedNet() const;
97 
98  double getMassOfParticlesCrossedForw() const;
99 
100  double getMassOfParticlesCrossedBack() const;
101 
102  double getMassOfParticlesCrossedNet() const;
103 
104  double getVolumeOfParticlesCrossedForw() const;
105 
106  double getVolumeOfParticlesCrossedBack() const;
107 
108  double getVolumeOfParticlesCrossedNet() const;
109 
113  void read(std::istream& is) override;
114 
119  void oldRead(std::istream& is);
120 
124  void write(std::ostream& os) const override;
125 
129  std::string getName() const override;
130 
131 private:
149 
159 };
160 
161 
162 #endif
#define MERCURYDPM_DEPRECATED
Definition: GeneralDefine.h:37
Definition: BaseBoundary.h:49
Definition: BaseParticle.h:54
Used for measuring flow rates through a given plane; acts like a pair of scales Inherits from BaseBou...
Definition: FluxBoundary.h:42
double getVolumeOfParticlesCrossedNet() const
Definition: FluxBoundary.cc:202
~FluxBoundary() override
destructor
Definition: FluxBoundary.cc:54
double getVolumeOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:187
double getMassOfParticlesCrossedForw() const
Definition: FluxBoundary.cc:167
unsigned int getNumberOfParticlesCrossedForw() const
Gets the number of particles that have crossed the boundary.
Definition: FluxBoundary.cc:162
double getMassOfParticlesCrossedNet() const
Definition: FluxBoundary.cc:197
FluxBoundary * copy() const override
Copy method; creates copy on the heap and returns a pointer to it.
Definition: FluxBoundary.cc:66
Mdouble distance_
The boundary's distance from the origin.
Definition: FluxBoundary.h:148
void set(const Vec3D &normal, Mdouble distance)
Sets boundary position based on a normal and distance.
Definition: FluxBoundary.cc:85
FluxBoundary()
default constructor
Definition: FluxBoundary.cc:35
void move(Mdouble position)
Sets the boundary's distance property to the given one.
Definition: FluxBoundary.cc:110
double massCrossedBack_
Definition: FluxBoundary.h:156
Mdouble scaleFactor_
This is the factor to rescale the given normal vector to a unit vectors.
Definition: FluxBoundary.h:144
void write(std::ostream &os) const override
Writes the boundary properties to an std::ostream.
Definition: FluxBoundary.cc:235
Mdouble getDistance(const Vec3D &position) const
Returns the shortest distance between the boundary and given position.
Definition: FluxBoundary.cc:119
unsigned int numberOfParticlesCrossedBack_
Definition: FluxBoundary.h:154
MERCURYDPM_DEPRECATED void oldRead(std::istream &is)
Deprecated read method. use FluxBoundary::read() instead.
Definition: FluxBoundary.cc:225
unsigned int getNumberOfParticlesCrossedNet() const
Definition: FluxBoundary.cc:192
void read(std::istream &is) override
Reads some boundary properties from an std::istream.
Definition: FluxBoundary.cc:211
double volumeCrossedBack_
Definition: FluxBoundary.h:158
std::string getName() const override
Returns the name of the object.
Definition: FluxBoundary.cc:247
double volumeCrossedForw_
Definition: FluxBoundary.h:157
bool checkBoundaryAfterParticleMoved(BaseParticle *p, ParticleHandler &pH)
Checks if particle has crossed the boundary and updates the scales if so.
Definition: FluxBoundary.cc:137
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Runs at the end of each time step.
Definition: FluxBoundary.cc:124
unsigned int getNumberOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:177
Vec3D normal_
outward unit normal vector
Definition: FluxBoundary.h:135
double getVolumeOfParticlesCrossedForw() const
Definition: FluxBoundary.cc:172
double getMassOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:182
unsigned int numberOfParticlesCrossedForw_
Number of particles that have been deleted by this boundary.
Definition: FluxBoundary.h:153
void reset()
Resets the counts to zero.
Definition: FluxBoundary.cc:95
double massCrossedForw_
Definition: FluxBoundary.h:155
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
Definition: Vector.h:51