← Back to team overview

yade-users team mailing list archive

Re: [Question #691065]: How to Show Stress or strain contour

 

Question #691065 on Yade changed:
https://answers.launchpad.net/yade/+question/691065

    Status: Answered => Open

Faqih Maarif is still having a problem:
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.
-----------------------------------------------------------------------------------------------------------------------------------------------------------

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.