How to output a list throughout timestep
Hi all,
I am simulating a direct shear experiment with a granular layer.
I would like to see how the force in the X direction (O.force(b).[1]) transmit within the granular layer during initial shearing.
I define a weighted average function called "getForce" to calculate the weighted average force of each particle at a certain Y position (Ystep).
Then, I define another function called "forceExport" to save the weighted force and the corresponded depth as a list with "np.savetxt".
I would like to output the list every 1000 iteration so I use Pyrunner to do this.
However, I cannot think of a way to save the list with a filename that is corresponded to the iteration period because it would overwrite the previous file.
Is there another way to save a list throughout the iteration period?
Thanks!
Here's part of my code:
###
O.engines=[
ForceResetter()
,InsertionSort
,InteractionLoop(
[Ig2_
[Ip2_
[Law2_
)
,GlobalStiffne
,PyRunner(
,PeriTriaxCont
,NewtonIntegra
,PyRunner(
,PyRunner(
]
def weight_
return(
def getForce(y1):
weight=0
weightedForce=0
totalWeighted
totalWeight=0
for i in range(2,
weight = weight_
weightedForce = O.forces.f(i).[0] * weight
totalWeight
totalWeight = totalWeight + weight
return (totalWeightedF
def forceExport():
dh = (O.bodies[
list_force = []
for i in range(Ystep):
y1 = dh*i + O.bodies[
np.
###
Cheers,
Chien-Cheng
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Chien-Cheng Hung
- Solved:
- Last query:
- Last reply: