Skip to content

Commit

Permalink
various mechanical options
Browse files Browse the repository at this point in the history
  • Loading branch information
Ombrini committed Feb 9, 2024
1 parent 7368ef4 commit 715dcb3
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 130 deletions.
30 changes: 17 additions & 13 deletions configs/params_system_LFP_2D.cfg
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
[Sim Params]
profileType = CV
Crate = 5
tramp = 0
Vmax = 6.0
Vmin = 3.1
Vset = 3.6
profileType = CCsegments
Crate = 3
tramp = 0.01
Vmax = 5
Vmin = 2.8
Vset = 3.5
power = 1
segments = [(0,10)]
# segments = [(3,19),(0,1),(-3,20)]
# segments = [(0.05,1100)]
# segments = [(0,5),(0.1,540)]
# segments = [(0,5),(3,20)]
segments = [(5,11)]
prevDir = false
tend = 300
tsteps = 200
relTol = 1e-7
absTol = 1e-7
tend = 5000
tsteps = 300
relTol = 1e-5
absTol = 1e-5
T = 298
nonisothermal = false
randomSeed = true
Expand All @@ -37,13 +41,13 @@ k0_foil = 8
Rfilm_foil = 0

[Particles]
mean_c = 50e-9
mean_c = 100e-9
stddev_c = 0e-9
mean_a = 100e-9
stddev_a = 1e-9
specified_psd_c = False
specified_psd_a = False
cs0_c = 0.99
cs0_c = 0.01
cs0_a = 0.99

[Conductivity]
Expand Down
1 change: 1 addition & 0 deletions mpet/config/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def tobool(value):
'Dfunc': str,
Optional('Mfunc', default=None): str,
Optional('Mfunc_filename', default=None): str,
Optional('meta', default=False): Use(tobool),
Optional('Epsfunc', default=None): str,
Optional('Epsfunc_filename', default=None): str,
Optional('E_D', default=0.): Use(float),
Expand Down
15 changes: 8 additions & 7 deletions mpet/electrode/materials/LiFePO42D.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,24 @@ def LiFePO42D(self, c_mat, ybar, T, muR_ref):
# regular solution
# muR = T*np.log(c_mat/(1- defect_mat -c_mat)) + self.get_trode_param("Omega_a")*(1- defect_mat -2*c_mat)
muR = mu(c_mat, defect_mat, L_Li,T)
b = 0.3
pi = 3.14159
a = -0.11
phi = -700
muR_meta_1 = a*20*pi*np.cos(pi*c_mat-b)*(np.sin(pi*c_mat-b))**19
muR_meta_2 = phi*6*((c_mat*(1-c_mat))**5)*(1-2*c_mat)
muR += 0*(muR_meta_1 + muR_meta_2)
if self.get_trode_param("meta"):
b = 0.1
pi = 3.14159
a = -0.05
muR_meta_1 = a*20*pi*np.cos(pi*(c_mat-b))*(np.sin(pi*(c_mat-b)))**19
muR += muR_meta_1

# non-homogeneous
muR += -self.get_trode_param("kappa_x")*curvx - self.get_trode_param("kappa_y")*curvy

if self.get_trode_param("mechanics") == False:
y_vert_avg = np.average(c_mat, axis=1)
y_oriz_avg = np.average(c_mat, axis=0)
muR += self.get_trode_param("Bx")*np.subtract(c_mat,y_oriz_avg)
for i in np.arange(Nx):
y = c_mat[i,:]
muR[i,:] += self.get_trode_param("By")*(y - y_vert_avg[i])

actR_mat = np.exp(muR/T)
muR += muRtheta + muR_ref
return muR, actR_mat
59 changes: 0 additions & 59 deletions mpet/electrode/materials/LiFePO42D_aniso.py

This file was deleted.

44 changes: 0 additions & 44 deletions mpet/electrode/mechanics/mech_LiFePO4.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,6 @@
import numpy as np

def mech_LiFePO4():
# FePo4 elastic constants (GPa)
c11 = 157.4
c22 = 175.8
c33 = 154
c44 = 37.8
c55 = 49.05
c66 = 51.6
c13 = 51.2
c12 = 53.35
c23 = 32.7

# c11 = 175.9
# c22 = 153.6
# c33 = 135.0
# c44 = 38.8
# c55 = 47.5
# c66 = 55.6
# c13 = 54.0
# c12 = 29.6
# c23 = 19.6

# Cij = np.array([
# [c11, c12, c13, 0, 0, 0],
# [c12, c22, c23, 0, 0, 0],
# [c13, c23, c33, 0, 0, 0],
# [0, 0, 0, c44, 0, 0],
# [0, 0, 0, 0, c55, 0],
# [0, 0, 0, 0, 0, c66]
# ])

# strain
# e01 = 0.0517
# e02 = 0.0359
# e03 = -0.0186
e01 = 0.05
e02 = 0.028
e03 = -0.025

# strain_tensor = np.array([
# [e01, 0, 0],
# [0, e02, 0],
# [0, 0, e03]
# ])

# rotatated -45 degrees
Cij = np.array([
[152.5, 43, 54.4, 0, 0.85, 0],
Expand Down
41 changes: 41 additions & 0 deletions mpet/electrode/mechanics/mech_LiFePO4_100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import numpy as np

def mech_LiFePO4_100():
# FePo4 elastic constants (GPa)
c11 = 157.4
c22 = 175.8
c33 = 154
c44 = 37.8
c55 = 49.05
c66 = 51.6
c13 = 51.2
c12 = 53.35
c23 = 32.7

Cij = np.array([
[c11, c12, c13, 0, 0, 0],
[c12, c22, c23, 0, 0, 0],
[c13, c23, c33, 0, 0, 0],
[0, 0, 0, c44, 0, 0],
[0, 0, 0, 0, c55, 0],
[0, 0, 0, 0, 0, c66]
])

# strain
# e01 = 0.0517
# e02 = 0.0359
# e03 = -0.0186
e01 = 0.05
e02 = 0.028
e03 = -0.025

strain_tensor = np.array([
[e01, 0, 0],
[0, e02, 0],
[0, 0, e03]
])

e0 = np.array([strain_tensor[0,0], strain_tensor[1,1], strain_tensor[2,2],
strain_tensor[1,2], strain_tensor[0,2], strain_tensor[0,1]])

return Cij*1e9, e0
23 changes: 23 additions & 0 deletions mpet/electrode/mechanics/mech_LiFePO4_minus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import numpy as np

def mech_LiFePO4_minus():
# rotatated -45 degrees
Cij = np.array([
[152.5, 43, 54.4, 0, -0.85, 0],
[43, 175.8, 43, 0, -10.32, 0],
[54.4, 43, 152.5, 0, -0.85, 0],
[0, 0, 0, 44.7, 0, 6.9],
[-0.85,-10.32,-0.85, 0, 52.25, 0],
[0, 0, 0, 6.9, 0, 44.7]
])

strain_tensor = np.array([
[0.0125, 0, -0.0375],
[0, 0.028, 0],
[-0.0375, 0, 0.0125]
])

e0 = np.array([strain_tensor[0,0], strain_tensor[1,1], strain_tensor[2,2],
strain_tensor[1,2], strain_tensor[0,2], strain_tensor[0,1]])

return Cij*1e9, e0
9 changes: 9 additions & 0 deletions mpet/electrode/mechanics/tanh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import numpy as np

def tanh(e,c):
coeff = 3
eps_a = np.tanh(coeff*(c-0.5))
eps_0 = np.tanh(coeff*(-0.5))
eps_1 = np.tanh(coeff*(0.5))
eps = (eps_a-eps_0)/(eps_1-eps_0)
return e*eps
20 changes: 14 additions & 6 deletions mpet/mod_electrodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def sld_dynamics_2D1var(self, c_mat, muO, act_lyte, noise):
else:
Flux_bc = -self.Rxn(k)*self.get_trode_param("delta_L")

Flux_vec = calc_flux_CHR_2D(c_vec, muR_vec, self.get_trode_param("D"), Dfunc,
Flux_vec = calc_flux_CHR_2D(c_vec, 0, muR_vec, self.get_trode_param("D"), Dfunc,
self.get_trode_param("E_D"), Flux_bc, dr,
self.T_lyte(), noise)
if self.get_trode_param("shape") == "plate":
Expand Down Expand Up @@ -903,9 +903,9 @@ def calc_flux_CHR_2D(c, str, mu, D, Dfunc, E_D, Flux_bc, dr, T, noise):
Flux_vec[0] = 0
Flux_vec[-1] = Flux_bc
c_edges = utils.mean_linear(c)
str_vert_edges = utils.mean_linear(str[:,1])
str_a = utils.mean_linear(str[:,0])
str_c = utils.mean_linear(str[:,2])
# str_vert_edges = utils.mean_linear(str[:,1])
# str_a = utils.mean_linear(str[:,0])
# str_c = utils.mean_linear(str[:,2])
# D_of_c_eps = D*(c_edges*(1-c_edges))*np.exp(100*str_vert_edges)
# D_of_c_eps = D*(c_edges*(1-c_edges))*np.exp(100*0.04*c_edges)
D_of_c_eps = D*(c_edges*(1-c_edges))
Expand Down Expand Up @@ -974,7 +974,7 @@ def calc_muR_el(c_mat, u_x, u_y, conf, trode, ind, Mfunc, Epsfunc):
# pier symm
Nx = np.size(c_mat, 0)
Ny = np.size(c_mat, 1)
dxs = 1./(Nx)
dxs = 1./(Nx-2)
dys = 1./(Ny-1)

max_conc = conf[trode, "rho_s"]
Expand All @@ -998,11 +998,15 @@ def calc_muR_el(c_mat, u_x, u_y, conf, trode, ind, Mfunc, Epsfunc):
e1 = e1_tmp[:,1:] # Nx-2, Ny-1

e2_tmp = np.diff(u_y_tmp, axis=1)/dys # Nx-1, Ny-1
# e2_tmp[:,0] = e2_tmp[:,0]*2
# e2_tmp[:,-1] = e2_tmp[:,-1]*2
e2 = e2_tmp[1:-1,:] # Nx-2, Ny-1

duydx_tmp = np.diff(u_y_tmp[:,1:], axis=0)/dxs # Nx-1, Ny -1
duydx = 0.5*(duydx_tmp[1:,:] + duydx_tmp[:-1,:]) # Nx-2, Ny -1
duxdy_tmp = np.diff(u_x_tmp, axis=1)/dys # Nx-2, Ny-1
# duxdy_tmp[0,:] = duxdy_tmp[0,:]*2
# duxdy_tmp[-1,:] = duxdy_tmp[-1,:]*2
duxdy = 0.5*(duxdy_tmp[1:,:] + duxdy_tmp[:-1,:]) # Nx-2, Ny-1
e12 = 0.5*(duydx + duxdy) # Nx-2 , Ny-1

Expand All @@ -1022,7 +1026,7 @@ def calc_muR_el(c_mat, u_x, u_y, conf, trode, ind, Mfunc, Epsfunc):
e_mat[i,j,:] = np.array([e1[i,j]- Epsfunc(e0[0],c_mat[i+1,j]),
e2[i,j]- Epsfunc(e0[1],c_mat[i+1,j]),
0,
0 - Epsfunc(e0[3],c_mat[i+1,j]),
0 - Epsfunc(e0[3],c_mat[i+1,j]),
0 - Epsfunc(e0[4],c_mat[i+1,j]),
e12[i,j]- Epsfunc(e0[5],c_mat[i+1,j])
])
Expand Down Expand Up @@ -1051,12 +1055,16 @@ def div_stress(sigma_mat_temp, Nx, Ny):
dsigma1dx_mat = 0.5*(dsigma1dx_mat_tmp[1:,:] + dsigma1dx_mat_tmp[:-1,:]) # Nx-2, Ny-1

dsigma2dy_mat_tmp = np.diff(sigma_mat_temp[:,:,1], axis=1)/dys # Nx, Ny-1
# dsigma2dy_mat_tmp[:,0] = dsigma2dy_mat_tmp[:,0]*2
# dsigma2dy_mat_tmp[:,-1] = dsigma2dy_mat_tmp[:,-1]*2
dsigma2dy_mat = dsigma2dy_mat_tmp[1:-1,:] # Nx-2, Ny-1

dsigma12dx_mat_tmp = np.diff(sigma_mat_temp[:,:-1,3], axis=0)/dxs # Nx, Ny -1
dsigma12dx_mat = 0.5*(dsigma12dx_mat_tmp[1:,:]+dsigma12dx_mat_tmp[:-1,:]) # Nx-2, Ny-1

dsigma12dy_mat_tmp = np.diff(sigma_mat_temp[:,:,3], axis=1)/dys # Nx, Ny-1
# dsigma12dy_mat_tmp[:,0] = dsigma12dy_mat_tmp[:,0]*2
# dsigma12dy_mat_tmp[:,-1] = dsigma12dy_mat_tmp[:,-1]*2
dsigma12dy_mat = dsigma12dy_mat_tmp[1:-1,:] # Nx-2, Ny-1

div_stress_mat = np.zeros((Nx-2,Ny-1,2), dtype=object)
Expand Down
2 changes: 1 addition & 1 deletion mpet/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def SetUpVariables(self):
# e02 = 0.0359
e01 = 0.0125
e02 = 0.028
dxs = 1/Nij
dxs = 1/(Nij-2)
dys = 1/(N_ver_ij-1)
u_x_tmp = np.zeros((Nij-2,N_ver_ij-1))
u_y_tmp = np.zeros((Nij-2,N_ver_ij-1))
Expand Down

0 comments on commit 715dcb3

Please sign in to comment.