← Back to team overview

yade-users team mailing list archive

[Question #685296]: export data with NaN in two data files

 

New question #685296 on Yade:
https://answers.launchpad.net/yade/+question/685296

Hi All, 
I want to use plot.saveDataTxt command to save data into different files.

the code can run and without errors, but the output data have NaN in these files

here is the code:
#################
from yade import pack, plot,export
import numpy as np
O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=31))
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=.1,rRelFuzz=.5, seed =1)
sp.toSimulation()
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_ScGeom_FrictPhys_CundallStrack()]
	),
	NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
	PyRunner(command='checkUnbalanced()',iterPeriod=1000),
	PyRunner(command='addPlotData()',iterPeriod=2500),
	PyRunner(command='coon()',iterPeriod=3000)
]
O.dt=.5*PWaveTimeStep()
print(len(O.bodies))
def checkUnbalanced():
	if unbalancedForce()<.001:
		O.pause()

def addPlotData():
	plot.addData(i=O.iter,unbalanced=unbalancedForce())
	plot.saveDataTxt('data.txt',vars = ("i","unbalanced"))
def coon():
	porosity_cal = utils.voxelPorosity(200,(0,0,0),(0.5,0.5,0.5))
	CoorN=avgNumInteractions(cutoff=0.0, skipFree=False, considerClumps=False)
	plot.addData(i=O.iter,CN=CoorN,porosity=porosity_cal)
	plot.saveDataTxt('CN.txt',vars=("i","CN","porosity"))

##############################

the output of these two files are shown below:
# i		CN		porosity
2500	nan	nan
3000	1.92	0.662186625
5000	nan	nan
6000	3.32	0.65279675
7500	nan	nan
9000	3.52	0.652999125

####
# i		unbalanced
2500	0.527135373123
3000	nan
5000	0.137454303934
6000	nan
7500	0.00701580820745

In the Pyrunner command, I set the iterPeriod to 2500 and 3000. even though I set the iterPeriod to the same, the test files still have NaN.

but I hope the result like this:
##############
# i		CN		porosity
3000	1.92	0.662186625
6000	3.32	0.65279675
9000	3.52	0.652999125

####
# i		unbalanced
2500	0.527135373123
5000	0.137454303934
7500	0.00701580820745

######################
since there is no error, I have no idea why this happens.

best,
yong



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.