about visualizing jcfpm cracks .vtu files

Asked by Ziyu Wang

Hello,
I encountered a problem similar to that in [1].
The difference is that I successfully generated cracks.vtu files and is not empty, but when I use paraview to open cracks.vtu series files, no graphics are displayed.
After opening the cracks.vtu file, in the Cell/Point Array Status in the properties bar of paraview,I can see many attributes including iter,norm,nrg,onJnt,size,time,type.However,these properties do not seem to be visualized(I can't switch the Coloring attribute,there is the default value 'Solid Color')
My paraview version is 5.9.1,if is suitable?
Following is my script related to vtk files:
####
saveVTK=2000
OUT='compressionTest_JCFPM_uniaxial'
[Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(recordCracks=True,Key=OUT,label='interactionLaw')]
VTKRecorder(iterPeriod=int(saveVTK),initRun=True,fileName='JCFPM/'+OUT+'-',recorders=['spheres','jcfpm','cracks'],Key=OUT,label='vtk')
####

Thanks for help!
[1]https://answers.launchpad.net/yade/+question/626277

Question information

Language:
English Edit question
Status:
Open
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :
#1

Hello,

Please provide a Minimal Working Example [1].

[1]https://www.yade-dem.org/wiki/Howtoask

Cheers,

Robert

Revision history for this message
Ziyu Wang (ziyuwang1) said :
#2

Hi,Robert

Following is my MWE.
------------------------------------------------
from yade import pack, ymport, plot, utils, export, timing
import sys

rate=-0.1
saveVTK=2000
intR=1.5
density=2640
young=3000e9
friction=10
poisson=0.4
tens=160e6
cohes=1600e6
mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)
OUT='compressionTest_JCFPM_uniaxial'
name='JCFPM_uniaxial'

O.materials.append(JCFpmMat(type=1,density=density,young=young,poisson=poisson,frictionAngle=radians(friction),tensileStrength=tens,cohesion=cohes,label='spheres'))
O.bodies.append(ymport.text('packing-'+name+'.spheres',scale=1,shift=Vector3(0,0,0),material='spheres'))
#(The model is a cube containing about 5000 particles generated by the RandomDensePack method)

totalSpheres=len(O.bodies)
print('The number of sphere is:',totalSpheres)

bb=utils.uniaxialTestFeatures(axis=2)
negIds,posIds,crossSectionArea=bb['negIds'],bb['posIds'],bb['area']

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intR,label='Saabb')]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intR,label='SSgeom')],
  [Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,label='interactionPhys')],
  [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(recordCracks=True,Key=OUT,label='interactionLaw')]
 ),
 UniaxialStrainer(strainRate=rate,axis=2,asymmetry=0,posIds=posIds,negIds=negIds,crossSectionArea=crossSectionArea,blockDisplacements=1,blockRotations=1,setSpeeds=0,stopStrain=0.015,dead=1,label='strainer'),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.8, defaultDt=utils.PWaveTimeStep()),
 NewtonIntegrator(damping=0.4,label='newton'),
 PyRunner(iterPeriod=int(100),initRun=True,command='recorder()',label='data'),
 VTKRecorder(iterPeriod=int(saveVTK),initRun=True,fileName='JCFPM/'+OUT+'-',recorders=['spheres','jcfpm','cracks'],Key=OUT,label='vtk')
]

def recorder():
    yade.plot.addData({'i':O.iter,
         'eps':-strainer.strain,
         'sigma':-strainer.avgStress,
         'tc':interactionLaw.nbTensCracks,
         'sc':interactionLaw.nbShearCracks,
         'te':interactionLaw.totalTensCracksE,
         'se':interactionLaw.totalShearCracksE,
         'unbF':utils.unbalancedForce()})
    plot.saveDataTxt(OUT)

plot.plots={'eps':('sigma',None,'tc','sc')}
plot.plot()

O.step()
SSgeom.interactionDetectionFactor=-1.
Saabb.aabbEnlargeFactor=-1.

cohesiveCount = 0
for i in O.interactions:
 if hasattr(i.phys, 'isCohesive'):
              if i.phys.isCohesive == True:
                     cohesiveCount+=1
print('the origin total number of cohesive bond is:',cohesiveCount)

strainer.dead=0
O.run()
--------------------------------------------------------

Thanks!

Revision history for this message
Robert Caulk (rcaulk) said :
#3

FileNotFoundError: [Errno 2] No such file or directory: 'packing-JCFPM_uniaxial.spheres'

Revision history for this message
Ziyu Wang (ziyuwang1) said :
#4

Hi,Robert

'packing-JCFPM_uniaxial.spheres' is my text file generated by RandomDensePack.. (The model is a cube containing about 5000 particles generated by the RandomDensePack method,cube is 0.05*0.05*0.05m,and the radius of sphere is all about 0.0015m)
I do not know how to upload the text file..maybe you can try to use the RandomDensePack to generate?(Sorry to bother you)
Here are my modeling commands:
--------------------------------
mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)
sp=pack.SpherePack()
pred=pack.inAlignedBox(mn,mx)
sp=pack.randomDensePack(pred,radius=0.0015,rRelFuzz=0,returnSpherePack=True,memoizeDb='/tmp/triax.sqlite')
spheres=sp.toSimulation(color=(0.6,0.5,0.15))
-------------------------------

Thanks again for kindly help!

Revision history for this message
Ziyu Wang (ziyuwang1) said (last edit ):
#5

Hi,Robert.
Here is the complete code that can be run:
------------------------------------------------
from yade import pack, ymport, plot, utils, export, timing
import sys

rate=-0.1
saveVTK=2000
intR=1.5
density=2640
young=3000e9
friction=10
poisson=0.4
tens=160e6
cohes=1600e6
mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)
OUT='compressionTest_JCFPM_uniaxial'
name='JCFPM_uniaxial'

O.materials.append(JCFpmMat(type=1,density=density,young=young,poisson=poisson,frictionAngle=radians(friction),tensileStrength=tens,cohesion=cohes,label='spheres'))
mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)
sp=pack.SpherePack()
pred=pack.inAlignedBox(mn,mx)
sp=pack.randomDensePack(pred,radius=0.001,rRelFuzz=0,returnSpherePack=True,memoizeDb='/tmp/triax.sqlite')
spheres=sp.toSimulation(color=(0.6,0.5,0.15))

bb=utils.uniaxialTestFeatures(axis=2)
negIds,posIds,crossSectionArea=bb['negIds'],bb['posIds'],bb['area']

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intR,label='Saabb')]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intR,label='SSgeom')],
  [Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,label='interactionPhys')],
  [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(recordCracks=True,Key=OUT,label='interactionLaw')]
 ),
 UniaxialStrainer(strainRate=rate,axis=2,asymmetry=0,posIds=posIds,negIds=negIds,crossSectionArea=crossSectionArea,blockDisplacements=1,blockRotations=1,setSpeeds=0,stopStrain=0.015,dead=1,label='strainer'),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.8, defaultDt=utils.PWaveTimeStep()),
 NewtonIntegrator(damping=0.4,label='newton'),
 PyRunner(iterPeriod=int(100),initRun=True,command='recorder()',label='data'),
 VTKRecorder(iterPeriod=int(saveVTK),initRun=True,fileName='JCFPM/'+OUT+'-',recorders=['spheres','jcfpm','cracks'],Key=OUT,label='vtk')
]

def recorder():
    yade.plot.addData({'i':O.iter,
         'eps':-strainer.strain,
         'sigma':-strainer.avgStress,
         'tc':interactionLaw.nbTensCracks,
         'sc':interactionLaw.nbShearCracks,
         'te':interactionLaw.totalTensCracksE,
         'se':interactionLaw.totalShearCracksE,
         'unbF':utils.unbalancedForce()})
    plot.saveDataTxt(OUT)

plot.plots={'eps':('sigma',None,'tc','sc')}
plot.plot()

O.step()
SSgeom.interactionDetectionFactor=-1.
Saabb.aabbEnlargeFactor=-1.

cohesiveCount = 0
for i in O.interactions:
 if hasattr(i.phys, 'isCohesive'):
              if i.phys.isCohesive == True:
                     cohesiveCount+=1
print('the origin total number of cohesive bond is:',cohesiveCount)

strainer.dead=0
O.run()
---------------------------------------
Best wishes!

Can you help with this problem?

Provide an answer of your own, or ask Ziyu Wang for more information if necessary.

To post a message you must log in.