LiquidMigrationPeriodicBoundaryUnitTest.cpp File Reference

Classes

class  LiquidMigrationPeriodicBoundaryInteraction
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
45 {
46  logger(INFO,"This unit test checks that liquid bridge migration is not affected by the slight inaccuracy created "
47  "by having ghost particles. A pair of particles is created that touches right at the periodic boundary.");
48 
49  logger(INFO,"Testing formation");
50 
52 
53  //set dpm properties
54  {
55  dpm.setName("LiquidMigrationPeriodicBoundaryInteraction");
56  dpm.setTimeStep(1e-4);
57  dpm.setTimeMax(5e-4);
58  dpm.setMin({0,-.5,-.5});
59  dpm.setMax({5,.5,.5});
60  dpm.setSaveCount(1);
61  dpm.setGravity({0,0,0});
62  }
63 
64  //add species
65  {
67  s.setDensity(6. / constants::pi);
68  s.setCollisionTimeAndRestitutionCoefficient(50*dpm.getTimeStep(), .9, 1);
69  s.setLiquidBridgeVolumeMax(1.1);
71  }
72 
73  //add boundary
74  {
76  b.set({1,0,0},-.5,4.5);
78  }
79 
80  //add particles
81  {
83  p.setRadius(.5);
84  p.setSpecies(dpm.speciesHandler.getLastObject());
85  p.setLiquidVolume(.5);
86 
87  p.setPosition({4,0,0});
89 
90  //p.setPosition({0,0,0});
91  p.setPosition({2*pow(2,-52),0,0}); //touches on left boundary, but not on right
93  }
94 
95  //solve should cause a bridge to form
96  Mdouble initialLiquidVolume = dpm.getLiquidVolume();
97  dpm.printTime();
98  dpm.solve();
99 
100  logger.assert_always(isEqual(dpm.getLiquidVolume(), initialLiquidVolume, 1e-14),
101  "Liquid Volume not conserved (%!=%)", dpm.getLiquidVolume(), initialLiquidVolume);
102 
103  logger(INFO,"Testing rupture");
104 
105  //move particles, causing a rupture
106  {
108  p->setPosition({3,0,0});
109  }
110 
111 
112  //solve should cause a bridge to rupture
113  dpm.setRestarted(true);
114  dpm.setTimeMax(2.0*dpm.getTimeMax());
115  dpm.printTime();
116  dpm.solve();
117 
118  logger.assert_always(isEqual(dpm.getLiquidVolume(), initialLiquidVolume, 1e-14),
119  "Liquid Volume not conserved (%!=%)", dpm.getLiquidVolume(), initialLiquidVolume);
120 
121 
122 
123  return 0;
124 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
bool isEqual(const std::vector< DistributionElements > &l, const std::vector< DistributionElements > &r)
Definition: PSDConversionUnitTest.cpp:30
float * p
Definition: Tutorial_Map_using.cpp:9
Scalar * b
Definition: benchVecAdd.cpp:17
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:360
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:642
Definition: BaseParticle.h:33
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1241
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1109
void setRestarted(bool newRestartedFlag)
Allows to set the flag stating if the simulation is to be restarted or not.
Definition: DPMBase.cc:1492
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1458
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1073
Mdouble getTimeMax() const
Returns the maximum simulation duration.
Definition: DPMBase.cc:879
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
EIGEN_DEVICE_FUNC const GlobalUnaryPowReturnType< Derived, ScalarExponent > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
Definition: GlobalFunctions.h:137
Definition: LiquidFilmParticle.h:15
Definition: LiquidMigrationPeriodicBoundaryUnitTest.cpp:11
Mdouble getLiquidVolume() const
Definition: LiquidMigrationPeriodicBoundaryUnitTest.cpp:35
void printTime() const override
Displays the current simulation time and the maximum simulation duration.
Definition: LiquidMigrationPeriodicBoundaryUnitTest.cpp:39
Defines a pair of periodic walls. Inherits from BaseBoundary.
Definition: PeriodicBoundary.h:20
Contains material and contact force properties.
Definition: Species.h:14
RealScalar s
Definition: level1_cplx_impl.h:130
#define INFO(i)
Definition: mumps_solver.h:54
const Mdouble pi
Definition: ExtendedMath.h:23

References b, DPMBase::boundaryHandler, BaseHandler< T >::copyAndAddObject(), e(), BaseHandler< T >::getLastObject(), LiquidMigrationPeriodicBoundaryInteraction::getLiquidVolume(), BaseHandler< T >::getObject(), DPMBase::getTimeMax(), DPMBase::getTimeStep(), INFO, isEqual(), logger, p, DPMBase::particleHandler, constants::pi, Eigen::ArrayBase< Derived >::pow(), LiquidMigrationPeriodicBoundaryInteraction::printTime(), s, DPMBase::setGravity(), DPMBase::setMax(), DPMBase::setMin(), DPMBase::setName(), DPMBase::setRestarted(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::solve(), and DPMBase::speciesHandler.