ds.norm()>1.0e-8

Asked by Shen Weigang

Dear ESyS-Particle developers and users:
I have a question about the model(RotFricInteraction.cpp).
In this model, there is a sentence to calculate the friction energy:
                    if (ds.norm() > 1.0e-8)
    {
   m_Ffric= mu_d*force.norm() *ds/ds.norm();
   m_force_deficit = Vec3(0.0,0.0,0.0);
   //m_E_diss = fabs(m_Ffric * ds); // energy dissipated
   m_E_diss = fabs(m_Ffric * ds); // energy dissipated
    }
Why is the "1.0e-8" choosed?
Thanks a lot for your help!
Shen

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
SteffenAbe
Solved:
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Shen Weigang (wgshen) said :
#2

Dear ESyS-Particle developers and users:
I have a question about the model(RotFricInteraction.cpp).
In this model, there is a sentence to calculate the friction energy:
                    if (ds.norm() > 1.0e-8)
    {
   m_Ffric= mu_d*force.norm() *ds/ds.norm();
   m_force_deficit = Vec3(0.0,0.0,0.0);
   //m_E_diss = fabs(m_Ffric * ds); // energy dissipated
   m_E_diss = fabs(m_Ffric * ds); // energy dissipated
    }
Why is the "1.0e-8" choosed?
Thanks a lot for your help!
Shen

Revision history for this message
Best SteffenAbe (s-abe) said :
#3

The purpose of the "if" statement in the code is to check if the magnitude of the vector ds is zero or not. Due to the finite precision of the calculations a comparison with a small non-zero value was chosen instead of ds.norm()>0 in order to avoid numerical problems .

Steffen

Revision history for this message
Shen Weigang (wgshen) said :
#4

Thanks SteffenAbe, that solved my question.