30 #ifndef CONTACT_LAW_TEST_HELPERS
31 #define CONTACT_LAW_TEST_HELPERS
49 class LoadingTest :
public DPMBase
58 : species(species), displacement(displacement), velocity(velocity), radius(radius)
70 setMax({radius, radius, radius + radius});
71 setMin({-radius, -radius, 0});
75 speciesHandler.copyAndAddObject(*species);
81 particleHandler.copyAndAddObject(p);
86 wallHandler.copyAndAddObject(w);
92 logger.assert_debug(p,
"Empty particle handler");
96 if (
getTime() <= displacement / velocity)
107 } test(species, displacement, velocity, radius);
110 helpers::writeToFile(test.getName() +
".gnu",
"plot '" + test.getName() +
".fstat' u 7:9 w lp");
111 logger(
INFO,
"finished loading test: run 'gnuplot %.gnu' to view output", test.getName());
124 class LoadingTest :
public DPMBase
128 Mdouble tangentialDisplacement;
135 : species(species), displacement(displacement), tangentialDisplacement(tangentialDisplacement),
136 velocity(velocity), radius(radius)
142 setTimeMax(4.0 * tangentialDisplacement / velocity);
148 setMax({radius, radius, radius + radius});
149 setMin({-radius, -radius, 0});
153 speciesHandler.copyAndAddObject(*species);
159 particleHandler.copyAndAddObject(p);
164 wallHandler.copyAndAddObject(w);
170 logger.assert_debug(p,
"Empty particle handler");
174 bool moveRight =
static_cast<int>(
getTime() / (2.0*tangentialDisplacement / velocity) +0.5)%2==0;
178 p->
setPosition({tangentialDisplacement - velocity *
getTime(), 0, radius - displacement});
183 p->
setPosition({-2*tangentialDisplacement + velocity *
getTime(), 0, radius - displacement});
187 } test(species, displacement, tangentialDisplacement, velocity, radius);
190 helpers::writeToFile(test.getName() +
".gnu",
"plot '" + test.getName() +
".fstat' u 8:($10*$14) w lp");
191 logger(
INFO,
"finished tangential loading test: run 'gnuplot %.gnu' to view output", test.getName());
203 class ObjectivenessTest :
public DPMBase
207 Mdouble tangentialDisplacement;
214 : species(species), displacement(displacement), tangentialDisplacement(tangentialDisplacement),
215 velocity(velocity), radius(radius)
233 speciesHandler.copyAndAddObject(*species);
239 particleHandler.copyAndAddObject(p);
241 particleHandler.copyAndAddObject(p);
248 logger.assert_debug(p,
"Empty particle handler");
249 logger.assert_debug(q,
"Empty particle handler");
252 if (
getTime() <= tangentialDisplacement / velocity)
256 p->
setPosition({-tangentialDisplacement + velocity *
getTime(), radius - displacement, 0});
259 q->
setPosition({tangentialDisplacement - velocity *
getTime(), -radius + displacement, 0});
263 Mdouble angle = velocity / (radius - displacement) * (
getTime() - tangentialDisplacement / velocity);
279 } test(species, displacement, tangentialDisplacement, velocity, radius);
282 helpers::writeToFile(test.getName() +
".gnu",
"set size ratio -1; plot '" + test.getName() +
".fstat' u 14:15 every 2 w lp");
283 logger(
INFO,
"finished objectiveness test: run 'gnuplot %.gnu' to view output", test.getName());
@ NO_FILE
file will not be created/read
@ ONE_FILE
all data will be written into/ read from a single file called name_
double Mdouble
Definition: GeneralDefine.h:34
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
Definition: BaseInteractable.h:230
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
Definition: BaseInteractable.cc:341
virtual void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
Definition: BaseInteractable.h:260
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Definition: BaseInteractable.cc:360
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
Definition: BaseParticle.h:54
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:553
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:818
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:169
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
virtual void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: DPMBase.cc:1998
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1448
virtual void actionsBeforeTimeStep()
A virtual function which allows to define operations to be executed before the new time step.
Definition: DPMBase.cc:1864
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:808
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:459
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1118
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void setSystemDimensions(unsigned int newDim)
Sets the system dimensionality.
Definition: DPMBase.cc:1417
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1082
Mdouble getTimeMax() const
Returns the maximum simulation duration.
Definition: DPMBase.cc:888
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:118
Definition: ParticleSpecies.h:37
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
const Mdouble pi
Definition: ExtendedMath.h:45
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44
std::string name
Definition: MercuryProb.h:48