コード例 #1
0
ファイル: meso_unitcell.py プロジェクト: jgd10/Python_Scripts
import pySALESetup as pss
import time


vol_frac   = .55
X_cells    = 500 
Y_cells    = 500 
PR         = 0.
cppr       = 8 
vfraclimit = .495                               # The changeover point from random to forced contacts. > 1.0 => least contacts; = 0. Max contacts
x_length   = 1.e-3
y_length   = 1.e-3
GRIDSPC    = x_length/X_cells
mat_no     = 5

pss.generate_mesh(X_cells,Y_cells,mat_no,cppr,PR,vol_frac)
mats = pss.mats

part_area  = np.zeros((1))
cppr_range = pss.cppr_max - pss.cppr_min
r = pss.cppr_mid
pss.mesh_Shps[0,:,:],part_area[0] = pss.gen_circle(r)

lx, ly = 35., 35.
UC = pss.unit_cell(LX=lx,LY=ly)
N  = 5
UCX  = np.array([0.,lx,lx,0.,lx/2.])
UCY  = np.array([0.,0.,ly,ly,ly/2.])
MATS = np.array([1.,1.,1.,1.,1.])
RAD  = np.array([8.,8.,8.,8.,8.])
コード例 #2
0
import matplotlib.pyplot as plt
import pySALESetup as pss
import time

vol_frac = .55
X_cells = 500
Y_cells = 500
PR = 0.
cppr = 8
vfraclimit = .495  # The changeover point from random to forced contacts. > 1.0 => least contacts; = 0. Max contacts
x_length = 1.e-3
y_length = 1.e-3
GRIDSPC = x_length / X_cells
mat_no = 5

pss.generate_mesh(X_cells, Y_cells, mat_no, cppr, PR, vol_frac)
mats = pss.mats

part_area = np.zeros((1))
cppr_range = pss.cppr_max - pss.cppr_min
r = pss.cppr_mid
pss.mesh_Shps[0, :, :], part_area[0] = pss.gen_circle(r)

lx, ly = 35., 35.
UC = pss.unit_cell(LX=lx, LY=ly)
N = 5
UCX = np.array([0., lx, lx, 0., lx / 2.])
UCY = np.array([0., 0., ly, ly, ly / 2.])
MATS = np.array([1., 1., 1., 1., 1.])
RAD = np.array([8., 8., 8., 8., 8.])
コード例 #3
0
ファイル: meso_john.py プロジェクト: tmdavison/Python_Scripts
import matplotlib.pyplot as plt
import pySALESetup as pss

# Define details of the particle bed
vol_frac = .5  ### default 0.5
X_cells = 500  ### defaults = 500
Y_cells = 500
PR = 0.  ### default = 0.1, have to increase to cover the high eccen. shapes
cppr = 20  ### default = 20
vfraclimit = 1.  # The changeover point from 'placed' to 'dropped' contacts. particles
x_length = 1.e-3
y_length = 1.e-3
GRIDSPC = x_length / X_cells  # Physical distance/cell
mat_no = 5

pss.generate_mesh(X_cells, Y_cells, mat_no, cppr, PR, vol_frac,
                  NS=cppr * 5)  # Generate & set up the mesh

n = pss.N  # n is the number of particles to generated as a 'library' to be placed into the mesh
ns = pss.Ns  ### added ns

######################################## generate mesh_Shps for each eccentricity, and add it into the mesh_Shps_list #####################################

axis_ratios = np.array(
    [2.5, 2., 1.5,
     1.])  ### list semi-major/semi-minor axis ratios (must be float)
# numpy arrays are defined as np.array([...]) and not np.array((...))

eccen_list = np.sqrt(1 - (1 / np.square(axis_ratios))
                     )  ### calculate list of eccentricities from axis ratios
n_eccen = np.size(eccen_list)  ### number of eccentricities
# length works, but it is better to use size IMO as size is for numpy arrays and len for lists
コード例 #4
0
    y = .3e-3*np.sin(theta) + off_set
    return y
    

L_cells    = 500 				# T - Transverse, L - Longitudinal
T_cells    = 500 
#L_cells    = 100 				# T - Transverse, L - Longitudinal
#T_cells    = 407 
r = 8
T_length   = 10.e-3
L_length   = 10.e-3
GRIDSPC    = T_length/T_cells
print GRIDSPC


pss.generate_mesh(L_cells,T_cells,CPPR=r,mat_no=5,GridSpc=GRIDSPC)
mats = pss.mats
mats = mats.astype(int)

Cu2_T1 = 0.e-3
Cu2_T2 = 10.0e-3
Cu2_L1 = 1.3e-3
Cu2_L2 = 2.6e-3
pss.fill_sinusoid(Cu2_L1,Cu2_T1,func,Cu2_T2,mats[0],mixed=True)

Cu1_T1 = 0.
Cu1_T2 = 10.e-3
Cu1_L1 = 0.
Cu1_L2 = 1.3e-3
pss.fill_rectangle(Cu1_L1,Cu1_T1,Cu1_L2,Cu1_T2,mats[0])
コード例 #5
0
    off_set = 2.5e-3
    theta = 2.0 * np.pi * x / 2.0e-3
    y = 0.3e-3 * np.cos(theta) + off_set
    return y


L_cells = 1000  # T - Transverse, L - Longitudinal
T_cells = 300
# L_cells    = 100 				# T - Transverse, L - Longitudinal
# T_cells    = 407
r = 8
T_length = 3.0e-3
L_length = 10.0e-3
GRIDSPC = T_length / T_cells
print GRIDSPC
pss.generate_mesh(L_cells, T_cells, CPPR=r, mat_no=5, GridSpc=GRIDSPC)
mats = pss.mats
mats = mats.astype(int)
"""
Cu1_T1 = 0.
Cu1_T2 = 10.e-3
Cu1_L1 = 0.
Cu1_L2 = 1.3e-3
pss.fill_rectangle(Cu1_L1,Cu1_T1,Cu1_L2,Cu1_T2,mats[0])


Al1_T1 = 6.55e-3
Al1_T2 = 7.7e-3
Al1_L1 = 1.3e-3
Al1_L2 = 13.5e-3
pss.fill_rectangle(Al1_L1,Al1_T1,Al1_L2,Al1_T2,mats[1])
コード例 #6
0
import numpy as np
import random
import matplotlib.pyplot as plt

vol_frac   = .3
X_cells    = 500 
Y_cells    = 500 
x_length   = 1.e-3                                                  # Transverse width of bed
y_length   = 1.e-3                                                  # Longitudinal width of bed
PR         = 0.                                                     # Particle size range (as a fraction)
cppr       = 20                                                     # Cells per particle radius
GRIDSPC    = x_length/X_cells                                       # Physical distance/cell
mat_no     = 5


pss.generate_mesh(X=X_cells,Y=Y_cells,mat_no=mat_no,CPPR=cppr,pr=PR,VF=vol_frac,GridSpc=GRIDSPC) 

n = pss.N                                                           # n is the number of particles to generated for the 'library' which can be selected from this and placed into the mesh
part_area  = np.zeros((n))                                          # N.B. particles can (and likely will) be placed more than once
part_radii = np.linspace(pss.cppr_min,pss.cppr_max,n)               # part_area and part_radii are arrays to contain the area and radii of the 'library' particles
                                                                    # if PR is non-zero then a range of radii will be generated

for i in range(n):                                                                      
    pss.mesh_Shps[i,:,:] = pss.gen_circle(part_radii[i])            # Generate a circle and store it in mesh_Shps (an array of meshes) 
    part_area[i]         = np.sum(pss.mesh_Shps[i,:,:])             # Record the shape's area


A_        = []                                                      # Generate empty lists to store the area
xc        = []                                                      # x coord
yc        = []                                                      # y coord
I_        = []                                                      # Library index
コード例 #7
0
import matplotlib.pyplot as plt

vol_frac = .3
X_cells = 500
Y_cells = 500
x_length = 1.e-3  # Transverse width of bed
y_length = 1.e-3  # Longitudinal width of bed
PR = 0.  # Particle size range (as a fraction)
cppr = 20  # Cells per particle radius
GRIDSPC = x_length / X_cells  # Physical distance/cell
mat_no = 5

pss.generate_mesh(X=X_cells,
                  Y=Y_cells,
                  mat_no=mat_no,
                  CPPR=cppr,
                  pr=PR,
                  VF=vol_frac,
                  GridSpc=GRIDSPC)

n = pss.N  # n is the number of particles to generated for the 'library' which can be selected from this and placed into the mesh
part_area = np.zeros(
    (n))  # N.B. particles can (and likely will) be placed more than once
part_radii = np.linspace(
    pss.cppr_min, pss.cppr_max, n
)  # part_area and part_radii are arrays to contain the area and radii of the 'library' particles
# if PR is non-zero then a range of radii will be generated

for i in range(n):
    pss.mesh_Shps[i, :, :] = pss.gen_circle(
        part_radii[i]
コード例 #8
0
import random
import matplotlib.pyplot as plt
import pySALESetup as pss
import time


X_cells    = 1000 
Y_cells    = 1000 
vfraclimit = .5                               # The changeover point from random to forced contacts. > 1.0 => least contacts; = 0. Max contacts
x_length   = 1.e-3
y_length   = 1.e-3
GRIDSPC    = x_length/X_cells
mat_no     = 5
CPPR = 24

pss.generate_mesh(X_cells,Y_cells,mat_no,CPPR=24)
mats = pss.mats

pss.N = 10                                 # Particles can be placed MORE than once!
MM = pss.Ms
ii = 0
n = pss.N
part_radii = []
pss.mesh_Shps[0,:,:] = pss.gen_shape_fromtxt('../grain_library/grain_aspect-1.026_mesh.txt')
pss.mesh_Shps[1,:,:] = pss.gen_shape_fromtxt('../grain_library/grain_aspect-1.085_mesh.txt')
pss.mesh_Shps[2,:,:] = pss.gen_shape_fromtxt('../grain_library/grain_aspect-2.005_mesh.txt')
pss.mesh_Shps[3,:,:] = pss.gen_shape_fromtxt('../grain_library/grain_aspect-1.516_mesh.txt')
pss.mesh_Shps[4,:,:] = pss.gen_shape_fromtxt('../grain_library/grain_aspect-1.249_mesh.txt')

pss.mesh_Shps[5,:,:] = pss.gen_shape_fromtxt('../grain_library/grain_aspect-1.158_mesh.txt')
pss.mesh_Shps[6,:,:] = pss.gen_shape_fromtxt('../grain_library/grain_aspect-1.834_mesh.txt')
コード例 #9
0
import pySALESetup as pss
import numpy as np
import scipy.spatial as scsp
import scipy as sc
import random
import matplotlib.pyplot as plt
import time


L_cells    = 1000 				# T - Transverse, L - Longitudinal
T_cells    = 400 
T_length   = 200.e-6
L_length   = 500.e-6
GRIDSPC    = L_length/L_cells

pss.generate_mesh(L_cells,T_cells,mat_no=1)
mats = pss.mats

X1 = np.arange(0.,100.,2.)
Y1 = X1*25./100.
Y1 = Y1[::-1]

X2 = np.arange(0.,101.,2.)
Y2 = X2*25./100.
X2+= 100.

X  = np.append(X1,X2)
Y  = np.append(Y1,Y2)

Y += 37.5
コード例 #10
0
import pySALESetup as pss
import numpy as np
import scipy.spatial as scsp
import scipy as sc
import random
import matplotlib.pyplot as plt
import time

T_length = .5e-3
L_length = 1.e-3
GRIDSPC = 2.e-5
T_cells = int(T_length / GRIDSPC)
L_cells = int(L_length / GRIDSPC)  # T - Transverse, L - Longitudinal

pss.generate_mesh(L_cells, T_cells, mat_no=1, GS=GRIDSPC)
pss.mesh_Shps[0, :, :], part_area = pss.gen_circle(r)
mats = pss.mats

l1 = 0.5 * L_length
l2 = 0.9 * L_length
t1 = 0.1 * T_length
t2 = 0.9 * T_length

pss.fill_rectangle(l1, t1, l2, t2, mats[0])

plt.figure()
#plt.imshow(pss.mesh,interpolation='nearest',cmap='binary')
plt.imshow(pss.materials[0, :, :], interpolation='nearest', cmap='binary')
plt.show()

pss.save_general_mesh()
コード例 #11
0
ファイル: meso_base.py プロジェクト: jgd10/Python_Scripts
import matplotlib.pyplot as plt
import pySALESetup as pss

                                                                    # Define details of the particle bed 
vol_frac   = .5
X_cells    = 500 
Y_cells    = 500 
PR         = 0.
cppr       = 20
vfraclimit = 1.                                                     # The changeover point from 'placed' to 'dropped' contacts. particles
x_length   = 1.e-3
y_length   = 1.e-3
GRIDSPC    = x_length/X_cells                                       # Physical distance/cell
mat_no     = 5

pss.generate_mesh(X_cells,Y_cells,mat_no,cppr,PR,vol_frac)          # Generate & set up the mesh


n = pss.N                                                           # n is the number of particles to generated as a 'library' to be placed into the mesh
part_area  = np.zeros((n))                                          # N.B. particles can (and likely will) be placed more than once
part_radii = np.zeros((n))                                          # part_area and part_radii are arrays to contain the area and radii of the 'library' particles

for i in range(n):                                                  
    eccen = np.sqrt(8./9.)
    theta = random.random()*np.pi
    Rad   = cppr
    pss.mesh_Shps[i,:,:] = pss.gen_ellipse(Rad,theta,eccen)         # Generate an ellipse of radius: Rad, angled at theta, and with eccentricity: eccen.
    part_area[i]         = np.sum(pss.mesh_Shps[i,:,:])             # Record the shape's area
    part_radii[i]        = cppr                                     # Record the shape's radius (semi-major radius in this case)

コード例 #12
0
ファイル: meso_base.py プロジェクト: tmdavison/Python_Scripts
import matplotlib.pyplot as plt
import pySALESetup as pss

# Define details of the particle bed
vol_frac = .5
X_cells = 500
Y_cells = 500
PR = 0.
cppr = 20
vfraclimit = 1.  # The changeover point from 'placed' to 'dropped' contacts. particles
x_length = 1.e-3
y_length = 1.e-3
GRIDSPC = x_length / X_cells  # Physical distance/cell
mat_no = 5

pss.generate_mesh(X_cells, Y_cells, mat_no, cppr, PR,
                  vol_frac)  # Generate & set up the mesh

n = pss.N  # n is the number of particles to generated as a 'library' to be placed into the mesh
part_area = np.zeros(
    (n))  # N.B. particles can (and likely will) be placed more than once
part_radii = np.zeros(
    (n)
)  # part_area and part_radii are arrays to contain the area and radii of the 'library' particles

for i in range(n):
    eccen = np.sqrt(8. / 9.)
    theta = random.random() * np.pi
    Rad = cppr
    pss.mesh_Shps[i, :, :] = pss.gen_ellipse(
        Rad, theta, eccen
    )  # Generate an ellipse of radius: Rad, angled at theta, and with eccentricity: eccen.
コード例 #13
0
ファイル: plate.py プロジェクト: tmdavison/Python_Scripts
import pySALESetup as pss
import numpy as np
import scipy.spatial as scsp
import scipy as sc
import random
import matplotlib.pyplot as plt
import time

L_cells = 500  # T - Transverse, L - Longitudinal
T_cells = 200
T_length = 200.e-6
L_length = 500.e-6
GRIDSPC = L_length / L_cells

pss.generate_mesh(L_cells, T_cells, mat_no=1)
mats = pss.mats

pss.fill_plate(0., 50., mats[0])

pss.save_general_mesh()

fig, ax = plt.subplots()
cax = ax.imshow(pss.mesh,
                cmap='Greys',
                interpolation='nearest',
                vmin=0,
                vmax=1)
cbar = fig.colorbar(cax, orientation='horizontal')
plt.show()
コード例 #14
0
import pySALESetup as pss
import numpy as np
import scipy.spatial as scsp
import scipy as sc
import random
import matplotlib.pyplot as plt
import time


T_length   = .5e-3
L_length   = 1.e-3
GRIDSPC    = 2.e-5
T_cells    = int(T_length/GRIDSPC) 
L_cells    = int(L_length/GRIDSPC)	# T - Transverse, L - Longitudinal

pss.generate_mesh(L_cells,T_cells,mat_no=1,GS=GRIDSPC)
pss.mesh_Shps[0,:,:],part_area = pss.gen_circle(r)
mats = pss.mats

l1 = 0.5*L_length
l2 = 0.9*L_length
t1 = 0.1*T_length
t2 = 0.9*T_length

pss.fill_rectangle(l1,t1,l2,t2,mats[0])

plt.figure()
#plt.imshow(pss.mesh,interpolation='nearest',cmap='binary')
plt.imshow(pss.materials[0,:,:],interpolation='nearest',cmap='binary')
plt.show()