How to Show Stress or strain contour

Asked by Faqih Maarif

Dear All,
I want to show both stress and strain contour in Paraview (post-processing). I have a problem when I run my code [1] as follows:

1st error:
ERROR /build/yade-fDuCoe/yade-2018.02b/gui/qt5/OpenGLManager.cpp:71 waitForNewView: Timeout waiting for the new view to open, giving up.

2nd error:
WARN /build/yade-fDuCoe/yade-2018.02b/pkg/dem/SnapshotEngine.cpp:15 action: Making myself Engine::dead, as I can not live without a 3d view (timeout).

After running the code, I have four files types, for examples :
3d-vtk-spheres.1000.vtu
3d-vtk-intrs.1000.vtp
3d-vtk-facets.1000.vtu
3d-vtk-boxes.1000.vtu

when I was opened in paraview, I cannot seen the stress and strain contour. I dont know how, any ideas?
Coluld you please help to find a way. Thank you.

Best Regards,
Faqih

-----------------------------------------------------------------------------------------------------
Here is my code:
[1] https://safenote.co/r/5ed479f79bd8f3@02872726
------------------------------------------------------------------------------------------------------

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
Last query:
Last reply:
Revision history for this message
Chareyre (bruno-chareyre-9) said :
#1

Hi,
Contours in paraview and the crash you get, pointing to a yade source file,
are clearly two different things. It makes the question confusing.
Please split the problem in two: snapshotEngine is unrelated to paraview so
better use them in separate scripts. You may then split your question in
two questions. See [1].
Please pay attention also to the mention therein that links to external
repositories need to be avoided.
Regards
Bruno

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

Revision history for this message
Faqih Maarif (faqih07) said :
#2

Hi,

Apologize for my question above. I will make it separately.
I cannot show the breakline concrete in paraview (3d processing) with this code.
---------------------
VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000),
qt.SnapshotEngine(fileBase='3d-',iterPeriod=100,label='snapshot'),
--------------------
The script works well, but in the postprocessing (using paraview), I can not see the zones of stress or strain in my concrete cube model.
I dont know how to solve it, Could you please help. Thank you.

Best Regards,
Faqih

Here is the complete code
------------------------------------------------------------------------------------------------------------------------------------------------------
from future import standard_library
standard_library.install_aliases()
from yade import plot,pack,timing
import time, sys, os, copy
from yade import pack, qt

readParamsFromTable(noTableOk=True,
     young = 25e9,
     poisson = .2,
     epsCrackOnset = 1e-4,
     relDuctility = 30,
     sigmaT = 3e6,
     frictionAngle = atan(0.8),
     density = 4800,

     intRadius = 1.5,
     dtSafety = .8,
     damping = 0.3,

     strainRateTension = .05,
     strainRateCompression = 0.5,

     setSpeeds=True,
     specimenSize = 0.15,
     radius = 3e-3,

     outBase = "/tmp/cpm_uniax",
)
from yade.params.table import *

if 'description' in O.tags.keys(): # o.tags.can be used to retrieve unique identifiers of the simulation
outBase = "{}_{}".format(outBase,O.tags['description'])

O.materials.append(CpmMat( #concrete materials
       young = young,
       poisson = poisson,
       epsCrackOnset = epsCrackOnset,
       relDuctility = relDuctility,
       sigmaT = sigmaT,
       frictionAngle = frictionAngle,
))

s = specimenSize # pack = predicate with spheres
sp = pack.randomDensePack(inAlignedBox((0,0,0),(s,s,s)),radius,spheresInCell=700,memoizeDb="packing.db",returnSpherePack=True)
sp.toSimulation()

bb=uniaxialTestFeatures() #bounding box
negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area']
O.dt=dtSafety*SpherePWaveTimeStep(radius,density,max(50e9,young))
print('timestep',O.dt)

O.engines=[
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius,label='is2aabb'),],verletDist=.05*radius),
        InteractionLoop(
              [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius,label='ss2sc')], #collision geometry
              [Ip2_CpmMat_CpmMat_CpmPhys()], #concrete model
              [Law2_ScGeom_CpmPhys_Cpm()], #binary functor (LawFunctor) called for types ScGeom (Geom) and CpmPhys.
),
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=5,timestepSafetyCoefficient=0.8,defaultDt=PWaveTimeStep()), #new

NewtonIntegrator(damping=damping),

# save data for Paraview
VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000),
# save data from Yade's own 3d view
qt.SnapshotEngine(fileBase='3d-',iterPeriod=100,label='snapshot'),

CpmStateUpdater(realPeriod=.5),
UniaxialStrainer(strainRate=strainRateTension,axis=axis,asymmetry=0,posIds=posIds,negIds=negIds,crossSectionArea=crossSectionArea,blockDisplacements=False,blockRotations=False,setSpeeds=True,label='strainer'),

        PyRunner(iterPeriod=100,command='addPlotData()',label='plotDataCollector',initRun=True),
        PyRunner(iterPeriod=100,command='print O.iter,plot.data["sigma"][-1]'),
]

plot.plots={'eps':('sigma',)}
O.saveTmp('initial'); #named memory slot

def addPlotData():
        yade.plot.addData({'t':O.time,'i':O.iter,'eps':strainer.strain,'sigma':strainer.avgStress,})

def initTest(mode):
        print "init"
        O.loadTmp('initial')
        if mode == "compression":
                 print "Reversing plot data";
                 plot.reverseData()
        strainer.strainRate = abs(strainRateTension) if mode=='tension' else -abs(strainRateCompression)
        O.step();
         ss2sc.interactionDetectionFactor=1.
         is2aabb.aabbEnlargeFactor=1.

def stopIfDamaged(mode):
         sigma,eps = plot.data['sigma'], plot.data['eps']
         mode = 'tension' if strainer.strainRate > 0 else 'compression'
         extremum = max(sigma) if mode == 'tension' else min(sigma)
         minMaxRatio = 0.2 if mode=='tension' else 0.7
         if abs(sigma[-1]/extremum) < minMaxRatio or abs(strainer.strain) > 5e-3:
               print "Damaged, stopping."
               return True

for mode in ('tension','compression'):
         initTest(mode)
        while True:
               O.run(100,True)
               if stopIfDamaged(mode):
                      break
               if O.iter > 10000:
                      break

sigma = plot.data["sigma"]
ft,fc = max(sigma),min(sigma)
print 'Strengths fc={}, ft={}'.format(fc,ft)
#print 'Strengths fc={}, ft={}, |fc/ft|={}'.format(fc,ft,abs(fc/ft))

plot.saveDataTxt("{}.dat".format(outBase))
print 'Bye.'

plot.plot() #old
o.saveTmp #old
o.loadTmp #old saved state.
-----------------------------------------------------------------------------------------------------------------------------------------------------------

Revision history for this message
Chareyre (bruno-chareyre-9) said :
#3

> VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000),
> qt.SnapshotEngine(fileBase='3d-',iterPeriod=100,label='snapshot'),

Again: only the first of these lines is related to paraview. Choose if your
problem is paraview or SnaphotEngine then please clarify your question.
B.

Revision history for this message
Faqih Maarif (faqih07) said :
#4

Hi,

I am Sorry for misunderstanding.

I can run properly without error, and I could run many parameters in paraview 5.4.1 with this code:
> VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000),

But, I can't see concrete cracks on the ParaView 5.4.1.
Could you please help. Thank you.

Best Regards,
Faqih

Revision history for this message
Best Bruno Chareyre (bruno-chareyre) said :
#5

Hi,
I don't understand your question I'm sorry. I would suggest to close this confusing discussion, step back, then clarify what you get and why it is not what you expect. But please do this in a different thread.
Regards
Bruno

Revision history for this message
Faqih Maarif (faqih07) said :
#6

Hi,

Thank you for your advice and patience.
By the way, I am new in Yade, sorry to make you confused. I will create it in a different thread later.

Best Regards,
Faqih

Revision history for this message
Faqih Maarif (faqih07) said :
#7

Thanks Bruno Chareyre, that solved my question.