Files
LBPM/example/SingleCell/NaCl-cell.py

42 lines
1002 B
Python
Raw Normal View History

2022-04-08 16:44:37 -04:00
import numpy as np
import matplotlib.pylab as plt
2022-04-12 20:51:13 -04:00
Nx = 64
Ny = 64
Nz = 64
cx = Nx/2
cy = Ny/2
cz = Nz/2
radius = 12
D=np.ones((Nx,Ny,Nz),dtype="uint8")
for i in range(0, Nx):
for j in range (0, Ny):
for k in range (0,Nz):
2022-04-08 16:44:37 -04:00
dist = np.sqrt((i-cx)*(i-cx) + (j-cx)*(j-cx) + (k-cz)*(k-cz))
2022-04-12 20:51:13 -04:00
if (dist < radius ) :
2022-04-08 16:44:37 -04:00
D[i,j,k] = 2
2022-04-12 20:51:13 -04:00
D.tofile("cell_64x64x64.raw")
2022-04-08 16:44:37 -04:00
2022-04-12 20:51:13 -04:00
C1=np.zeros((Nx,Ny,Nz),dtype="double")
C2=np.zeros((Nx,Ny,Nz),dtype="double")
2022-04-08 16:44:37 -04:00
2022-04-12 20:51:13 -04:00
for i in range(0, Nx):
for j in range (0, Ny):
for k in range (0,Nz):
2022-04-08 16:44:37 -04:00
#outside the cell
C1[i,j,k] = 125.0e-6 # Na
C2[i,j,k] = 125.0e-6 # Cl
dist = np.sqrt((i-cx)*(i-cx) + (j-cx)*(j-cx) + (k-cz)*(k-cz))
# inside the cell
2022-04-12 20:51:13 -04:00
if (dist < radius ) :
C1[i,j,k] = 110.0e-6
C2[i,j,k] = 110.0e-6
2022-04-08 16:44:37 -04:00
2022-04-12 20:51:13 -04:00
C1.tofile("cell_concentration_Na_64x64x64.raw")
C2.tofile("cell_concentration_Cl_64x64x64.raw")
2022-04-08 16:44:37 -04:00