How to output volumetric strain (micro strain field) in vtk file

Asked by Leonard

Hi,

Referring to [1], we can use defToVtkFromPositions() to write a vtk file to visualise the deviatoric strain filed in paraview. For example: defToVtkFromPositions(position1.txt,position2.txt,"output_deviatoricStrain.vtk"). In this vtk file, it can show: solid color, strain_deviator and strain_matrix. It seems that no volumetric strain field from this vtk file.

I would like to ask how to write a vtk file to visualise the volumetric strain field.

Thanks.
Leonard

[1]https://yade-dev.gitlab.io/trunk/yade.wrapper.html?highlight=deftovtkfrompositions#yade.wrapper.TesselationWrapper.defToVtkFromPositions

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Karol Brzezinski
Solved:
Last query:
Last reply:
Revision history for this message
Best Karol Brzezinski (kbrzezinski) said :
#1

Hi,

MWE would be appreciated [1].

Using the' calculator filter', you can always compute anything in ParaView from matrix components.

Load the VTK file, and then use the calculator filter. You can type the formula:

"Strain_matrix_0"+"Strain_matrix_4"+"Strain_matrix_8"

or select other components using the "Scalar" button. Next, you can visualize the 'Result'.

The MWE that I used to generate the file is as follows:
####
centers = []
for x in range(2):
 for y in range(2):
  for z in range(2):
   centers.append((x,y,z))

O.bodies.append([
 sphere(center=center,radius=1,) for center in centers
])

sp = SpherePack()
sp.fromSimulation()

TW=TesselationWrapper()
TW.triangulate()
TW.computeVolumes()

TW.setState(0)

shiftBodies([4,5,6,7],(1,0,0)) # move spheres without engines (I am just being lazy)
shiftBodies([2,3,6,7],(0,1,0))
shiftBodies([1,3,5,7],(0,0,1))

TW.setState(1)
TW.defToVtk("strain.vtk")

###

Cheers,
Karol

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

Revision history for this message
Leonard (z2521899293) said :
#2

Thanks Karol Brzezinski, that solved my question.