FluxBoundaryUnitTest.cpp File Reference

Classes

class  FluxBoundaryUnitTest
 Tests if FluxBoundary correctly measures the flux of particles crossing the boundary. More...
 

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
61 {
62  //declare the DPM problem and set the name
64  problem.setTimeMax(1);
65  problem.setTimeStep(0.1);
66  problem.setFileType(FileType::NO_FILE);
67 
68  //run the simulation
69  problem.solve(argc, argv);
70 
71  // Check the value of the fluxBoundary
72  FluxBoundary* fluxBoundary = static_cast<FluxBoundary*>(problem.boundaryHandler.getObject(0));
73 
74  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedNet() == 1, "Wrong number of particles crossed the flux boundary");
75  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedForw() == 2, "Wrong number of particles crossed the flux boundary (Forward)");
76  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedForw() == 2, "Wrong number of particles crossed the flux boundary (Backward)");
77 
78  // Get and ckeck volume of particles
79  Mdouble particleVolume = problem.particleHandler.getObject(0)->getVolume();
80  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedNet()*particleVolume == fluxBoundary->getVolumeOfParticlesCrossedNet(), "Wrong volume of particles crossed the flux boundary");
81  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedForw()*particleVolume == fluxBoundary->getVolumeOfParticlesCrossedForw(), "Wrong volume of particles crossed the flux boundary (Forward)");
82  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedBack()*particleVolume == fluxBoundary->getVolumeOfParticlesCrossedBack(), "Wrong volume of particles crossed the flux boundary (Backward)");
83 
84  // Get and check mass of particles
85  Mdouble particleMass = problem.particleHandler.getObject(0)->getMass();
86  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedNet()*particleMass == fluxBoundary->getMassOfParticlesCrossedNet(), "Wrong mass of particles crossed the flux boundary");
87  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedForw()*particleMass == fluxBoundary->getMassOfParticlesCrossedForw(), "Wrong mass of particles crossed the flux boundary (Forward)");
88  logger.assert_always(fluxBoundary->getNumberOfParticlesCrossedBack()*particleMass == fluxBoundary->getMassOfParticlesCrossedBack(), "Wrong mass of particles crossed the flux boundary (Backward)");
89 }
@ NO_FILE
file will not be created/read
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
Tests if FluxBoundary correctly measures the flux of particles crossing the boundary.
Definition: FluxBoundaryUnitTest.cpp:14
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
double getVolumeOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:177
double getMassOfParticlesCrossedForw() const
Definition: FluxBoundary.cc:157
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
unsigned int getNumberOfParticlesCrossedNet() const
Definition: FluxBoundary.cc:182
unsigned int getNumberOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:167
double getVolumeOfParticlesCrossedForw() const
Definition: FluxBoundary.cc:162
double getMassOfParticlesCrossedBack() const
Definition: FluxBoundary.cc:172
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References FluxBoundary::getMassOfParticlesCrossedBack(), FluxBoundary::getMassOfParticlesCrossedForw(), FluxBoundary::getMassOfParticlesCrossedNet(), FluxBoundary::getNumberOfParticlesCrossedBack(), FluxBoundary::getNumberOfParticlesCrossedForw(), FluxBoundary::getNumberOfParticlesCrossedNet(), FluxBoundary::getVolumeOfParticlesCrossedBack(), FluxBoundary::getVolumeOfParticlesCrossedForw(), FluxBoundary::getVolumeOfParticlesCrossedNet(), logger, NO_FILE, and problem.