← Back to team overview

yade-users team mailing list archive

Re: Successive slightly different simulations

 

>
> Does someone have an idea ? Could python scripts (which I don't know at 
> all but it will maybe be the time) help for that ?
Hi, yes, you can use python for just this.

I will give you an example of using different loading speeds (you can
chage to suit your needs). Label the engine you of which parameters you
will modify (Engine::label) e.g. 'jeromeEngine' (not necessary, but
makes it easiest to find the engine).

o=Omega()
# create the simulation here, save it
# ...
# o.save('/the/original/setup.xml.bz2')
#
# or do nothing it it is already created and saved

# loop over different loading modes
for mode in ['mode1','mode2','mode3']:
    # load the original state
    o.load('/the/original/setup.xml.bz2')
    # get the engine you want to modify
    je=o.labeledEngine('jeromeEngine)
    # change engine parameters depending on the loading mode
    if mode=='mode1':
       je['strainRate']=10
       je['maxStrain']=1e-6
    elif mode=='mode2':
       je['strainRate']=20
       je['maxStrain']=1e-5
    elif mode=='mode3':
       je['strainRate']=30
    # run 1000 iterations and wait (True) until they are done
    # you could use different criterion of when to stop, but this one is
the simplest since it is known beforehand
    o.run(1000,True);
    # print/save the results you need here
    # for example, an internal variable of your engine
    print je['averageStress'],je['sigmaZ']
    # or force actiong on body #50
    print o.actions.f(50)
   
Save the script as something.py and run with yade-trunk something.py.
Get back with questions, Janek already suggested creating a section of
python code snippets on the wiki, but this hasn't started yet.

Vaclav
_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users



Follow ups

References