# export Crack pattern from VtkExport Engine

25 views
Hi Vaclav,

Is there a way I can export crack pattern for concrete particles so that I can visualize the crack using Paraview?

Best regards,

Giao

answered Nov 6, 2018 by (49,030 points)

Hi Giao, VtkExport can export MatState scalars if you enable it (via VtkExport(...,what=VtkExport.all) or similar, see https://github.com/woodem/woo/blob/master/pkg/dem/VtkExport.hpp#L106 for the enumeration values). ConcreteMatState (defined on a particle) only exposes numBrokenCohesive (https://github.com/woodem/woo/blob/7e28ddd3c947fb0ef86792a6ce06326260a4c0d2/pkg/dem/Concrete.hpp#L7) and this will show up in Paraview. If you need to export e.g. contact damage, that is currently not being exported; the only thing exported for contacts is normal and tangent force (https://github.com/woodem/woo/blob/master/pkg/dem/VtkExport.cpp#L290). I would consider writing a separate export routine just for contacts; you can write that in Python and save in any (perhaps even VTK) format. If you need any help/pointers, let me know. HTH, Vaclav

commented Nov 6, 2018 by (500 points)

Hi Vaclav,

I read about the numBrokenCohesive but I did not understand it how to use it correctly, from the python I typed:
woo.dem.ConcreteMatState().numBrokenCohesive and it returned 0.

I also tried to look into concrete particle attributes by s.dict(), as it shows:

{'id': 20,
'shape': ,
'material': ,
'matState': None}

when I tried VtkExport(what= VtkExport.all) I didnot see anything relevant to matState as in the vtkexport.hpp. Perhaps I am using an old version of woo, I don't know... It appears to me that ConcreteMatState so far only holds information about number of broken cohesive.

I also wrote a script(in vtk format) to export the omega value to each contact (both cohesive and non-cohesive) and visualize it, if you like I could send it to you by email or so, but anyway the visualization is quite meaningless... (I was not able to detect major cracks)

however if I turn on the opacity to fade contacts that have small omega value:

or by clipping:

at this time step, less than 3% of total contacts has omega value larger than zero.

I also did try to average omega values into particles:
the code is basically like this:

 with open(tmpFileName,'a+') as paraFile:
for s in S.dem.par:
if (type(s.shape)==Sphere) and len(s.con)!=0:
avgCon = 0.0
for con in s.tacts: avgCon+= con.phys.omega
avgCon=avgCon/len(s.con)
paraFile.write(str(s.pos[0])+', '+str(s.pos[1])+', '+str(s.pos[2])+', ' + str(avgCon)+'\n')


then the results seem to look a lot better:

Here I come to the point to conclude it would be best to visualize crack in paraview as below:

Sorry for such a long post. But I am a bit confused at the moment...It would be great if you could suggest me how should I export the data properly.

Best,
Giao

commented Nov 7, 2018 by (49,030 points)

Hi Giao, you could export ConcretePhys.relResidualStrength (which is 1 for virgin and 0 for fully broken contacts) or its complement 1-relResidualStrength. While the mapping of omega to residual strength is monotonic, residual strength has straightforward physical meaning.

ConcreteMatState is only used (i.e. that data changed) when the matState is assigned in the first place (https://github.com/woodem/woo/blob/7e28ddd3c947fb0ef86792a6ce06326260a4c0d2/pkg/dem/Concrete.cpp#L333). What you need to do is something like for p in S.dem.par: p.matState=ConcreteMatState() before you launch the simulation; when done, you can loop over particles and access p.matState.numBrokenCohesive for each particle. If matState is defined, you can also visualize that by setting Display/demField/colorBy/Particle.matState and then set matStateIx to 0 (that is the default, the first scalar - there is just that one, anyway). You can do the same in a script, like S.gl.demField.colorBy='Particle.matState' and S.gl.demField.matStateIx=0.

Visualizing cracks (especially in 3d) is quite difficult, since their orientation matters. There are papers on that but I've never done anything advanced in that sense. Averaging over particles (like numBrokenCohesive and such) can give quite nice patterns, provided the discretization (particle size) is sufficiently small. Sometimes it was enough to do a 2d slice and average some damage measure to get an idea about what is happening.

HTH, vaclav

commented Nov 13, 2018 by (500 points)

Dear Vaclav,
Thank you so much to making it clear ! :)

Giao