yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02952
[Branch ~yade-dev/yade/trunk] Rev 1941: Optional porosity in makeCloud, giving a value discards rMean (avoid guessing rMean when you know...
------------------------------------------------------------
revno: 1941
committer: Bruno Chareyre <bchareyre@r1arduina>
branch nick: trunk
timestamp: Tue 2010-01-05 23:36:42 +0100
message:
Optional porosity in makeCloud, giving a value discards rMean (avoid guessing rMean when you know size and number).
modified:
pkg/dem/DataClass/SpherePack.cpp
pkg/dem/DataClass/SpherePack.hpp
--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'pkg/dem/DataClass/SpherePack.cpp'
--- pkg/dem/DataClass/SpherePack.cpp 2010-01-01 15:21:30 +0000
+++ pkg/dem/DataClass/SpherePack.cpp 2010-01-05 22:36:42 +0000
@@ -78,9 +78,12 @@
if(scene->isPeriodic) { cellSize=scene->cell->getSize(); }
}
-long SpherePack::makeCloud(Vector3r mn, Vector3r mx, Real rMean, Real rRelFuzz, int num, bool periodic){
+long SpherePack::makeCloud(Vector3r mn, Vector3r mx, Real rMean, Real rRelFuzz, int num, bool periodic, Real porosity){
static boost::minstd_rand randGen(TimingInfo::getNow(/* get the number even if timing is disabled globally */ true));
static boost::variate_generator<boost::minstd_rand&, boost::uniform_real<> > rnd(randGen, boost::uniform_real<>(0,1));
+ if (porosity>0) {//cloud porosity is assigned, ignore the given value of rMean
+ Vector3r dimensions=mx-mn; Real volume=dimensions.X()*dimensions.Y()*dimensions.Z();
+ rMean=pow(volume*(1-porosity)/(Mathr::PI*(4/3.)*num),1/3.);}
const int maxTry=1000;
Vector3r size=mx-mn;
if(periodic)(cellSize=size);
=== modified file 'pkg/dem/DataClass/SpherePack.hpp'
--- pkg/dem/DataClass/SpherePack.hpp 2010-01-01 15:21:30 +0000
+++ pkg/dem/DataClass/SpherePack.hpp 2010-01-05 22:36:42 +0000
@@ -50,8 +50,8 @@
void toFile(const string file) const;
void fromSimulation();
- // random generation; if num<0, insert as many spheres as possible
- long makeCloud(Vector3r min, Vector3r max, Real rMean, Real rFuzz, int num, bool periodic=false);
+ // random generation; if num<0, insert as many spheres as possible, if porosity>0 recompute meanRadius (porosity<0.4 recommended) giving a value discards passed rMean recomputes one to try and generate "num" spheres in the box.
+ long makeCloud(Vector3r min, Vector3r max, Real rMean, Real rFuzz, int num, bool periodic=false, Real porosity=-1);
// periodic repetition
void cellRepeat(Vector3<int> count);
Follow ups