Update interaction and material parameters during the simlulation process
Hi all,
I want to change the interaciton and material parameters during the simulation process through the following functions. However, the analysis results before and after the changes of the parameters.
Here is the function:
O.materials.
def Par_Change():
Fos=2.0
# here we modify the material and interaction physics
for b in O.bodies:
for i in O.interactions:
Anyone can help me? Thanks a lot.
Henry
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Henry
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Hi Henry,
> I want to change the interaciton and material parameters during the
> simulation process through the following functions. However, the analysis
> results before and after the changes of the parameters.
>
I miss something in the last sentence.. perhaps "... the analysis results
do not differ before and after"?
please also provide complete minimal working example. Do you call
Par_Change somewhere? I tried it, resulting in
AttributeError: 'FrictPhys' object has no attribute 'frictionAngle'
cheers
Jan
Revision history for this message
|
#2 |
Sorry, the error is of course because I have wrong IPhys functor.. So do
not pay any attantion to my last comment, but the working script would be
useful :-)
cheers
Jan
2014-03-10 15:39 GMT+01:00 Jan Stránský <email address hidden>:
> Hi Henry,
>
>
>
>> I want to change the interaciton and material parameters during the
>> simulation process through the following functions. However, the analysis
>> results before and after the changes of the parameters.
>>
>
> I miss something in the last sentence.. perhaps "... the analysis results
> do not differ before and after"?
>
> please also provide complete minimal working example. Do you call
> Par_Change somewhere? I tried it, resulting in
> AttributeError: 'FrictPhys' object has no attribute 'frictionAngle'
>
> cheers
> Jan
>
Revision history for this message
|
#3 |
Thanks to Jan.
Follows is a part of my script. I want to change the material paramteres during the simulation. But I found there is no change whether use the function of 'Par_Change() or not .
The script:
SoilMat=
#def sphereMat(): return JCFpmMat(
O.bodies.
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
useIncrement
always_
label=
),
GlobalStiffnes
PyRunner(
NewtonIntegrat
]
def Par_Change():
global Fos_Step,
global Fos,D_step
if O.iter>Fos_Step:# and utils.unbalance
# here we modify the material and interaction physics
for b in O.bodies:
if b.material.id==0:
for i in O.interactions:
if O.bodies[
else:
Thanks a lot!
Henry
Revision history for this message
|
#4 |
Hi Henry,
IPyhys of your interactions are of type CohFrictPhys, as defined in
O.engines. However, CohFrictPhys does not have any of the parameters you
try to assign (normalCohesion, shearCohesion, frictionAngle), see [1]. So
nothing is changed.
The change of material parameters will have effect only for newly created
interactions.
cheers
Jan
[1] https:/
2014-03-10 16:06 GMT+01:00 Henry <email address hidden>:
> Question #245254 on Yade changed:
> https:/
>
> Henry posted a new comment:
> Thanks to Jan.
> Follows is a part of my script. I want to change the material paramteres
> during the simulation. But I found there is no change whether use the
> function of 'Par_Change() or not .
>
> The script:
>
>
> SoilMat=
>
> #def sphereMat(): return
> JCFpmMat(
> density needs to be adapted as porosity of real rock is different to
> granular assembly due to difference in porosity
> (utils.
> with h=Y, g=9.82 and Gamma=2700 kg/m3
>
> O.bodies.
>
> O.engines=[
>
> ForceResetter(),
>
> InsertionSortCo
> InteractionLoop(
>
> [Ig2_Sphere_
> [Ip2_FrictMat_
>
> Ip2_CohFrictMat
>
> [Law2_ScGeom_
> useIncrementalF
> turned on as we want plasticity on the contact moments
> always_
> friction even if the contact is not cohesive (or cohesion is broken), we
> will have to turn this true somewhere
> label='
> ),
>
> GlobalStiffness
> PyRunner(
> NewtonIntegrato
>
> ]
>
>
> def Par_Change():
> global Fos_Step,
> global Fos,D_step
> if O.iter>Fos_Step:# and utils.unbalance
> Fos=Fos+0.05
> Fos_Step=
> Fri_Fos=
> # here we modify the material and interaction physics
> for b in O.bodies:
> if b.material.id==0:
> b.mat.frictionA
> b.mat.normalCoh
> b.mat.shearCohe
> for i in O.interactions:
> if O.bodies[
> material.id==1:
> i.phys.
> i.phys.
> i.phys.
> else:
> i.phys.
> i.phys.
> i.phys.
>
> Thanks a lot!
> Henry
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#5 |
There might be several problems in your script. In what you showed us, you use JCFpmMat, but there is no Ip functor (the Ip2_... "engines") related to this material..
It seems to me that you use too many interaction functors (the Ip2.. and the Law2..), but never the right ones maybe... Try, if not already the case, to understand these names, it is really useful here ! (and possible !)
For ex Ip2_*FrictMat*
And, to do so, it needs that the materials of the two bodies in contact are both of *FrictMat* type. Because it appears twice in the middle of the name !
PS : if you see stars (* symbol) in my text, consider it as surrounding a bold word (to catch your attention !), not real symbols
Revision history for this message
|
#6 |
Dear Jan,
How can I change the material parameters during the simulation?
I tried the following script, but there is no change. :(
for b in O.bodies:
if b.material.id==0:
Thanks a lot!
Henry
Revision history for this message
|
#7 |
Hi,
as already mentioned before a change of matrerial properties is affecting new interactions only. Therefore, you will see no change for existing interactions assuming all interactions in your script are created in the first 1000 steps.
A solution could be to loop over all interactions and change the interaction properties. But this would just be a hack (and very slow) because you have to re-implement some of the equations of the Ip2 functor in python and I am not sure if there is write access to all interaction parameters you need. But you can try something like:
for i in O.interactions:
mat1=O.
mat2=O.
if ((mat1==0) or (mat2==0)):
# change interaction physics here, have a look at doc for parameters and the code for the equation how they are calculated
i.phys.kn=...
i.phys.
# etc
Not sure if there is a clean solution for your problem.
HTH
Klaus
Revision history for this message
|
#9 |
I asked a similar question some time ago [1] but I'm nor sure whether this will help you. In my case I had no problem with waiting some tousand iterations for settlement of the packing with changed material properties. If your application allows for this too it could a solution.
Revision history for this message
|
#10 |
Hi Henry,
there are more possible approaches. It depends on purpose and what you
expect.
1) The approach you already mentioned (for loop oved all interactions), but
you have to change parameters which are defined on the specific IPhys
(CohFrictPhys [1] in your case, but you tried to change parameters that do
not exist). In some IPhys, as Klaus mentioned, not all parameters are
modifyable.
2) change material of all particles, but then you have to delete and
recreate all interactions, e.g.:
pairs = [(i.id1,i.id2) for i in O.interactions]
for b in O.bodies: b.mat = newMat
O.interactions.
for id1,id2 in pairs: utils.createInt
this will preserve also cohesive bonds, but delete all internal variables
of the bonds
cheers
Jan
[1] https:/
2014-03-11 7:51 GMT+01:00 Henry <email address hidden>:
> Question #245254 on Yade changed:
> https:/
>
> Status: Answered => Solved
>
> Henry confirmed that the question is solved:
> Thanks a lot.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>