Force component in particle body force
Hi,
I want to convert the total force of particles in the x-direction into a certain value, and add a value to the total forces in the y and z directions. So I did some changes in PBF as below:
double a=1.0;
results.force.setX(a); //set force in x direction as zero.
results.force.setY(results.force.getY()+a); //set force in y direction as +=a.
results.force.setZ(results.force.getZ()+a); //set force in z direction as +=a.
However, the results were the same for all three cases, with the particles experiencing a constant force of 'a'.
Because the functionality I want to achieve in the x-direction is "=", and the functionality I want to implement in the y and z directions is "+=".
Thanks
Answers
-
Hi Raheem,
Looks like a typo in that lines 3 and 4 should be set and get Y and Z, both currently X:
results.force.setX(results.force.getX()+a); //set force in y direction as +=a.
results.force.setX(results.force.getX()+a); //set force in z direction as +=a.
Otherwise I'd expect that to work ok,.
RegardsStephen
0 -
Stephen Cole_21117 said:
Hi Raheem,
Looks like a typo in that lines 3 and 4 should be set and get Y and Z, both currently X:
results.force.setX(results.force.getX()+a); //set force in y direction as +=a.
results.force.setX(results.force.getX()+a); //set force in z direction as +=a.
Otherwise I'd expect that to work ok,.
RegardsStephen
Sorry, I made a written mistake in the question and revised, it should be:
double a=1.0;
results.force.setX(a); //set force in x direction as zero.
results.force.setY(results.force.getX()+a); //set force in y direction as +=a.
results.force.setZ(results.force.getX()+a); //set force in z direction as +=a.
But it wasn't right. Then I debug the system line by line as below, it seems like "tmp3" wasn't assgined the value of results.force.getX(). I still can't fixed the problem.
0