47 BaseParticle P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13;
63 P1. setVelocity(
Vec3D(-1e-2, 0e-2, 0.0));
64 P3. setVelocity(
Vec3D(-1e-2, 0e-2, 0.0));
65 P5. setVelocity(
Vec3D( 1e-2, 0e-2, 0.0));
66 P7. setVelocity(
Vec3D( 1e-2, 0e-2, 0.0));
67 P9. setVelocity(
Vec3D( 1e-2, 0e-2, 0.0));
125 species->setDensity(2000);
126 species->setStiffness(10000);
127 species->setDissipation(1);
133 problem.
setName(
"PeriodicWallsUnitTest");
141 goodPos=
Vec3D(0.00950076062215577,0.002,0);
142 goodVel=
Vec3D(-0.005560409816604,0,0);
143 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
145 logger(
FATAL,
"E0 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
147 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
149 logger(
FATAL,
"E0 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
153 goodPos=
Vec3D(0.000725163257251641,0.002,0);
154 goodVel=
Vec3D(-0.000808302139899,0,0);
155 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
157 logger(
FATAL,
"E1 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
159 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
161 logger(
FATAL,
"E1 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
165 goodPos=
Vec3D(0.00950076062215577,0.003,0);
166 goodVel=
Vec3D(-0.005560409816604,0,0);
167 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
169 logger(
FATAL,
"E2 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
171 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
173 logger(
FATAL,
"E2 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
177 goodPos=
Vec3D(0.000725163257251641,0.003,0);
178 goodVel=
Vec3D(-0.000808302139899,0,0);
179 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
181 logger(
FATAL,
"E3 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
183 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
185 logger(
FATAL,
"E3 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
189 goodPos=
Vec3D(0.0004992393778432442,0.004,0);
190 goodVel=
Vec3D(0.00556040981661,0,0);
191 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
193 logger(
FATAL,
"E4 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
195 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
197 logger(
FATAL,
"E4 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
201 goodPos=
Vec3D(0.00927483674274562,0.004,0);
202 goodVel=
Vec3D(0.0008083021398896,0,0);
203 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
205 logger(
FATAL,
"E5 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
207 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
209 logger(
FATAL,
"E5 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
213 goodPos=
Vec3D(0.000499239377843248,0.005,0);
214 goodVel=
Vec3D(0.00556040981661,0,0);
215 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
217 logger(
FATAL,
"E6 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
219 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
221 logger(
FATAL,
"E6 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
225 goodPos=
Vec3D(0.00927483674274562,0.005,0);
226 goodVel=
Vec3D(0.0008083021398892,0,0);
227 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
229 logger(
FATAL,
"E7 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
231 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
233 logger(
FATAL,
"E7 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
237 goodPos=
Vec3D(0.00149923937784423,0.006,0);
238 goodVel=
Vec3D(0.005560409816606,0,0);
239 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
241 logger(
FATAL,
"E8 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
243 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
245 logger(
FATAL,
"E8 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
249 goodPos=
Vec3D(0.000274836742748357,0.006,0);
250 goodVel=
Vec3D(0.0008083021398959,0,0);
251 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
253 logger(
FATAL,
"E9 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
255 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
257 logger(
FATAL,
"E9 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
261 goodPos=
Vec3D(0.000368955529803987, 0.000368955529803987,0);
262 goodVel=
Vec3D(0.005560480643586,0.005560480643586,0);
263 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
265 logger(
FATAL,
"E10 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
267 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
269 logger(
FATAL,
"E10 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
273 goodPos=
Vec3D(0.0094902039201126, 0.0094902039201126 ,0);
274 goodVel=
Vec3D(0.0008081850585628,0.0008081850585628,0);
275 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
277 logger(
FATAL,
"E11 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
279 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
281 logger(
FATAL,
"E11 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
285 goodPos=
Vec3D(0.00963104447019111, 0.00963104447019111,0.001);
286 goodVel=
Vec3D(-0.005560480643562,-0.005560480643562,0);
287 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
289 logger(
FATAL,
"E12 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
291 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
293 logger(
FATAL,
"E12 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
297 goodPos=
Vec3D(0.00050979607988006, 0.00050979607988006,0.001);
298 goodVel=
Vec3D(-0.0008081850586013,-0.0008081850586013,0);
299 if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
301 logger(
FATAL,
"E13 The particle is in the wrong position. It is %, however is should be %", (*pIt)->getPosition(), goodPos);
303 if (!(*pIt)->getVelocity().isEqualTo(goodVel , 1e-10))
305 logger.log(
Log::FATAL,
"E13 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(), goodVel);
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a periodic wall.
void solve()
The work horse of the code.
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
int main(int argc UNUSED, char *argv[] UNUSED)
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Defines a pair of periodic walls. Inherits from BaseBoundary.
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
void computeExternalForces(BaseParticle *CI)
This is were the walls are implemented.
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
virtual void addObject(ParticleSpecies *const S)
Adds a new ParticleSpecies to the SpeciesHandler.
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
LL< Log::FATAL > FATAL
Fatal log level.
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
virtual void computeForcesDueToWalls(BaseParticle *PI)
Computes the forces on the particles due to the walls (normals are outward normals) ...
Implementation of a 3D vector (by Vitaliy).
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
unsigned int getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep(unsigned int numberOfSaves, Mdouble timeMax, Mdouble timestep)
Returns the correct saveCount if the total number of saves, the final time and the time step is known...
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
This adds on the hierarchical grid code for 2D problems.