← Back to team overview

yade-users team mailing list archive

Re: [Question #689234]: How to export relative velocity of spheres to Paraview

 

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

    Status: Solved => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

I would like to export the function in vtk files as below. I adjust the body of function unlike the above you showed me.
But it shows me that "name i is not defined". How do I modify my code?
Thank you for your help again!

###
def weakeningTemp(interaction):
    heatCapacity = 900 # [J/kg*K]
    density = 2500 # [kg/m3]
    totalHeat = 0
    thermal_diff = 1.e-6
    shear_modulus = 22e9
    tau_c = 0.1*shear_modulus
    initialTemp = 20
    for i in O.interactions():
        if O.bodies[i.id1].isReal and  O.bodies[i.id2].isReal:
            penetrationDepth = i.geom.penetrationDepth                    
            radius1 = i.geom.refR1                                        
            radius2 = i.geom.refR2                                        
            effectiveRadius = (i.geom.refR1 * i.geom.refR2 )/( i.geom.refR1+i.geom.refR2  )         
            contactRadius = math.sqrt( i.geom.penetrationDepth *effectiveRadius)   

Cheers,
Chien-Cheng
            Da = 2 * contactRadius
            contactArea = np.pi*(contactRadius**2)                        
            relativeVelocity = i.geom.shearInc.norm()/O.dt                
            weakeningTemp = math.sqrt((relativeVelocity*Da)/(np.pi*thermal_diff))*tau_c/(density*heatCapacity) + initialTemp
    return weakeningTemp

builtins.weakeningTemp = weakeningTemp # such that VTKExporter has
access to it

vtk = export.VTKExporter("weakingTemp")
def vtkExport():
    vtk.exportSpheres(ids=list(range(2,len(O.bodies))),what=dict(weakeningTemp="weakeningTemp(i)"))

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