Question #178830 on Yade changed:
https://answers.launchpad.net/yade/+question/178830
tranviet proposed the following answer:
Hello wangxiaoliang,
I think we can build a new script for this. I have a file to generate
the packing with a given grain size distribution and a target porosity
but it was written in C++ (I did not use python at the time of one year
ago):
- First,you create a sphere with radius satisfy:
Real SphereGenerator::GenerateRadius(vector<Real>& sieveDimension,
vector<Real>& percentPassed)
{
typedef boost::random::lagged_fibonacci_01<Real, 48, 44497, 21034>
lagged_fibonaccitemp;
static lagged_fibonaccitemp rng;
static boost::uniform_real<> one_hundred(0.0,100.0);
static boost::variate_generator<lagged_fibonaccitemp,
boost::uniform_real<> > random1(rng, one_hundred);
Real random=random1();
//cerr<<random<<" ";
int i;//,numberOfSieves=11;
for (i=0;i!=numberOfSieves;++i)
{
if ((percentPassed[i]<random) && (percentPassed[i+1]>=random))
{
return (sieveDimension[i] + (random -
percentPassed[i])*(sieveDimension[i+1]-sieveDimension[i])/(percentPassed[i+1]-percentPassed[i]))/2;///Fu,
2003;
}
}
}
- Create spheres using this function until you get your target porosity,
calculated by:
Real CommonFunction::Porosity (MetaBody * ncb, Real& height, Real&
BoxDimensionX, Real& BoxDimensionZ)
{
//
Real SphereVolume=0, radius=0;
shared_ptr<BodyContainer>& bodies = ncb->bodies;
BodyContainer::iterator bi = bodies->begin();
BodyContainer::iterator biEnd = bodies->end();
for( ; bi!=biEnd ; ++bi )
{
if((*bi)->isDynamic)
{
Sphere* sphere =
YADE_CAST<Sphere*>((*bi)->geometricalModel.get());
radius = sphere->radius;
SphereVolume += 4.0/3.0*Mathr::PI*radius*radius*radius;
}
}
return (1-SphereVolume/(height*BoxDimensionX*BoxDimensionZ));
}
- You can place your generated spheres using any of the proposed methods
that are available in YADE.
Let me know if it can help you.
Cheers,
Viet
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.
_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp