Force component in particle body force

User: "Raheem Sterling_22160"
Altair Community Member
Updated by Raheem Sterling_22160

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

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "Stephen Cole"
    Altair Employee
    Updated by Stephen Cole

    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,.


    Regards

    Stephen

     

    User: "Raheem Sterling_22160"
    Altair Community Member
    OP
    Updated by Raheem Sterling_22160

    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,.


    Regards

    Stephen

     

    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.

    image

    image