Are there a faster way for stress calculation in EDEM?
Answers
-
Hi Raheem,
I understand the stress calculation is all done in post-processing which is maybe why it is slow. If you ran it as a contact model then the calculation would be done during processing, it may not be a faster calculation but should be faster to access post-processing.
There is an example here, it was created with an older version of EDEM 2019 and is built in to the Hertz Mindlin model, so could be improved with the latest version - https://community.altair.com/community?id=kb_article_view&sysparm_article=KB0113667 and would also be possible to implement in EDEMpy.
RegardsStephen
0 -
Stephen Cole_21117 said:
Hi Raheem,
I understand the stress calculation is all done in post-processing which is maybe why it is slow. If you ran it as a contact model then the calculation would be done during processing, it may not be a faster calculation but should be faster to access post-processing.
There is an example here, it was created with an older version of EDEM 2019 and is built in to the Hertz Mindlin model, so could be improved with the latest version - https://community.altair.com/community?id=kb_article_view&sysparm_article=KB0113667 and would also be possible to implement in EDEMpy.
RegardsStephen
Hi Stephen,
I have looked through the cpp file for stress calculation, if I want to calcualte the stress stensor without any contact model, how can I get the value of newF_n and newF_t in the source code?
Regard!
Raheem
0 -
Raheem Sterling_22160 said:
Hi Stephen,
I have looked through the cpp file for stress calculation, if I want to calcualte the stress stensor without any contact model, how can I get the value of newF_n and newF_t in the source code?
Regard!
Raheem
Hi Raheem,
In the newer versions of the API the forces are chained, this means that for example if you have a base contact model like Hertz-Mindlin and a second contact model such as rolling friction and a 3rd as heat conduction the forces are passed between them.This was a change from older versions where each model was individual, the forces calculated were passed back to EDEM straight away and summed by EDEM internal rather than passed down the chain and the final model in the chain returns the summed forces.
For example first hertz-Mindlin would calculate the forces and then the rolling friction model is called, one of the inputs would be the Fn calculated in the hertz model which could then be used, added to or overwritten by the rolling friction model. Following this the new Fn is passed down the chain to the heat conduction model which uses the values.
If in the heat conduction model the code had something like Fn = 0,0,0; this would completely overwrite all previous forces and the hertz contact forces calculated would be reset to 0 and not applied to the particles, so always important to make sure we use += rather than = in the chain.
Also worth noting that these forces on the particles are then passed down the chain to the Particle Body Force which could then theoretically overwrite all previously calculated contact forces.
So to answer your question you should:
- Make sure you are using the latest version of the API in EDEM 2022.2. I talk about API versions here - https://youtu.be/Bweffts_4qM
- Set the model type if a contact model (base, optional, rolling friction) and also the chain position (you would likely want eAfterBasePos or eFinalPos ) for example from the bonded model:
NApi::EPluginModelType CBonded::getModelType() { return EPluginModelType::eOptional; } NApi::EPluginExecutionChainPosition CBonded::getExecutionChainPosition() { return EPluginExecutionChainPosition::eAfterBasePos; }
- You can then use the contact results to get (or set) previously calculated forces from models above in the chain, forces that are passed down are:
struct SContactResult { NApiHelpersV3_4_0::CSimple3DVector normalForce; /**< Normal force on element 1. From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_4_0::CSimple3DVector usNormalForce; /**< The unsymmetrical normal forces on element 1. This represent the portion of the calculated normal force that causes energy loss / gain (eg damping). */ NApiHelpersV3_4_0::CSimple3DVector tangentialForce; /**< Tangential force on element 1 From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_4_0::CSimple3DVector usTangentialForce; /**< The unsymmetrical tangential forces on element 1. This represent the portion of calculatedTangentialForce that causes energy loss / gain (eg damping). */ NApiHelpersV3_4_0::CSimple3DVector additionalTorque1; /**< Any additional torque on element 1 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_4_0::CSimple3DVector usAdditionalTorque1; /**< Any unsymmetrical, additional torque on element 1 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ NApiHelpersV3_4_0::CSimple3DVector additionalTorque2; /**< Any additional torque on element 2 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_4_0::CSimple3DVector usAdditionalTorque2; /**< Any unsymmetrical, additional torque on element 2 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ };
- And in the code you can then get or modify the force values:
contactResults.normalForce += my_force_vector; //or CSimple3DVector my_force_vector = contactResults.normalForce;
0 -
Stephen Cole_21117 said:
Hi Raheem,
In the newer versions of the API the forces are chained, this means that for example if you have a base contact model like Hertz-Mindlin and a second contact model such as rolling friction and a 3rd as heat conduction the forces are passed between them.This was a change from older versions where each model was individual, the forces calculated were passed back to EDEM straight away and summed by EDEM internal rather than passed down the chain and the final model in the chain returns the summed forces.
For example first hertz-Mindlin would calculate the forces and then the rolling friction model is called, one of the inputs would be the Fn calculated in the hertz model which could then be used, added to or overwritten by the rolling friction model. Following this the new Fn is passed down the chain to the heat conduction model which uses the values.
If in the heat conduction model the code had something like Fn = 0,0,0; this would completely overwrite all previous forces and the hertz contact forces calculated would be reset to 0 and not applied to the particles, so always important to make sure we use += rather than = in the chain.
Also worth noting that these forces on the particles are then passed down the chain to the Particle Body Force which could then theoretically overwrite all previously calculated contact forces.
So to answer your question you should:
- Make sure you are using the latest version of the API in EDEM 2022.2. I talk about API versions here - https://youtu.be/Bweffts_4qM
- Set the model type if a contact model (base, optional, rolling friction) and also the chain position (you would likely want eAfterBasePos or eFinalPos ) for example from the bonded model:
NApi::EPluginModelType CBonded::getModelType() { return EPluginModelType::eOptional; } NApi::EPluginExecutionChainPosition CBonded::getExecutionChainPosition() { return EPluginExecutionChainPosition::eAfterBasePos; }
- You can then use the contact results to get (or set) previously calculated forces from models above in the chain, forces that are passed down are:
struct SContactResult { NApiHelpersV3_4_0::CSimple3DVector normalForce; /**< Normal force on element 1. From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_4_0::CSimple3DVector usNormalForce; /**< The unsymmetrical normal forces on element 1. This represent the portion of the calculated normal force that causes energy loss / gain (eg damping). */ NApiHelpersV3_4_0::CSimple3DVector tangentialForce; /**< Tangential force on element 1 From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_4_0::CSimple3DVector usTangentialForce; /**< The unsymmetrical tangential forces on element 1. This represent the portion of calculatedTangentialForce that causes energy loss / gain (eg damping). */ NApiHelpersV3_4_0::CSimple3DVector additionalTorque1; /**< Any additional torque on element 1 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_4_0::CSimple3DVector usAdditionalTorque1; /**< Any unsymmetrical, additional torque on element 1 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ NApiHelpersV3_4_0::CSimple3DVector additionalTorque2; /**< Any additional torque on element 2 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_4_0::CSimple3DVector usAdditionalTorque2; /**< Any unsymmetrical, additional torque on element 2 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ };
- And in the code you can then get or modify the force values:
contactResults.normalForce += my_force_vector; //or CSimple3DVector my_force_vector = contactResults.normalForce;
Hi Stephen,
Thanks for you patience, I can understand what you mean about. Now I always use the version of EDEM 2021 and API in EDEM 2021, will this force chain worked in EDEM 2021 if I complied with API EDEM 2022? And I also saw the code in EDEM 2021 API as below, I think it also works in EDEM 2021?
struct SContactResult { NApiHelpersV3_0_0::CSimple3DVector normalForce; /**< Normal force on element 1. From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_0_0::CSimple3DVector usNormalForce; /**< The unsymmetrical normal forces on element 1. This represent the portion of the calculated normal force that causes energy loss / gain (eg damping). */ NApiHelpersV3_0_0::CSimple3DVector tangentialForce; /**< Tangential force on element 1 From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_0_0::CSimple3DVector usTangentialForce; /**< The unsymmetrical tangential forces on element 1. This represent the portion of calculatedTangentialForce that causes energy loss / gain (eg damping). */ NApiHelpersV3_0_0::CSimple3DVector additionalTorque1; /**< Any additional torque on element 1 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_0_0::CSimple3DVector usAdditionalTorque1; /**< Any unsymmetrical, additional torque on element 1 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ NApiHelpersV3_0_0::CSimple3DVector additionalTorque2; /**< Any additional torque on element 2 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_0_0::CSimple3DVector usAdditionalTorque2; /**< Any unsymmetrical, additional torque on element 2 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ };
Regards!
Raheem
0 -
Raheem Sterling_22160 said:
Hi Stephen,
Thanks for you patience, I can understand what you mean about. Now I always use the version of EDEM 2021 and API in EDEM 2021, will this force chain worked in EDEM 2021 if I complied with API EDEM 2022? And I also saw the code in EDEM 2021 API as below, I think it also works in EDEM 2021?
struct SContactResult { NApiHelpersV3_0_0::CSimple3DVector normalForce; /**< Normal force on element 1. From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_0_0::CSimple3DVector usNormalForce; /**< The unsymmetrical normal forces on element 1. This represent the portion of the calculated normal force that causes energy loss / gain (eg damping). */ NApiHelpersV3_0_0::CSimple3DVector tangentialForce; /**< Tangential force on element 1 From Newton III the normal force on element 2 is equal and opposite. */ NApiHelpersV3_0_0::CSimple3DVector usTangentialForce; /**< The unsymmetrical tangential forces on element 1. This represent the portion of calculatedTangentialForce that causes energy loss / gain (eg damping). */ NApiHelpersV3_0_0::CSimple3DVector additionalTorque1; /**< Any additional torque on element 1 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_0_0::CSimple3DVector usAdditionalTorque1; /**< Any unsymmetrical, additional torque on element 1 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ NApiHelpersV3_0_0::CSimple3DVector additionalTorque2; /**< Any additional torque on element 2 not accounted for by the above forces (which are deemed to act at the contact point). These can be useful, for example, in a consideration rolling friction. */ NApiHelpersV3_0_0::CSimple3DVector usAdditionalTorque2; /**< Any unsymmetrical, additional torque on element 2 not accounted for by the above forces. These represent the component of the additional torque that causes energy loss / gain (eg damping). */ };
Regards!
Raheem
Hi Raheem,
EDEM 2021.0 supports contact model and particle body force API version up to 3.2 and EDEM 2021.2 supports version 3.3.
The latest is version 3.5 in 2022.2.
I would generally recommend you use the latest API version in 2022.2 however if you do use an older version with chaining it should be EDEM 2021.2 with API 3.2 or later. It doesn't make a difference if you compile using API 3.2 from EDEM 2022.2 or 2021.2 as they are the same files.
RegardsStephen
0