Load python module from within YADE
Hello. I have a file anyModule.py which I import with the line "import anyModule" from my YADE script bouncingSphereF
YADE script:
import numpy as np
import anyModule
# basic simulation showing sphere falling ball gravity,
# bouncing against another sphere representing the support
# DATA COMPONENTS
# add 2 particles to the simulation
# they the default material (utils.defaultMat)
O.bodies.append([
# fixed: particle's position in space will not change (support)
utils.sphere(
# this particles is free, subject to dynamics
utils.sphere(
])
# Prints in file the center coordinates of the bouncing sphere
#def printFile():
#h = [O.bodies[
#np.
# FUNCTIONAL COMPONENTS
# simulation loop -- see presentation for the explanation
O.engines=[
ForceResetter(),
InsertionSortCo
InteractionLoop(
[Ig2_Sphere_
# collision geometry
[Ip2_FrictMat_
[Law2_L3Geom_
# contact law -- apply forces
),
# damping: numerical dissipation of energy
NewtonIntegrato
PyRunner(command = "anyModule.
]
# set timestep to a fraction of the critical timestep
# the fraction is very small, so that the simulation is not too fast
# and the motion can be observed
O.dt=.5e-
# save the simulation, so that it can be reloaded later, for experimentation
O.saveTmp()
#print "it was here"
O.run(2000000)
*******
Python module:
# Prints in file the center coordinates of the bouncing sphere
def printFile():
#h = [O.bodies[
#np.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jan Stránský
- Solved:
- Last query:
- Last reply: