CGForceDensityUnitTest.cpp File Reference
#include "Mercury3D.h"
#include "Species/LinearViscoelasticSpecies.h"
#include "CG/CG.h"

Classes

class  CGForceDensityUnitTest
 Tests if the force density between two species has the correct sign assigned. More...
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
54 {
55  //declare the DPM problem and set the name
57  problem.setTimeMax(0.1); //a total of 5000 time steps
58  problem.setTimeStep(0.1);
59  problem.setFileType(FileType::NO_FILE);
60 
61  //define different coarse-graining objects (which should all result in the same mean values)
62  auto cg0 = problem.cgHandler.copyAndAddObject(CG<CGCoordinates::O>());
63  cg0->setTimeMin(0.1);
64  cg0->selectSpecies(0);
65  auto cg1 = problem.cgHandler.copyAndAddObject(CG<CGCoordinates::O>());
66  cg1->setTimeMin(0.1);
67  cg1->selectSpecies(1);
68 
69  //run the simulation
70  problem.solve(argc, argv);
71 
72  Vec3D cg0ForceDensityResult = static_cast<CG<CGCoordinates::O,CGFunctions::Lucy,CGFields::StandardFields>*>(cg0)->evaluateAverage().getInteractionForceDensity();
73  Vec3D cg1ForceDensityResult = static_cast<CG<CGCoordinates::O,CGFunctions::Lucy,CGFields::StandardFields>*>(cg1)->evaluateAverage().getInteractionForceDensity();
74 
75  logger(INFO, "ForceDensity species 0 %, forceDensity species 1 %, sum %", cg0ForceDensityResult, cg1ForceDensityResult, (cg0ForceDensityResult + cg1ForceDensityResult));
76  logger.assert_always(cg0ForceDensityResult.getLength() > 10 && cg1ForceDensityResult.getLength() > 10, "evaluated force density is too small");
77  logger.assert_always(cg0ForceDensityResult.X < -1 && cg1ForceDensityResult.X > 1, "force density does not point in the right direction");
78  logger.assert_always( (cg0ForceDensityResult + cg1ForceDensityResult).getLength() < 1e-10, "evaluated force densities do not sum to 0");
79 }
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.
Tests if the force density between two species has the correct sign assigned.
Definition: CGForceDensityUnitTest.cpp:15
Evaluates time-resolved continuum fields and writes the data into a stat file.
Definition: CG.h:55
Definition: Kernel/Math/Vector.h:30
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:350
#define INFO(i)
Definition: mumps_solver.h:54
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References e(), Vec3D::getLength(), INFO, logger, NO_FILE, problem, and Vec3D::X.