Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Particle-particle interactions (wrong answer by the software)

Please login with a confirmed email address before reporting spam

Hello,

To shorten the problem, I am giving an example.
I am trying to use the position of particles in the vicinity of an individual particle to define the applied forces on that particle. In this problem, forces on each particle depends on the position of two previous particles. Initial release position of the particles are x=[-.25 0 .25], y=[0 0 -.25] [m]
I will calculate the force only for the third particle. For a total of 3 particles, in the component variables I define:

idx=dest(fpt.pidx)
coef1= (idx==3&&fpt.pidx==2)
coef2= (idx==3&&fpt.pidx==1)
nx1=(dest(qx)-qx)*coef1
nx2=(dest(qx)-qx)*coef2
nx3=nx2-nx1

To probe nx1*nx3, I simply used a user defined force in the particle-particle interactions as Fx= nx1*nx3 and Fy=0
The result at t=0 shows Fx= [0 0 -0.0625] for three particles, which is incorrect, +0.0625 is the correct answer.
I know the units are not match, but it is just to see if variables are working fine, because I still don't know how to probe these variables in output after a number of times that I tried.

I found out that everything under variables will not be calculated separately, and that's the reason behind it (coef1*coef2=0 because of no overlap).
my question is how to store a variable for each particle ( for example for the 1st previous particle and the second one separately) so that when I multiply those two variables only the value would multiply not the conditional statements inside each variable.

Thank you

0 Replies Last Post 9 set 2016, 20:42 GMT-4
COMSOL Moderator

Hello Saman Monjezi

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.