PeriodicWallsUnitTest.cpp File Reference

Classes

class  PeriodicWalls
 

Functions

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

Function Documentation

◆ main()

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

Start off my solving the default problem

114 {
118  species.setDensity(2000);
119  species.setStiffness(10000);
120  species.setDissipation(1);
121  problem.speciesHandler.copyAndAddObject(species);
122 
123  problem.setTimeMax(0.11);
124  problem.setTimeStep(1.1e-05);
126  problem.getTimeStep()));
127  problem.setName("PeriodicWallsUnitTest");
128 
129  problem.solve();
130 
131  Vec3D goodPos;
132  Vec3D goodVel;
133  std::vector<BaseParticle*>::iterator pIt = problem.particleHandler.begin();
134 
135  goodPos = Vec3D(0.00950076062215577, 0.002, 0);
136  goodVel = Vec3D(-0.005560409816604, 0, 0);
137  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
138  {
139  logger(FATAL, "E0 The particle is in the wrong position. It is %, however is should be %",
140  (*pIt)->getPosition(), goodPos);
141  }
142  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
143  {
144  logger(FATAL, "E0 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
145  goodVel);
146  }
147  ++pIt;
148 
149  goodPos = Vec3D(0.000725163257251641, 0.002, 0);
150  goodVel = Vec3D(-0.000808302139899, 0, 0);
151  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
152  {
153  logger(FATAL, "E1 The particle is in the wrong position. It is %, however is should be %",
154  (*pIt)->getPosition(), goodPos);
155  }
156  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
157  {
158  logger(FATAL, "E1 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
159  goodVel);
160  }
161  ++pIt;
162 
163  goodPos = Vec3D(0.00950076062215577, 0.003, 0);
164  goodVel = Vec3D(-0.005560409816604, 0, 0);
165  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
166  {
167  logger(FATAL, "E2 The particle is in the wrong position. It is %, however is should be %",
168  (*pIt)->getPosition(), goodPos);
169  }
170  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
171  {
172  logger(FATAL, "E2 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
173  goodVel);
174  }
175  ++pIt;
176 
177  goodPos = Vec3D(0.000725163257251641, 0.003, 0);
178  goodVel = Vec3D(-0.000808302139899, 0, 0);
179  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
180  {
181  logger(FATAL, "E3 The particle is in the wrong position. It is %, however is should be %",
182  (*pIt)->getPosition(), goodPos);
183  }
184  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
185  {
186  logger(FATAL, "E3 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
187  goodVel);
188  }
189  ++pIt;
190 
191  goodPos = Vec3D(0.0004992393778432442, 0.004, 0);
192  goodVel = Vec3D(0.00556040981661, 0, 0);
193  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
194  {
195  logger(FATAL, "E4 The particle is in the wrong position. It is %, however is should be %",
196  (*pIt)->getPosition(), goodPos);
197  }
198  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
199  {
200  logger(FATAL, "E4 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
201  goodVel);
202  }
203  ++pIt;
204 
205  goodPos = Vec3D(0.00927483674274562, 0.004, 0);
206  goodVel = Vec3D(0.0008083021398896, 0, 0);
207  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
208  {
209  logger(FATAL, "E5 The particle is in the wrong position. It is %, however is should be %",
210  (*pIt)->getPosition(), goodPos);
211  }
212  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
213  {
214  logger(FATAL, "E5 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
215  goodVel);
216  }
217  ++pIt;
218 
219  goodPos = Vec3D(0.000499239377843248, 0.005, 0);
220  goodVel = Vec3D(0.00556040981661, 0, 0);
221  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
222  {
223  logger(FATAL, "E6 The particle is in the wrong position. It is %, however is should be %",
224  (*pIt)->getPosition(), goodPos);
225  }
226  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
227  {
228  logger(FATAL, "E6 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
229  goodVel);
230  }
231  ++pIt;
232 
233  goodPos = Vec3D(0.00927483674274562, 0.005, 0);
234  goodVel = Vec3D(0.0008083021398892, 0, 0);
235  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
236  {
237  logger(FATAL, "E7 The particle is in the wrong position. It is %, however is should be %",
238  (*pIt)->getPosition(), goodPos);
239  }
240  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
241  {
242  logger(FATAL, "E7 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
243  goodVel);
244  }
245  ++pIt;
246 
247  goodPos = Vec3D(0.00149923937784423, 0.006, 0);
248  goodVel = Vec3D(0.005560409816606, 0, 0);
249  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
250  {
251  logger(FATAL, "E8 The particle is in the wrong position. It is %, however is should be %",
252  (*pIt)->getPosition(), goodPos);
253  }
254  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
255  {
256  logger(FATAL, "E8 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
257  goodVel);
258  }
259  ++pIt;
260 
261  goodPos = Vec3D(0.000274836742748357, 0.006, 0);
262  goodVel = Vec3D(0.0008083021398959, 0, 0);
263  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
264  {
265  logger(FATAL, "E9 The particle is in the wrong position. It is %, however is should be %",
266  (*pIt)->getPosition(), goodPos);
267  }
268  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
269  {
270  logger(FATAL, "E9 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
271  goodVel);
272  }
273  ++pIt;
274 
275  goodPos = Vec3D(0.000368955529803987, 0.000368955529803987, 0);
276  goodVel = Vec3D(0.005560480643586, 0.005560480643586, 0);
277  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
278  {
279  logger(FATAL, "E10 The particle is in the wrong position. It is %, however is should be %",
280  (*pIt)->getPosition(), goodPos);
281  }
282  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
283  {
284  logger(FATAL, "E10 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
285  goodVel);
286  }
287  ++pIt;
288 
289  goodPos = Vec3D(0.0094902039201126, 0.0094902039201126, 0);
290  goodVel = Vec3D(0.0008081850585628, 0.0008081850585628, 0);
291  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
292  {
293  logger(FATAL, "E11 The particle is in the wrong position. It is %, however is should be %",
294  (*pIt)->getPosition(), goodPos);
295  }
296  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
297  {
298  logger(FATAL, "E11 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
299  goodVel);
300  }
301  ++pIt;
302 
303  goodPos = Vec3D(0.00963104447019111, 0.00963104447019111, 0.001);
304  goodVel = Vec3D(-0.005560480643562, -0.005560480643562, 0);
305  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
306  {
307  logger(FATAL, "E12 The particle is in the wrong position. It is %, however is should be %",
308  (*pIt)->getPosition(), goodPos);
309  }
310  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
311  {
312  logger(FATAL, "E12 The particle has the wrong velocity. It is %, however is should be %", (*pIt)->getVelocity(),
313  goodVel);
314  }
315  ++pIt;
316 
317  goodPos = Vec3D(0.00050979607988006, 0.00050979607988006, 0.001);
318  goodVel = Vec3D(-0.0008081850586013, -0.0008081850586013, 0);
319  if (!(*pIt)->getPosition().isEqualTo(goodPos, 1e-10))
320  {
321  logger(FATAL, "E13 The particle is in the wrong position. It is %, however is should be %",
322  (*pIt)->getPosition(), goodPos);
323  }
324  if (!(*pIt)->getVelocity().isEqualTo(goodVel, 1e-10))
325  {
326  logger(FATAL, "E13 The particle has the wrong velocity. It is %, however is should be %",
327  (*pIt)->getVelocity(), goodVel);
328  }
329 
330 
331 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
LL< Log::FATAL > FATAL
Definition of the different loglevels by its wrapper class LL. These are used as tags in template met...
Definition: Logger.cc:31
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
void setDissipation(Mdouble dissipation)
Allows the normal dissipation to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:96
void setStiffness(Mdouble new_k)
Allows the spring constant to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:72
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
Definition: PeriodicWallsUnitTest.cpp:11
Definition: Kernel/Math/Vector.h:30
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...
Definition: FormulaHelpers.cc:75
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References e(), FATAL, helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(), logger, problem, ParticleSpecies::setDensity(), LinearViscoelasticNormalSpecies::setDissipation(), and LinearViscoelasticNormalSpecies::setStiffness().