Custom API normal/tangential forces

Santiago Garrido
Santiago Garrido Altair Community Member
edited November 2022 in Community Q&A

Hi, 

I'm interested in extracting the damping components of the normal and tangential forces from the Hertz-Mindilin contact model.

For this, I'm using a custom API that simply extracts the so-called usNormalForce and usTangentialForce from the NCalcForceTypesV3_0_0 header. 

My current simulation setup is simple, I only have a ball that falls down with an angle to a plate geometry. In other words, a simple bounce with an angle. 

Upon extracting the values via the API, I'm getting some values that I'm finding very hard to understand. Thus, I decided to simply extract the normalForce and tangentialForce vectors from the same header and I'm noticing that I'm getting different results to those that EDEM normally returns when visualizing the contact normal and tangential forces. In other words, the "classic" normal force that one can extract in any simulation is not the same as the one I'm extracting via the API (by a huge amount).

 

This is not making any sense to me. I've been trying to see if I can find any problem in my code, but even so, ultimately I'm simply extracting these two vectors. The custom variable is defined as 

double force_normal = contactResults.normalForce.length();

 

The difference in values between the API-value and the classic value is staggering. The classic value everyone can extract gives me a reasonable value of say, 40 [N], whereas the custom value extracted from the API is giving me a value of 12,000 [N]. Naturally, this is nonsense and I can't figure out what it is that is making the aforementioned variable return such values. 

Is there anyone that can support me/guide me with this? 

 

Thanks in advance. 

 

 

Tagged:

Answers

  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited November 2022

    Hi Santiago,

     

    EDEM calculates normalForce and usNormalForce.  Normal force typically is the Fn + Fnd, the calculated force and the damping component and usNormalForce is just Fnd, the damping component (same convention for tangential).

     

    normalForce is used to calculate the motion of the material where you see impact of energy loss/restitution value.  In the Analyst when you query normal Force this will be normalForce - usNormalForce which is just the undamped component of the force which is the 'true' force acting on the particles.

     

    I'm not sure on the calculations in your code but is your discrepancy related to that you are just calculating the contact force magnitude? If you have +ve Z and -ve Z force it should balance out but if calculating magnitude they would sum.


    Regards

    Stephen

  • Santiago Garrido
    Santiago Garrido Altair Community Member
    edited November 2022

    Hi Santiago,

     

    EDEM calculates normalForce and usNormalForce.  Normal force typically is the Fn + Fnd, the calculated force and the damping component and usNormalForce is just Fnd, the damping component (same convention for tangential).

     

    normalForce is used to calculate the motion of the material where you see impact of energy loss/restitution value.  In the Analyst when you query normal Force this will be normalForce - usNormalForce which is just the undamped component of the force which is the 'true' force acting on the particles.

     

    I'm not sure on the calculations in your code but is your discrepancy related to that you are just calculating the contact force magnitude? If you have +ve Z and -ve Z force it should balance out but if calculating magnitude they would sum.


    Regards

    Stephen

    Hi Stephen,

     

    Thanks for the reply and the explanation.

     

    I made the mistake of focusing on the normal energy instead of the tangential energy in my original post. Let me elaborate further:

     

    The Hertz-Mindilin model has a "limiting" factor to the tangential force whenever a so-called "friction Law" is not met. This is also implemented in EDEM. I've been toying around with this because as I mentioned in my original post, my intention is to extract damping forces. You can imagine I was surprised when I realized that by giving the simulation a restitution coefficient of 1, I was still getting a value for the tangential damping. If one looks at the definition of both tangential/normal damping, it is possible to see that with a restitution coefficient of 1, these values should be both zero. 

    To try to understand what EDEM was doing when this law was not being fulfilled I went here: https://community.altair.com/community?id=kb_article_view&sys_kb_id=547922511b1620d0c4dfdbd9dc4bcb09

    This is an API version of the Hertz-Mindilin contact code. One can see that the code when the law is not met, the code ultimately sets F_d = F_t. Ultimately this means that when the law is not met, a certain value is given to damping, which explains why the values are not zero when having a restitution coefficient of 1. 

    However, this is where my headache begins. Unless I'm reading the code incorrectly, both the tangentialForce and usTangentialForce (under the aforementioned conditions) should be equal. Let's say they are not because of something I'm missing. I still can't make sense of the values:

    To give you concrete numbers based on my example:

    The tangential force in the Analyst gives me a value of 43.7 [N]. This coincides with the value I have for Normal force in the analyst since I gave the simulation a static friction coefficient of 1. This means that the friction law was originally not met, and therefore the tangential value had to be "hard coded" to meet the condition. Since the friction coefficient is 1, the values are equalized. 

    Now, for the exact same scenario, if I extract the tangentialForce.length() and the usTangentialForce.length(), I get values of 7209.5 [N] and 1754.3 [N] respectively. And these are the values I can't understand. Even if I were to subtract them, it's still far away from the value the analyst gives. 

    I also considered at some point that extracting the magnitude could perhaps be the problem, however, I don't think this has anything to do. I made it so that the model essentially behaves in a 2d and got rid of gravity. 

     

    I think this explains the problem better and I hope I'm clear enough. I really hope you can help me with this because I can't figure it out. 

     

  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited November 2022

    Hi Stephen,

     

    Thanks for the reply and the explanation.

     

    I made the mistake of focusing on the normal energy instead of the tangential energy in my original post. Let me elaborate further:

     

    The Hertz-Mindilin model has a "limiting" factor to the tangential force whenever a so-called "friction Law" is not met. This is also implemented in EDEM. I've been toying around with this because as I mentioned in my original post, my intention is to extract damping forces. You can imagine I was surprised when I realized that by giving the simulation a restitution coefficient of 1, I was still getting a value for the tangential damping. If one looks at the definition of both tangential/normal damping, it is possible to see that with a restitution coefficient of 1, these values should be both zero. 

    To try to understand what EDEM was doing when this law was not being fulfilled I went here: https://community.altair.com/community?id=kb_article_view&sys_kb_id=547922511b1620d0c4dfdbd9dc4bcb09

    This is an API version of the Hertz-Mindilin contact code. One can see that the code when the law is not met, the code ultimately sets F_d = F_t. Ultimately this means that when the law is not met, a certain value is given to damping, which explains why the values are not zero when having a restitution coefficient of 1. 

    However, this is where my headache begins. Unless I'm reading the code incorrectly, both the tangentialForce and usTangentialForce (under the aforementioned conditions) should be equal. Let's say they are not because of something I'm missing. I still can't make sense of the values:

    To give you concrete numbers based on my example:

    The tangential force in the Analyst gives me a value of 43.7 [N]. This coincides with the value I have for Normal force in the analyst since I gave the simulation a static friction coefficient of 1. This means that the friction law was originally not met, and therefore the tangential value had to be "hard coded" to meet the condition. Since the friction coefficient is 1, the values are equalized. 

    Now, for the exact same scenario, if I extract the tangentialForce.length() and the usTangentialForce.length(), I get values of 7209.5 [N] and 1754.3 [N] respectively. And these are the values I can't understand. Even if I were to subtract them, it's still far away from the value the analyst gives. 

    I also considered at some point that extracting the magnitude could perhaps be the problem, however, I don't think this has anything to do. I made it so that the model essentially behaves in a 2d and got rid of gravity. 

     

    I think this explains the problem better and I hope I'm clear enough. I really hope you can help me with this because I can't figure it out. 

     

    Hi Santiago,

     

    It's difficult to comment on the specific values although just a comment that they do seem quite high.  If you have a multi-particle test case I'd recommend staring with single particle single contact which always makes the analysis easier as multi -particle systems get complex quickly.

     

    Have you tried debugging and stepping through the code? There is a guide on debugging here - https://community.altair.com/csm?id=kb_article_view&sysparm_article=KB0115860

    Regards

    Stephen

     

  • Santiago Garrido
    Santiago Garrido Altair Community Member
    edited November 2022

    Hi Santiago,

     

    It's difficult to comment on the specific values although just a comment that they do seem quite high.  If you have a multi-particle test case I'd recommend staring with single particle single contact which always makes the analysis easier as multi -particle systems get complex quickly.

     

    Have you tried debugging and stepping through the code? There is a guide on debugging here - https://community.altair.com/csm?id=kb_article_view&sysparm_article=KB0115860

    Regards

    Stephen

     

    Hi Stephen,

     

    Thanks again for the reply. I will make sure to use the debugging guide. I just have one additional question that I'm hoping you can clarify for me. 

     

    When this friction law is not met, and therefore the analyst's tangential force needs to be modified, how is damping defined? 

  • Come_Duret
    Come_Duret
    Altair Employee
    edited November 2022

    Hi Santiago,

    Stephen told me about your question here following up our mail exchange. My last mail to you was rejected for some reason and I am sorry I didn't notice it, as it makes it look like I ignored your last questions which was not at all in my intention. 

    Concerning the discrepancies of values you mentioned, as Stephen pointed out they seem so high that I feel they are likely not corresponding to the tangential forces you are trying to extract. Could you explain in more details how you obtained the values you got and which model you are using for this purpose ? (for example, are you outputting them in the console with a printf ?)

    The problem could be linked to printing the value with the incorrect type (leading to an incorrect interpretation of the bits chain).

     

    For your additional question, when the friction law is not met, the tangential force that can be seen in the Analyst is going to be tangentialForce - usTangentialForce. The damping component is defined as described in the documentation as : 
    image

    Beta being the damping ratio. If the coefficient of restitution is 1, beta will be 0 and then no damping will occur.

     

    Just as an additional note, this is how I interpret what happens with the 2 cases for the law of friction :

    - When the tangential force is inferior to the Coulomb Friction (μsFn), the tangential force is linked to the particles tangential deformation. Damping happens too which dissipates some of the energy depending on the coefficient of restitution.

    - When the tangential force is greater than the Coulomb Friction, it gets limited by it. Then, the particles are slipping and do not undergo tangential deformation anymore. The tangential force accounts only for pure surface friction, and that's why it's also considered as damping. In that case the value for tangential force in the Analyst should always be 0.

    Best regards,
    Come

  • Santiago Garrido
    Santiago Garrido Altair Community Member
    edited November 2022

    Hi Santiago,

    Stephen told me about your question here following up our mail exchange. My last mail to you was rejected for some reason and I am sorry I didn't notice it, as it makes it look like I ignored your last questions which was not at all in my intention. 

    Concerning the discrepancies of values you mentioned, as Stephen pointed out they seem so high that I feel they are likely not corresponding to the tangential forces you are trying to extract. Could you explain in more details how you obtained the values you got and which model you are using for this purpose ? (for example, are you outputting them in the console with a printf ?)

    The problem could be linked to printing the value with the incorrect type (leading to an incorrect interpretation of the bits chain).

     

    For your additional question, when the friction law is not met, the tangential force that can be seen in the Analyst is going to be tangentialForce - usTangentialForce. The damping component is defined as described in the documentation as : 
    image

    Beta being the damping ratio. If the coefficient of restitution is 1, beta will be 0 and then no damping will occur.

     

    Just as an additional note, this is how I interpret what happens with the 2 cases for the law of friction :

    - When the tangential force is inferior to the Coulomb Friction (μsFn), the tangential force is linked to the particles tangential deformation. Damping happens too which dissipates some of the energy depending on the coefficient of restitution.

    - When the tangential force is greater than the Coulomb Friction, it gets limited by it. Then, the particles are slipping and do not undergo tangential deformation anymore. The tangential force accounts only for pure surface friction, and that's why it's also considered as damping. In that case the value for tangential force in the Analyst should always be 0.

    Best regards,
    Come

    Hi Come,

     

    Thanks for the reply and no worries. I'm going to reply to you via email so I can share my files with you so that it's easier to take a look.