differentiate between two material
Hi,
I have two materials (same material type, but with different size and density), defined as matPH101 and matCCS. I am simulating the swelling (radius) of these materials. Each material have different swelling rate (see def model in the code) and depending on their parameters (P_PH101 and P_CCS). I am updating each particle radius individually through a for loop with:
for b in O.bodies:
if isinstance(b.shape, Sphere):
My question is, how can I differentiate between each material, by adding an if statement. I would like have something like this:
for b in O.bodies:
if isinstance(b.shape, Sphere):
if materials is matCCS
elif materials is matPH101
I have parts of my code, I was sure which part to add. If you need more info please let me know.
Best regard,
Mithu
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
readParamsFromT
from yade.params.table import *
import scipy.spatial
o = Omega()
save=save
# Physical parameters
fr = 0.41
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
if save==0:
g=-9.81
elif save==1:
g=0
o.dt = 1.0e-8
particleMass_PH101 = (4.0/3.
particleMass_CCS = (4.0/3.
m_tab_PH101=
m_tab_CCS=
tab_no_
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.
v_1mm=math.
no_p_PH101=
no_p_CCS=
PhiF1=0.999
#PhiF1 = DeltaPMax*
Cyl_height=0.006
cross_area=
Comp_press_up= comp_press
Comp_force_
Comp_press_lp= comp_press
Comp_force_
#******
compression_
sc_por_15=2
#sc_por_2=2
#sc_por_1=1
rho_mix=
data_to_
compression_
# Add material
matPH101 = O.materials.
matCCS = O.materials.
# Spheres for compression and walls
sp=pack.
sp.makeCloud(
n1 = len(sp)
sp.makeCloud(
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.
##Single particle swelling model
def model(r,
Q=(
drdt =((Diff*
return drdt
P_PH101=
P_CCS=[3.16, rho_CCS, 1000, 739.75e-12]
def ParticleSwelling():
time_
if wCCS==0.02:
elif wCCS==0.05:
elif wCCS==0.08:
Liq_
print(Liq_pos)
print(
radius=[]
fw=[]
z_min=
radius.
for b in O.bodies:
if isinstance(b.shape, Sphere):
k=b.id
if Liq_pos>=par_pos:
if swell_t[0][k]==0:
t = np.linspace(0,time)
r = odeint(
if z_min>z_current:
elif Liq_pos<par_pos:
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Mithushan Soundaranathan
- Solved:
- Last query:
- Last reply: