Is there a way to assign different normalK to particles?

Asked by Feng Chen

Hi, All:

I just want to ask a simple question: is there a way that I can assign different normalKs to two group of particles according to particle tag via Python script easily? Or I have to code the ElasticInteraction instead?

Thanks for any comments!

Feng

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:

This question was reopened

Revision history for this message
Dion Weatherley (d-weatherley) said :
#1

Hi Feng,

I think LsmMpi.createInteractionGroupTagged(..) should work. API docs here:
http://esys.esscc.uq.edu.au/esys-particle_python_doc/snapshot/pythonapi/html/esys.lsm.LsmPy.LsmMpi-class.html#createInteractionGroupTagged

Cheers,

Dion

Revision history for this message
Feng Chen (fchen3-gmail) said :
#2

Hi, Dion:

Thanks for you prompt reply, however I spent a few days looking at this function and it seems to me a little confused, if I have more than two normalK groups (e.g. 5 normalKs to assign to 5 groups of particles), how should I use this function parameters?

And it seems also relates to different wall interactions?

Thanks!

Feng

Revision history for this message
Dion Weatherley (d-weatherley) said :
#3

Hi Feng,

Let's start simple, with 2 groups of particles. You will need up to 3 calls to createInteractionGroupTagged(..):
1) for defining interactions between particles of tag=1
2) for defining interactions between particles of tag=2
3) for defining interactions between particles of tag=1 and tag=2 (i.e. particles with differing tags)

If you are using bonded interactions between particles of the same tag and unbonded interactions between different groups then the third call is replaced by the appropriate unbonded interactions via the usual createInteractionGroup(..) with the addition of two createExclusion(..) calls.

The syntax for call number 1 above would be, for example:
sim.createInteractionGroupTagged(
   prms = NRotElasticPrms ( name = "elastic1", normalK = normalK1 ),
   tag1 = 1,
   mask1 = -1,
   tag2 = 1,
   mask2 = -1
)

When you extend to 5 groups of particles, it should be possible to use the tag masks to avoid needing 20 calls to createInteractionGroupTagged(..)

I'm not sure I understand your question regarding relating to wall interactions. This function cannot be used for wall interaction groups, only particle-particle interactions.

I hope this helps.

Cheers,

Dion

Revision history for this message
Feng Chen (fchen3-gmail) said :
#4

Thank you Dion, I will try your solution and keep you updated about my findings!

Feng

Revision history for this message
Feng Chen (fchen3-gmail) said :
#5

Hi, Dion:

It is not very clear to me how to combine the tag and mask to avoid redundant calls to createInteractionGroupTagged(...)?

From previous posts I guess we are using some kind of bit operation (XOR?AND?OR?) for tags (like http://en.wikipedia.org/wiki/Mask_(computing)), and when using mask=-1 (in binary all 1s), the exact tag values are used?

However how to use the tag and mask together, in case when mask!=-1?

Thank you!

Feng

Revision history for this message
Feng Chen (fchen3-gmail) said :
#6

Since there is no counterpart of this function about the wall-particle interactions, if we have 5 groups of particles with 5 different normalKs, how can we achieve a similar thing if we want to assign different wall-particle interactions?

Feng

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

Hi Feng,

> It is not very clear to me how to combine the tag and mask to avoid redundant calls to
> createInteractionGroupTagged(...)?
It may not always be possible to avoid making those calls. For example if you have 5 different groups of particles and each combination of particles from two of those groups results in a different interaction you may have to issue all calls (15, btw, not 20 - 5 within each particle group and 10 for particles from 2 different groups due to symmetry issues).

> However how to use the tag and mask together, in case when mask!=-1?
The check is (tag1 & mask1) == (tag2 & mask2) where "&" is a _bitwise_ "and"-operator. I.o.w. only the bits which are set to 1 in the mask are used for comparison. -> mask=-1 results in all bits being set.
An example would be tag1 = 9 (binary 1001), mask1 = 8 (1000), tag2 = 10 (1010) , mask2 = 8 -> comparison would be true (1001 & 1000)=1000 and (1010 & 1000) = 1000. If you set the masks to -1 the comparison would return "false".

A practical example, taken from one of the models used in Abe & Urai, 2011 [1]:
I've got a model with 2 particle groups initially tagged "1" and "2" but some of the particles near the boudaries have the "4" and "8" bits set in addition, resulting in particles tagged 1,2,5,6,9 and 10. The "4" and "8" bits are only used to deal with bonded wall interactions - so masks are used to ignore them in the setup of pair interaction groups:
---
mySim.createInteractionGroupTagged(dip1,2,2,2,2) # interaction within group "2"
mySim.createInteractionGroupTagged(dip2,1,1,2,2) # interaction between groups "1" and "2"
mySim.createInteractionGroupTagged(fip,1,1,1,1) # interaction within group "1"
---

-> as a result, for example two particles tagged 6 (0101) and 9 (1001) interact according to the parameters "dip2": (1001 & 0001) -> 0001 = 1, (0110 & 0010) -> 0010 = 2

> Since there is no counterpart of this function about the wall-particle interactions
For bonded wall interaction there is a mechanism - the BondedWallPrms take a tag/mask argument. For elastic wall interactions there is currently no such function. I'm not sure how much work it would be to implement it, therefore I don't know if it will be added in the near future or not.

Steffen

----
[1] Abe, S. & Urai, J.L., 2012, "Discrete element modeling of boudinage: Insights on rock rheology,
matrix flow, and evolution of geometry", J. Geophys. Res., 117, doi:10.1029/2011JB008555

Revision history for this message
Feng Chen (fchen3-gmail) said :
#8

Thanks SteffenAbe, that solved my question.