FluxBoundary.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef FLUXBOUNDARY_H
6 #define FLUXBOUNDARY_H
7 
8 #include "BaseBoundary.h"
9 #include "Math/Vector.h"
10 #include "BoundaryHandler.h"
11 #include "DPMBase.h"
12 
13 class ParticleHandler;
14 
15 class BaseParticle;
16 
22 class FluxBoundary : public BaseBoundary
23 {
24 public:
28  FluxBoundary();
29 
33  ~FluxBoundary() override;
34 
38  FluxBoundary* copy() const override;
39 
43  void set(const Vec3D& normal, Mdouble distance);
44 
48  void reset();
49 
53  void move(Mdouble position);
54 
59  Mdouble getDistance(const Mdouble& distanceFromOrigin, const Vec3D& position) const;
60 
65  inline Mdouble getDistance(const Vec3D& position) const
66  {
67  return getDistance(distance_, position);
68  }
69 
75  inline Mdouble getPreviousDistance(const Vec3D& position) const
76  {
77  return getDistance(previousDistance_, position);
78  }
79 
84 
89 
93  unsigned int getNumberOfParticlesCrossedForw() const;
94 
95  unsigned int getNumberOfParticlesCrossedBack() const;
96 
97  unsigned int getNumberOfParticlesCrossedNet() const;
98 
99  double getMassOfParticlesCrossedForw() const;
100 
101  double getMassOfParticlesCrossedBack() const;
102 
103  double getMassOfParticlesCrossedNet() const;
104 
105  double getVolumeOfParticlesCrossedForw() const;
106 
107  double getVolumeOfParticlesCrossedBack() const;
108 
109  double getVolumeOfParticlesCrossedNet() const;
110 
114  void read(std::istream& is) override;
115 
120  void oldRead(std::istream& is);
121 
125  void write(std::ostream& os) const override;
126 
130  std::string getName() const override;
131 
135  void setPrescribedDistance(std::function<Mdouble(double)> prescribedDistance);
136 
137 private:
142 
152 
157 
164 
174 
178  std::function<Mdouble(double)> prescribedDistance_;
179 
180 };
181 
182 
183 #endif
double Mdouble
Definition: GeneralDefine.h:13
#define MERCURYDPM_DEPRECATED
Definition: GeneralDefine.h:16
float * p
Definition: Tutorial_Map_using.cpp:9
Definition: BaseBoundary.h:28
Definition: BaseParticle.h:33
Used for measuring flow rates through a given plane; acts like a pair of scales Inherits from BaseBou...
Definition: FluxBoundary.h:23
double getVolumeOfParticlesCrossedNet() const
Definition: FluxBoundary.cc:192
~FluxBoundary() override
destructor
Definition: FluxBoundary.cc:35
double getVolumeOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:177
double getMassOfParticlesCrossedForw() const
Definition: FluxBoundary.cc:157
Mdouble previousDistance_
The boundary's distance from the origin in the previous timestep).
Definition: FluxBoundary.h:163
unsigned int getNumberOfParticlesCrossedForw() const
Gets the number of particles that have crossed the boundary.
Definition: FluxBoundary.cc:152
double getMassOfParticlesCrossedNet() const
Definition: FluxBoundary.cc:187
FluxBoundary * copy() const override
Copy method; creates copy on the heap and returns a pointer to it.
Definition: FluxBoundary.cc:47
Mdouble distance_
The boundary's distance from the origin.
Definition: FluxBoundary.h:156
void set(const Vec3D &normal, Mdouble distance)
Sets boundary position based on a normal and distance.
Definition: FluxBoundary.cc:66
FluxBoundary()
default constructor
Definition: FluxBoundary.cc:14
void move(Mdouble position)
Sets the boundary's distance property to the given one.
Definition: FluxBoundary.cc:92
double massCrossedBack_
Definition: FluxBoundary.h:171
Mdouble scaleFactor_
This is the factor to rescale the given normal vector to a unit vectors.
Definition: FluxBoundary.h:151
void write(std::ostream &os) const override
Writes the boundary properties to an std::ostream.
Definition: FluxBoundary.cc:236
Mdouble getDistance(const Vec3D &position) const
Returns the shortest distance between the boundary and given position.
Definition: FluxBoundary.h:65
unsigned int numberOfParticlesCrossedBack_
Definition: FluxBoundary.h:169
MERCURYDPM_DEPRECATED void oldRead(std::istream &is)
Deprecated read method. use FluxBoundary::read() instead.
Definition: FluxBoundary.cc:226
unsigned int getNumberOfParticlesCrossedNet() const
Definition: FluxBoundary.cc:182
void read(std::istream &is) override
Reads some boundary properties from an std::istream.
Definition: FluxBoundary.cc:206
double volumeCrossedBack_
Definition: FluxBoundary.h:173
std::string getName() const override
Returns the name of the object.
Definition: FluxBoundary.cc:255
double volumeCrossedForw_
Definition: FluxBoundary.h:172
bool checkBoundaryAfterParticleMoved(BaseParticle *p, ParticleHandler &pH)
Checks if particle has crossed the boundary and updates the scales if so.
Definition: FluxBoundary.cc:130
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Runs at the end of each time step.
Definition: FluxBoundary.cc:108
unsigned int getNumberOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:167
Mdouble getDistance(const Mdouble &distanceFromOrigin, const Vec3D &position) const
Returns the shortest distance between the boundary at a given separation from the origin and given po...
Definition: FluxBoundary.cc:103
Vec3D normal_
outward unit normal vector
Definition: FluxBoundary.h:141
double getVolumeOfParticlesCrossedForw() const
Definition: FluxBoundary.cc:162
double getMassOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:172
unsigned int numberOfParticlesCrossedForw_
Number of particles that have been deleted by this boundary.
Definition: FluxBoundary.h:168
void reset()
Resets the counts to zero.
Definition: FluxBoundary.cc:77
std::function< Mdouble(double)> prescribedDistance_
A function which sets the distance of the boundary from the origin.
Definition: FluxBoundary.h:178
void setPrescribedDistance(std::function< Mdouble(double)> prescribedDistance)
Sets the prescribed distance function.
Definition: FluxBoundary.cc:197
Mdouble getPreviousDistance(const Vec3D &position) const
Returns the shortest distance between the boundary and given position as it was in the previous times...
Definition: FluxBoundary.h:75
double massCrossedForw_
Definition: FluxBoundary.h:170
Container to store pointers to all particles.
Definition: ParticleHandler.h:28
Definition: Kernel/Math/Vector.h:30
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286