Hello everyone,
I am currently working with the pair_style granular/hertz contact model in LAMMPS, and I would like to implement a feature where the contact stiffness (Young’s modulus) changes based on the overlap between particles.
The idea is to use a “soft contact” behavior (i.e., low E values) when the overlap is below a certain threshold, and then switch to a “hard contact” (high E values) once the overlap exceeds this threshold, I wish to simulate a case of hard particle coated by soft coating.
Here’s the setup I am working with:
Initial phase: The overlap is small, and I want to apply a softer contact stiffness (like a thin film).
After the threshold: Once the overlap exceeds a predefined threshold, I would like to switch to the standard Hertzian contact stiffness (higher stiffness).
I’ve tried using pair_style granular/hertz, but I am unsure how to dynamically adjust the stiffness once the overlap crosses the threshold. Is there a way to control this behavior within the pair_style granular/hertz model?
or is there any method or command could be suitable ?
Thank you in advance for any help or advice!
Best regards,
deyun
Hi @Tom_lammps,
Not as far as I know but in such use case and context, the best is maybe to modify the pair_style according to your needs. This shouldn’t be that hard if there is only a distance criterion in your case. But you might see physical problems when transitioning from one region to the other in your model. This is up to you to check and verify that it is sound to do.
There is not, but that would be a very easy submodel to add to pair granular. See this doc page for some info on how to do it:
https://docs.lammps.org/Modify_gran_sub_mod.html
In fact, the example case is a piecewise hookean interaction. Should be easy to modify to Hertz.
3 Likes
Thanks for your share for this message, I will try to modify the source code by myself
Thanks for your reponse, I will try to learn how to modify the source code
Hi jtclemm
Many thanks for your response, this method seems excellent for my reserach topic and i have tried this 3.16. Granular Sub-Model styles of Hookean.
i have added two files of gran_sub_mod_custom.h and gran_sub_mod_custom.cpp into the src files.
then i have tried to use make yes-granular and make mpi to compile, it works but when i tried this modified code, i always got the error
“pair_style granular
#pair_coeff * * hertz/material 7e7 1.0 0.5 tangential mindlin_rescale/force NULL 1.0 1.0
pair_coeff * * hooke/piecewise 1000.0 5000.0 0.5 0.001 tangential mindlin_rescale/force NULL 1.0 1.0
ERROR: Illegal model type hooke/piecewise (…/granular_model.cpp:160)
Last input line: pair_coeff * * hooke/piecewise 1000.0 5000.0 0.5 0.001 tangential mindlin_rescale/force NULL 1.0 1.0”
it seems that the lammps did not capture this hooke/piecewise. i am not aware of the reason, since i have coped the code from the documentation, they should be correct.
if it is convenient for you. would you mind share any idea for any possibility for this error?
If you change the top line from:
#ifdef GranSubMod_CLASS
to
#ifdef GRAN_SUB_MOD_CLASS
does it work?
It looks like there was a bad instance of find+replace or something… I’ll submit a change to fix it. Thanks for spotting & reporting the issue!
Many thanks for your reponse, its helpful. i have tried change the top line from:
#ifdef GranSubMod_CLASS
to
#ifdef GRAN_SUB_MOD_CLASS
However, it seems that there is a wired thing.
i can change the top line from #ifdef GranSubMod_CLASS
to #ifdef GRAN_SUB_MOD_CLASS
then i tried to compile the lammps.
Once i used the “make yes-granular”, surprised that i can identified that
the #ifdef GRAN_SUB_MOD_CLASS
has been automatically changed to
“#ifdef GranSubMod_CLASS”.
therefore, i still get the error
“ERROR: Illegal model type hooke/piecewise (…/granular_model.cpp:160)”
my apologies for bothering you, is there anything i should improve to fix this problem?
many thanks for your time and help.
hope you have a nice day
best regards
did you change the version of the header file in the src folder or in the src/GRANULAR folder?
Thanks! It’d probably take me a few weeks to get around to it.
i changed the version of the header file in the src folder.
i also put both gran_sub_mod_custom.h and gran_sub_mod_custom.cpp in the src folder, should them in the src/GRANULAR folder?
many thanks for your help and response
HI, jtclemm
for these gran_sub_mod_custom.h and gran_sub_mod_custom.cpp, should them in the src or in the GRANULAR/src?
Then the make yes-granular
command will overwrite them with the versions in the GRANULAR folder. So you need to change those.
As Axel said, you want to modify files in src/GRANULAR. Then when you build the package (assuming you aren’t using cmake), it’ll then copy the files from src/GRANULAR into src/.
Sounds like you may have alternatively modified the files in src/ and the changes got overwritten when the files in src/GRANULAR were copied over them.
Hi akohlemy
many thanks for your explaination, I can this point and i have changed this in the src /GRANULAR. it looks fine. many thanks for your time and help
Hi jtclemm
Many thanks for your explaination and reponse, it is really helpful.
it seems that i have successfully complies,
but it seems that i meet new issue for the verification.
i have tried to verify this gran_sub_mod_custom.h and gran_sub_mod_custom.cpp.
therefore i give two wall, which tries to compress one single particle. but it seems that i cannot see this two piecewise stiffness behaviour.
pd3_force.txt (1.3 MB)
oneclump12.data (1.1 KB)
oneparticle_HM.in (3.5 KB)
please attached the input script for your reference.
i have tried to ask chatgpt why it happens, it said that the modified the pair conact model can only be effective between particles, and will expire when referring to presence of walls. Does this make sense?
hope you have a nice day
If your wall style is hertz/material, you’ll only have hertzian wall-particle forces. You’d need to change the fixes to hooke/piecewise to have any effect in your one particle system.