Hello guys,
I want to loop every particle at the end of every time-step,then do some calculations about the arrays, reserve the values and return the values. So if I want to achieve this, what should I do?
Best regards,
LEO
A project by DCS Computing and CFDEMresearch
This website uses cookies to ensure you get the best experience on our website. By continuing to browse the site you are agreeing to our use of cookies. This website uses cookies. By continuing to browse the site you are agreeing to our use of cookies. More info
Daniel Queteschiner | Tue, 09/15/2015 - 12:47
Depends
Your question is rather vague. It depends if you want to do this in scripts or in C++ code. If we're talking about scripts and you can access the particle data needed for your calculations then there are variables of type atom that let you access an atom property of all particles in the simulation. There are a couple of math operations you can execute in scripts as well.
If it's C++ code you should find an already existing compute or fix command that does similar things you want to achieve and study that code.
strathclyde | Tue, 09/15/2015 - 20:03
Hi Daniel,
Hi Daniel,
Thanks for your reply. I have detailed my question as follows:
Actually, I want to achieve the functions like this:
/* ---------------------------------------------------------------------- */
define ini_mstrain
va=array.create(ball.num) //define an array, ball.num is the total ball number
vb=array.create(ball.num)
vc=array.create(ball.num)
vd=array.create(ball.num)
loop local i(1,ball.num) // i is the ID of the ball
global bp = ball.find(i) //find the pointer of ball ID
density(i)=1000.0 //give the initial values
vc(i)=va(i)+vb(i)
vd(i)=density(i)*math.pi*ball.radius(bp)^2 // ball.radius(bp) is the radius of ball with pointer bp
endloop
end
/* ---------------------------------------------------------------------- */
I used the //variable va atom 0.5// to define the scalar array. But i don't understand with the Math operators or Math functions between the arrays, how the value still returns the new array with the same ball ID or that is to reserve the value to the same ball.
Best regards,
Leo
aaigner | Thu, 09/24/2015 - 16:28
Hi
Hi
I don't understand what you save in va and vb.
But your vd calculation can be done by:
variable vd atom density*r*r*PI
compute aveVd all reduce ave v_vd
variable ave equal c_aveVd
fix extra all print 1000 "Average is ${ave}"
The only problem is that the fix print command can not print a per-atom array - only reduced 'equal' variables like ave, sum, min or max.
Is that useful for you?
Cheers
Andreas
strathclyde | Sat, 09/26/2015 - 14:27
Hi Andreas,
Hi Andreas,
That help me a lot. Thank you very much.
Leo