CGDisplacementFieldUnitTest.cpp File Reference

Classes

class  CGDisplacementFieldUnitTest
 Tests if the displacement momentum density is correctly calculated. More...
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
48 {
49  //declare the DPM problem and set the name
51  problem.setTimeMax(1);
52  problem.setTimeStep(0.1);
53  problem.setFileType(FileType::NO_FILE);
54 
55  //define different coarse-graining objects (which should all result in the same mean values)
57 
58  // Initially, the previous position is not set, so the displacement would not make sense at time step 0
59  cg0->setTimeMin(0.2);
60  cg0->selectSpecies(0);
61 
62  //run the simulation
63  problem.solve(argc, argv);
64 
65  Vec3D displacementMomentum = cg0->evaluateAverage().getDisplacementMomentum();
66 
67  // Calculate the expected displacement momentum
68  BaseParticle* p0 = problem.particleHandler.getObject(0);
69  Vec3D diff = problem.getMax() - problem.getMin();
70  Mdouble simulationVolume = diff.X * diff.Y * diff.Z;
71  Vec3D expectedDisplacementMomentum = p0->getMass() * p0->getVelocity() / simulationVolume;
72 
73  logger.assert_always((displacementMomentum-expectedDisplacementMomentum).getLength() < 1e-10, "Displacement momentum is not correct");
74 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
@ 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.
Vector3f p0
Definition: MatrixBase_all.cpp:2
Definition: BaseParticle.h:33
Tests if the displacement momentum density is correctly calculated.
Definition: CGDisplacementFieldUnitTest.cpp:15
Evaluates time-averaged continuum fields and writes the data into a stat file.
Definition: TimeAveragedCG.h:39
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
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References e(), logger, NO_FILE, p0, problem, Vec3D::X, Vec3D::Y, and Vec3D::Z.