Yade with RedHat / AlmaLinu

Asked by Mithushan Soundaranathan

Hi,

I have been using Yade with Ubuntu until now, but I am moving to RedHat / AlmaLinux to use a HPC.
My code work perfectly fine in Ubuntu, however when I move to Redhat I am getting error message saying

'VTKRecorder', 'TwoPhaseFlowEngine' is not defined.

Does anyone have experience in using Yade with RedHat. The GUI is not visible in Redhat, can only use Batch mode.

Best regards,
Mithu

MWE

from __future__ import print_function
from yade import utils, plot, timing
from yade import pack
import pandas as pd
import numpy as np
from PIL import Image
from yade import pack, export
from scipy.interpolate import interp1d
from csv import writer
import os
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import csv
from matplotlib.pyplot import figure
from pylab import *
from scipy.optimize import curve_fit
readParamsFromTable(comp_press=0.812e8,h_tab=2.02,m_tab=0.2117, r_tab=5.015,wCCS=0.02,tab_porosity=22,tab_height=1,save=1,c_L=0.0014631)
from yade.params.table import *
import scipy.spatial
import statistics
import math

O = Omega()
save=save
# Physical parameters
fr_PH101 = 0.41
fr_CCS=0.69
rho_PH101 = 1561
rho_CCS =1403
D_PH101 = 7.9e-5
r1_PH101 = D_PH101/2
D_CCS = 5.4e-5
r1_CCS = D_CCS/2
#r2 = Diameter/2
k1 = 10000
kp = 140000
kc = k1 * 0.1
ks = k1 * 0.1
Chi1 = 0.34

O.dt = 1.0e-8
wCCS=wCCS
particleMass_PH101 = (4.0/3.0)*math.pi*r1_PH101*r1_PH101*r1_PH101*rho_PH101
particleMass_CCS = (4.0/3.0)*math.pi*r1_CCS*r1_CCS*r1_CCS*rho_CCS
m_tab_PH101=m_tab*1e-3*(1-wCCS)
m_tab_CCS=m_tab*1e-3*wCCS
tab_no_p_PH101=m_tab_PH101/particleMass_PH101
tab_no_p_CCS =m_tab_CCS /particleMass_CCS
Tab_rad=0.001
r_tab=r_tab*1e-3 #real size
h_tab=h_tab*1e-3
v_tab=math.pi*(r_tab**2)*h_tab
v_1mm=math.pi*(Tab_rad**2)*(1e-3)
no_p_PH101=(v_1mm/v_tab)*tab_no_p_PH101
no_p_CCS=(v_1mm/v_tab)*tab_no_p_CCS

PhiF1=0.999
#PhiF1 = DeltaPMax*(kp-k1)*(r1+r2)/(kp*2*r1*r2)

Cyl_height=0.006
cross_area=math.pi*(Tab_rad**2)

Comp_press_up= comp_press
Comp_force_up=Comp_press_up*cross_area

Comp_press_lp= comp_press
Comp_force_lp=Comp_press_lp*cross_area

compression_data_save=[]
sc_por_15=2
rho_mix=((wCCS/rho_CCS)+((1-wCCS)/rho_PH101))**-1
data_to_save=[comp_press/1e6,round(no_p_PH101)+round(no_p_CCS),rho_mix]
compression_data_save.append(data_to_save)

# Add material
matPH101 = O.materials.append(LudingMat(frictionAngle=fr_PH101, density=rho_PH101, k1=k1, kp=kp, ks=ks, kc=kc, PhiF=PhiF1, G0 = 0.0))
matCCS = O.materials.append(LudingMat(frictionAngle=fr_CCS, density=rho_CCS, k1=k1, kp=kp, ks=ks, kc=kc, PhiF=PhiF1, G0 = 0.0))
walls1_mat=O.materials.append(FrictMat(young=1.e6,poisson=0.5,frictionAngle=0,density=0,label='walls1_mat1'))

##walls for flow engines#
mn,mx,ml=Vector3(-3*Tab_rad,-3*Tab_rad,-Cyl_height),Vector3(3*Tab_rad,3*Tab_rad,Cyl_height),Vector3(3*Tab_rad,3*Tab_rad,Cyl_height)
walls=aabbWalls([mn,mx],thickness=0,oversizeFactor=40, material=walls1_mat)
wallIds=O.bodies.append(walls)

# Spheres for compression and walls
sp=pack.SpherePack()
sp.makeCloud((-8*D_PH101,-8*D_PH101,-35*D_PH101),(8*D_PH101,8*D_PH101,35.0*D_PH101), rMean=r1_PH101,rRelFuzz=0.18,num=round(no_p_PH101))
n1 = len(sp)
sp.makeCloud((-8*D_PH101,-8*D_PH101,-35*D_PH101),(8*D_PH101,8*D_PH101,35.0*D_PH101), rMean=r1_CCS,rRelFuzz=0.15,num=round(no_p_CCS))
for i,(c,r) in enumerate(sp):
    mat = matPH101 if i < n1 else matCCS
    color = (0,1,1) if i < n1 else (1,0,1)
    O.bodies.append(sphere(c,r,material=mat,color=color))
die=O.bodies.append(yade.geom.facetCylinder((0,0,0),radius=Tab_rad,height=Cyl_height,segmentsNumber=20,wallMask=6,material=matPH101))

base_filename='vtkRecorder_'+str(wCCS)
vtkRecorder = VTKRecorder(fileName=os.path.join(path_save,'vtk_files',base_filename),recorders=['all'])

# Add engines
O.engines = [
  ForceResetter(),
  InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.05),
                         Bo1_Wall_Aabb(),
                         Bo1_Facet_Aabb()
                         ]),
  InteractionLoop(
    [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.05),
     Ig2_Facet_Sphere_ScGeom(),
     Ig2_Wall_Sphere_ScGeom()],
    [Ip2_LudingMat_LudingMat_LudingPhys()],
    [Law2_ScGeom_LudingPhys_Basic()]
  ),
  NewtonIntegrator(damping=0.1, gravity=[0, 0, -9.81]),
  PyRunner(command='checkForce()', realPeriod=1, label="fCheck"),
  TwoPhaseFlowEngine(dead=1,label="flow"),
]

def checkForce():
    if O.iter < 4000000:
        return
    if unbalancedForce() > 1:
        return
    global upper_punch
    upper_punch=O.bodies.append(geom.facetCylinder((0,0,((-Cyl_height/2)+0.0001)+utils.aabbDim()[2]),Tab_rad-.00001,0,segmentsNumber=50,wallMask=1,material=matPH101))
    for i in upper_punch:
        body= O.bodies[i]
        body.state.vel = (0,0,-0.02)
    global lower_punch
    lower_punch=O.bodies.append(geom.facetCylinder((0,0,(-Cyl_height/2)-0.0001),Tab_rad-.00001,0,segmentsNumber=50,wallMask=1,material=matPH101))
    for n in lower_punch:
        body= O.bodies[n]
        body.state.vel = (0,0,0.02)
    O.engines = O.engines + [PyRunner(command='storeData_Compaction()', iterPeriod=1000)]+ [PyRunner(command='saveData_Compaction()', iterPeriod=100000)]
    fCheck.command = 'unloadPlate()'

def unloadPlate():
    force_up=0
    for i in upper_punch:
        body= O.bodies[i]
        force_up=force_up+abs(O.forces.f(body.id)[2])
    force_lp=0
    for n in lower_punch:
        body = O.bodies[n]
        force_lp = force_lp + abs(O.forces.f(body.id)[2])
    if ((force_up > Comp_force_up) and (force_lp > Comp_force_lp)):
        for i in upper_punch:
            body= O.bodies[i]
            body.state.vel = (0,0,0.04)
        for n in lower_punch:
            body= O.bodies[n]
            body.state.vel = (0,0,-0.04)
        fCheck.command = 'stopUnloading()'

def stopUnloading():
    force_lp=0
    for n in lower_punch:
        body = O.bodies[n]
        force_lp = force_lp + abs(O.forces.f(body.id)[2])
    if force_lp==0:
        for i in lower_punch:
            body= O.bodies[i]
            body.state.vel = (0,0,0)
    #if ((force_up==0) and (force_lp==0)):
    for i in upper_punch:
        body=O.bodies[i]
        pos_up=body.state.pos
    for i in lower_punch:
        body=O.bodies[i]
        pos_lp=body.state.pos
    if pos_up[2]> pos_lp[2]+utils.aabbDim()[2]+0.0002:
        for j in upper_punch: O.bodies.erase(j)
        for j in lower_punch: O.bodies.erase(j)
        for b in O.bodies:
            if isinstance(b.shape, Sphere):
                continue
            elif b.id<max(wallIds)+1:
                continue
            else:
                O.bodies.erase(b.id)
        for b in O.bodies:
            if isinstance(b.shape, Sphere):
                r=b.shape.radius
                oldm=b.state.mass
                oldI=b.state.inertia

                m=oldm*3./4./r
                b.state.mass=m

                b.state.inertia[0] = 15./16./r*oldI[0]
                b.state.inertia[1] = 15./16./r*oldI[1]
                b.state.inertia[2] = 15./16./r*oldI[2]
            elif b.id<max(wallIds)+1:
                continue

Question information

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

Hi,

> 'VTKRecorder', 'TwoPhaseFlowEngine' is not defined.

Apparently, you disabled them at compile time.
Please post the output of cmake command if you are not sure.

On HPC, best option is to use system images if Singularity is available.

Bruno

Can you help with this problem?

Provide an answer of your own, or ask Mithushan Soundaranathan for more information if necessary.

To post a message you must log in.