visulisation of broken bonds

Asked by katie

Hello everyone!
I am new user of ESyS-Particle and I would like to ask you, is there any chance I can visualize broken bonds?
I know I can count them, but what if I want to know when exactly and where particular bond has broke?
Sorry if it is trivial question for you. I cannot find it anywhere though.
Cheers,
Katie

Question information

Language:
English Edit question
Status:
Answered
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Qi Shao (uqqshao) said :
#1

Hi Katie,

Thanks for your question. Yes, ESyS-Particle provides a tool 'fracextract' for visualising the location of broken bonds. Please refer to Section 3.2 & 3.3 of the Tutorial for more details. You may also find relevant information via the following link:

https://answers.launchpad.net/esys-particle/+question/244774

Please let me know if you have further questions.

Regards,
Qi

Revision history for this message
Dion Weatherley (d-weatherley) said :
#2

Hi Katie,

ESyS-Particle comes with a post-processing tool called 'fracextract' that can output information on when/where bond breakage occurred.

This question provides more information on how to use fracextract:
https://answers.launchpad.net/esys-particle/+question/244774

and this schematic shows how to visualise fractures using paraview:
https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxkaW9ud2VhdGhlcmxleXxneDoxOGI4MGQ4OTk0YzNjZWI5

Cheers,

Dion

Revision history for this message
katie (kitten90) said :
#3

Thanks guys for your answers.

I generated frac vtu file which I can visualise in paraview and it's great. But there's only one file. I don't get how to create a lot of files and visualise them step by step (just like in dump2vtk) in paraview. Any ideas?
I basically want to see more and more cracks on following snaps (how they're creating in time).

Cheers,
Katie

Revision history for this message
katie (kitten90) said :
#4

Thanks guys for your answers.

I generated frac vtu file which I can visualise in paraview and it's great. But there's only one file. I don't get how to create a lot of files and visualise them step by step (just like in dump2vtk) in paraview. Any ideas?
I basically want to see more and more cracks on following snaps (how they're creating in time).

Cheers,
Katie

Revision history for this message
Qi Shao (uqqshao) said :
#5

Hi Katie,

As suggested by Dion, this can be achieved by using a shell script to call 'fracextract' multiple times with a 'for' loop. It can be something like this:

#!/bin/bash
for (( i=1; i<=251; i++ ))
do
  fracextract -i snapshot -o fractures_$i.vtu -vtk -rot -t 0 $i 1000
done

This is a tested example for the checkpoint files generated by rotcompress.py in the ESyS-Particle Tutorial, where there are 251 checkpoint files with a save interval of 1000 timesteps. You can modify the numbers to suit your case. This script will produce a sequences of fracture_*.vtu files that can be opened in paraview as a set, which you can 'play' to see the accumulated fractures over time.

I hope this will work for you and meet your needs.

Cheers,
Qi

I hope this will

Revision history for this message
katie (kitten90) said :
#6

I don't think it's working properly.
This is part of what was on my terminal
infilename : snapshot_t=1995000_0.txt
nr. of filenames: 1
nr. of particles: 1
nr. of bonds is:0
nr. of particles old: 1 bonds: 0
nr. of particles new: 1 bonds: 0
added 0 fractures

And every single fracture_*.vtu file has this inside:
<VTKFile type="UnstructuredGrid" version="0.1">
<UnstructuredGrid>
<Piece NumberOfPoints="0" NumberOfCells="0">
<Points>
<DataArray NumberOfComponents="3" type="Float64" format="ascii">
</DataArray>
</Points>
<PointData Scalars="time">
<DataArray type="Int32" Name="time" NumberOfComponents="1" format="ascii">
</DataArray>
<DataArray type="Float32" Name="radius" NumberOfComponents="1" format="ascii">
</DataArray>
<DataArray type="Float32" Name="normal" NumberOfComponents="3" format="ascii">
</DataArray>
<DataArray type="Int32" Name="tag" NumberOfComponents="1" format="ascii">
</DataArray>
</PointData>
<Cells>
<DataArray type="Int32" NumberOfComponents="1" Name="connectivity" format="ascii">
</DataArray><DataArray type="Int32" NumberOfComponents="1" Name="offsets" format="ascii">
</DataArray>
<DataArray type="UInt8" NumberOfComponents="1" Name="types" format="ascii">
</DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>

And of course it doesn't work in Paraview.
Am I doing something wrong here?
Cheers, Katie

Revision history for this message
Dion Weatherley (d-weatherley) said :
#7

Hi Katie,

This behaviour usually happens when fracextract (or dump2vtk) is trying to post-process snapshots from a NRotSphere simulation using the '-rot' argument or vice versa (post-processing RotSphere simulation data without the '-rot' argument).

What is the particleType of your simulation? If it is 'NRotSphere' then remove '-rot' from the fracextract command in your script.

If you are using RotSphere, then the problem is more complicated. The most likely issue is that either your simulation contains no bonded interactions or all bonds are breaking in the first timestep...usually a numerical stability issue. If you suspect this is the issue, please post your simulation script and I'll take a closer look.

Cheers,

Dion

Revision history for this message
katie (kitten90) said :
#8

The thing is, dump2vtk is working properly. I can open vtk files in paraview which allows me to see that I have bonds and they aren't breaking in the first step. Particle type=rot sphere so I guess it is the second problem.

I am just struggling with fracextract.

This is my code. I should explain a bit. I created two cylinders. One is bigger and the second one is in it. I am just trying to push that inner cylinder into the outer one by using small floormesh. I also created cylindrical mesh around the sample.

I really don't know if there is anything wrong here.
Please, take a look if you have a spare moment.
Cheers,
Katie

from __future__ import division
from esys.lsm import *
from esys.lsm.util import *
from esys.lsm.geometry import *
from esys.lsm.vis import povray
import math
from WallLoader import WallLoaderRunnable

#simulation:
steps=2000000
timestep=1.0000e-06
grid=2.5000
verlet=0.1000

#PARTICLES:
minR=0.3
maxR=0.5

#MODEL:
r=2.5
R=5.0
bottom=-10
top=10

#BONDS:
#BrittleBeamPrms
young=100000.0
poisson=0.25
cohesion=100.0
tanangle=1.0

#FrictionPrms
young2=100000.0
poisson2=0.25
dynamicmu=0.4
staticmu=0.6

#NRotFrictionPrms
normalk=1000.0
dynamicmu2=0.6
sheark=100.0

#VPLATE
vplate=-10

#FIELD SAVERY:
step2=100

def snapshot(particles=None, index=0):
 pkg = povray
 scene = pkg.Scene()

 for pp in particles:
  povsphere = pkg.Sphere(pp.getPosn(), pp.getRadius())
  #povsphere.apply(pkg.Colors.Red)
  #scene.add(povsphere)
  T = pp.getTag()

  if(T==1):
   povsphere.apply(pkg.Colors.Green)
   scene.add(povsphere)
  if(T==2):
   povsphere.apply(pkg.Colors.CornflowerPink)
   scene.add(povsphere)

 camera = scene.getCamera()
 camera.setLookAt(Vec3(0,0,0))
 camera.setPosn(Vec3(1,0,0))
 camera.setZoom(0.05)

 scene.render(
 offScreen=True,
 interactive=False,
 fileName="FILM/PNG/{0:09d}.png".format(index),
 size=[1500,800]
 )
 return

sim = LsmMpi (numWorkerProcesses = 1, mpiDimList = [1,1,1])
sim.initNeighbourSearch (
particleType = "RotSphere",
gridSpacing = grid,
verletDist = verlet
)

sim.setNumTimeSteps (steps)
sim.setTimeStepSize (timestep)

domain = BoundingBox(Vec3(-20,-20,-20), Vec3(20,20,20))
sim.setSpatialDomain(domain)

geoRandomBlock = RandomBoxPacker (
minRadius = minR,
maxRadius = maxR,
cubicPackRadius = 2.2000,
maxInsertFails = 5000,
bBox = BoundingBox(Vec3(-R, bottom,-R),Vec3(R, top, R)),
circDimList = [False, False, False],
tolerance = 1.0000e-05)

geoRandomBlock.generate()
geoRandomBlock_particles = geoRandomBlock.getSimpleSphereCollection()

for pp in geoRandomBlock_particles:
 centre = pp.getPosn()
 X=centre[0]
 Y = centre[1]
 Z=centre[2]
 if (X*X+Z*Z<=4.9*4.9):
  if (Z*Z+X*X<=(Y*r/4.0)*(Y*r/4.0) and X*X+Z*Z<=r*r and Y>=0):
   pp.setTag(2) # layer 1
   pp.setRad(minR)
   sim.createParticle(pp)
  else:
   pp.setTag(1) # layer 1
   sim.createParticle(pp)

sim.createConnections(
 ConnectionFinder(
  maxDist=0.005,
  bondTag=1,
  pList=geoRandomBlock_particles)
)

pp_bonds = sim.createInteractionGroup (
BrittleBeamPrms(
name="pp_bonds",
youngsModulus=young,
poissonsRatio=poisson,
cohesion=cohesion,
tanAngle=tanangle,
tag=1
)
)

sim.createInteractionGroup (
FrictionPrms(
name="friction",
youngsModulus=young2,
poissonsRatio=poisson2,
dynamicMu=dynamicmu,
staticMu=staticmu
)
)

sim.createExclusion (
interactionName1 = "pp_bonds",
interactionName2 = "friction"
)

#add a circle wall which is being pushed into the sample:
sim.readMesh(
fileName = "floorMesh.msh",
meshName = "floor_mesh_wall"
)

#add a cylinder wall around the sample:
sim.readMesh(
fileName = "cylinder.lsm",
meshName = "cylinder"
)

#specify that particles undergo frictional interactions:
sim.createInteractionGroup (
NRotFrictionPrms (
name = "friction",
normalK = normalk,
dynamicMu = dynamicmu2,
shearK = sheark,
scaling = True
)
)

#particles near the base are bonded to the wall:
sim.createInteractionGroup (
NRotBondedTriMeshPrms (
name = "floorWall_repell",
meshName = "floor_mesh_wall",
normalK = 1.0000e+04,
breakDistance=0.5,
buildPrms=MeshGapBuildPrms(1)
)
)

#particles near the base are bonded to the wall:
sim.createInteractionGroup (
NRotBondedTriMeshPrms (
name = "cylinder_repell",
meshName = "cylinder",
normalK = 1.0000e+04,
breakDistance=0.5,
buildPrms=MeshGapBuildPrms(1)
)
)

wall_loader1 = WallLoaderRunnable(
LsmMpi = sim,
meshName = "floor_mesh_wall",
vPlate = Vec3 (0.0, vplate, 0.0),
startTime = 0,
rampTime = 100
)
sim.addPreTimeStepRunnable (wall_loader1)

sim.createCheckPointer (
 CheckPointPrms (
  fileNamePrefix = "snapshot",
  beginTimeStep = 0,
  endTimeStep = steps,
  timeStepIncr = 5000
 )
)

#create a FieldSaver to store number of bonds:
sim.createFieldSaver (
InteractionScalarFieldSaverPrms(
interactionName="pp_bonds",
 fieldName="count",
 fileName="FIELDSAVER/nbonds.dat",
 fileFormat="SUM",
 beginTimeStep=0,
 endTimeStep=steps,
 timeStepIncr=step2
 )
)

#create a FieldSaver to store the total kinetic energy of the particles:
sim.createFieldSaver (
ParticleScalarFieldSaverPrms(
 fieldName="e_kin",
 fileName="FIELDSAVER/ekin.dat",
 fileFormat="SUM",
 beginTimeStep=0,
 endTimeStep=steps,
 timeStepIncr=step2
 )
)

#create a FieldSaver to store potential energy stored in bonds:
sim.createFieldSaver (
InteractionScalarFieldSaverPrms(
interactionName="pp_bonds",
 fieldName="potential_energy",
 fileName="FIELDSAVER/epot.dat",
 fileFormat="SUM",
 beginTimeStep=0,
 endTimeStep=steps,
 timeStepIncr=step2
 )
)

N_max = sim.getNumTimeSteps()
n=0
while (n < N_max):
 sim.runTimeStep()
 if (n%5000==0):
  particles = sim.getParticleList()
  snapshot(particles=particles, index=n)
 n += 1

#execute the simulation:
sim.run()

Revision history for this message
Qi Shao (uqqshao) said :
#9

Hi Katie,

I am going to reproduce your problem on my PC and try to identify the issues. For this purpose, could you please send me (probably via email) your script along with other required files, i.e., the mesh files and the file that includes ‘WallLoaderRunnable’? Thanks.

Cheers,
Qi

Revision history for this message
Qi Shao (uqqshao) said :
#10

Hi Katie,

Thank you for sending through the files. I have reproduced your problems on my PC and identified two reasons why ‘fracextract’ did not work as expected.

The first reason is that you have saved the checkpointer files in a CHECKPOINTER/ directory, instead of the default directory where your script is. Therefore, the ‘fracextract’ command needs to be executed from the same directory as your ESyS-Particle script (not in the CHECKPOINTER/ directory), as follows:

fracextract -i CHECKPOINTER/snapshot -o CHECKPOINTER/fractures.vtu -vtk -rot -t 0 401 5000

If you want to produce a sequence of fracture_*.vtu files and see the accumulated fractures over time, you can save the following lines in a file named “fracextract.sh” and put this file in the same directory as your ESyS-Particle script. Then execute the file by issuing the command ‘./fracextract.sh’.

#!/bin/bash
for (( n=1; n<=401; n++ ))
do
  fracextract -i CHECKPOINTER/snapshot -o CHECKPOINTER/fractures_$n.vtu -vtk -rot -t 0 $n 5000
done

This would produce outputs as follows:

version : 3
infilename : CHECKPOINTER/snapshot_t=0_0.txt
nr. of filenames: 1
nr. of particles: 3487
nr. of bonds is:0
version : 3
infilename : CHECKPOINTER/snapshot_t=5000_0.txt
nr. of filenames: 1
nr. of particles: 3487
nr. of bonds is:0
nr. of particles old: 3487 bonds: 0
nr. of particles new: 3487 bonds: 0
added 0 fractures
.
.
.

You can see that the particles have been correctly read in, but not for the bonds. The reason for this is that the current version of ESyS-Particle does not support extracting fractures for ‘BondedTriMesh’ which you have created in your simulation. To solve this problem, I have modified the source code relevant to ‘fracextract’. I will email you the modified file named ‘fracframe.cpp’, with which you need to replace the old file located at /Tools/ExtractFractures/ of the EsyS-Particle source code directory. Then update EsyS-Particle using the following commands in the root directory of EsyS-Particle:

sudo make uninstall
make
sudo make install

I will make above changes to the development version of EsyS-Particle soon. Besides, I have also found a couple of other issues in your script. Firstly, the following code fragment is redundant and needs to be removed as you have already defined FrictionPrm interaction for the unbonded rot particles:

sim.createInteractionGroup (
 NRotFrictionPrms (
  name = "friction",
  normalK = normalk,
  dynamicMu = dynamicmu2,
  shearK = sheark,
  scaling = True
 )
)

Secondly, in the end of your script, ‘sim.run()’ needs to be removed as you have used a loop to execute ‘sim.runTimeStep()’ at each iteration. Add ‘sim.exit()’ to the end of script to finish the simulation.

I hope this would solve your problem. Let me know if you have further issues.

Cheers,
Qi

Can you help with this problem?

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

To post a message you must log in.