-
Hi, I want to simulate effect of heat transfer across Metal-Nonmetal Interface on femtosecond Laser. Here are the equations I want to solve from fipy import *
Lx=2.0e-7
dx=1.0e-10
nx=int(Lx/dx)
T=100e-12
dt=4e-15
I_0 = 1100
R = 0.982
delta = 12.23e-9
t_p = 100e-15
m=Grid1D(nx=nx, dx=dx)
x = m.cellCenters[0]
time = Variable(0.)
gold = (x <= Lx / 4.0)
chromium = (x >= Lx / 4.0 ) & ( x<= Lx/2.0)
metal = (x<= Lx/2.0)
nonmetal = (x>= Lx/2.0)
S = numerix.sqrt(4*numerix.log(2)/numerix.pi)*((1-R)*I_0/(t_p*delta))*numerix.exp(-(x/delta)-4*numerix.log(2)*((time-2*t_p)/t_p)**2)
T_e=CellVariable(name="Electron Temperature", mesh=m, value=300.0, hasOld=True )
T_p=CellVariable(name="Phonon Temperature", mesh=m, value=300.0, hasOld=True )
T_s=CellVariable(name="Non-metal Temperature", mesh=m, value=300.0, hasOld=True )
C_e = (68 * gold + 194 * chromium + 0 * nonmetal) * T_e
C_p = (2.5e6 * gold + 3.3e6 * chromium + 0 * nonmetal)
C_s = (0 * gold + 0 * chromium + 2e6 * nonmetal)
G_g = 0.21e17*((1.18e7/1.25e11)*(T_e+T_p)+1)
G_c = 4.2e17*((7.9e7/13.4e11)*(T_e+T_p)+1)
K_eg = 318*(1.25e11*T_e/(1.18e7*T_e**2+1.25e11*T_p))
K_ec = 95*(13.4e11*T_e/(7.9e7*T_e**2+13.4e11*T_p))
K_e = K_eg * gold + K_ec * chromium + 0 * nonmetal
K_s = (0 * gold + 0 * chromium + 10 * nonmetal)
G = G_g * gold + G_c * chromium + 0 * nonmetal
M=1e10 # taking R_es=R_ps=1e10
eq_e=TransientTerm ( coeff= C_e , var=T_e) == DiffusionTerm (coeff=K_e, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_e) + ImplicitSourceTerm (coeff=G, var=T_p) + S * gold
eq_p=TransientTerm ( coeff= C_p , var=T_p) == DiffusionTerm (coeff=(0.01 * K_e ) , var=T_p) + ImplicitSourceTerm (coeff=G, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_p)
eq_s=TransientTerm ( coeff= C_s , var=T_s) == DiffusionTerm (coeff=K_s, var=T_s) + ImplicitSourceTerm (coeff= M * nonmetal, var=T_e) - ImplicitSourceTerm (coeff= M * nonmetal, var=T_s) + ImplicitSourceTerm (coeff= M * nonmetal, var=T_p) - ImplicitSourceTerm (coeff=M * nonmetal, var=T_s)
eq=eq_e & eq_p & eq_s
solver = LinearPCGSolver(precon=None, tolerance=1e-10, iterations=2000)
while time()<T:
T_e.updateOld()
T_p.updateOld()
T_s.updateOld()
for i in range(10):
res=eq.sweep(dt=dt, solver=solver)
time.setValue(time() + dt) The problem is when I solve those equations for 100 ps the temperature of non-metal substrate does not change. What should I do ? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 7 replies
-
Why would Several issues beyond that:
|
Beta Was this translation helpful? Give feedback.
-
Yes Sir, the non-metal temperature T_s does change but it is significantly small , it is in 1e-7 range but it should be in range of 1e1 to 1e2 . So I think I wrote third equation wrong. How to implement this conditions from fipy.solvers import LinearPCGSolver |
Beta Was this translation helpful? Give feedback.
-
Yes , according to your suggestion I rewrote the code and I understand that the boundary condition is internal robin condition. I rewrote the the boundary condition as such from fipy import *
from fipy.solvers import LinearPCGSolver
Lx=2.0e-7
dx=1.0e-10
nx=int(Lx/dx)
T=30e-12
dt=4e-15
I_0 = 50
R = 0.359
delta = 115e-9
t_p = 200e-15
m=Grid1D(nx=nx, dx=dx)
x = m.cellCenters[0]
X = m.faceCenters[0]
time = Variable(0.)
gold = (x < Lx / 2.0)
interface = ( X >= Lx/2.0)
nonmetal = (x > Lx /2.0 )
S = numerix.sqrt(4*numerix.log(2)/numerix.pi)*((1-R)*I_0/(t_p*delta*(1-numerix.exp(-Lx/(2.0*delta)))))*numerix.exp(-(x/delta)-4*numerix.log(2)*((time-2.0*t_p)/t_p)**2)
T_e=CellVariable(name="Electron Temperature", mesh=m, value=300.0, hasOld=True )
T_p=CellVariable(name="Phonon Temperature", mesh=m, value=300.0, hasOld=True )
T_s=CellVariable(name="Non-metal Temperature", mesh=m, value=300.0, hasOld=True )
C_e = 68 * T_e
C_p = 2.5e6
C_s = 1.6e6
G_g = 1.5e16*((1.2e7/3.6e11)*(T_e+T_p)+1)
Theta_e=T_e/6.42e4
Theta_p=T_p/6.42e4
K_eg = 353*((Theta_e*(Theta_e**2 + 0.44)*(Theta_e**2 + 0.16)**1.25)/((Theta_e**2 + 0.16*Theta_p)*(Theta_e**2 + 0.092)**0.5))
K_e = K_eg * gold + 0 * nonmetal
K_s = (0 * gold + 148 * nonmetal)
G = G_g * gold + 0 * nonmetal
R_es=1/3e-9
R_ps=1e9
a_s = FaceVariable(mesh=m, value=0.0, rank=1)
a_s.setValue((R_es + R_ps)*m.faceNormals, where=interface)
b_s = FaceVariable(mesh=m, value=0.0, rank=0)
b_s.setValue(K_s.faceValue, where=interface)
g_s = FaceVariable(mesh=m, value=0.0, rank=0)
g_s.setValue(R_es*T_e.faceValue + R_ps*T_p.faceValue, where=interface)
eq_e=TransientTerm ( coeff= C_e , var=T_e) == DiffusionTerm (coeff=K_e, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_e) + ImplicitSourceTerm (coeff=G, var=T_p) + S * gold
eq_p=TransientTerm ( coeff= C_p , var=T_p) == DiffusionTerm (coeff=(0.01 * K_e ) , var=T_p) + ImplicitSourceTerm (coeff=G, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_p)
eq_s=TransientTerm ( coeff= C_s , var=T_s) == DiffusionTerm (coeff=K_s, var=T_s) + PowerLawConvectionTerm(coeff=a_s, var=T_s) + DiffusionTerm(coeff=b_s, var=T_s) + (g_s * interface * m.faceNormals).divergence
eq=eq_e & eq_p & eq_s
results_T_e = []
results_T_p = []
results_T_s = []
t_list=[]
solver = LinearPCGSolver(precon=None, tolerance=1e-10, iterations=2000)
progress_bar = tqdm(total=int(T/dt), desc='Solving PDE')
while time()<T:
T_e.updateOld()
T_p.updateOld()
T_s.updateOld()
t_list.append(float(time()))
results_T_e.append(float(T_e.faceValue[int(Lx/(2.0*dx))]))
results_T_p.append(float(T_p.faceValue[int(Lx/(2.0*dx))]))
results_T_s.append(float(T_s.faceValue[int(Lx/(2.0*dx))]))
for i in range(10):
res=eq.sweep(dt=dt, solver=solver)
time.setValue(time() + dt) and it works fine but when I divide the domain into three parts 90nm gold, 10nm nickel and 100nm nonmetal then the temperature of nonmetal is too much higher than electron temperature from fipy import *
from fipy.solvers import LinearPCGSolver
Lx=2.0e-7
dx=1.0e-10
nx=int(Lx/dx)
T=100e-12
dt=4e-15
I_0 = 50
R = 0.359
delta = 115e-9
t_p = 200e-15
m=Grid1D(nx=nx, dx=dx)
x = m.cellCenters[0]
X = m.faceCenters[0]
time = Variable(0.)
gold = (x < 9*Lx / 20.0)
nickel = (x >= 9*Lx / 20.0) & ( x <= Lx / 2.0)
interface = ( X >= Lx/2.0)
nonmetal = (x > Lx /2.0 )
S = numerix.sqrt(4*numerix.log(2)/numerix.pi)*((1-R)*I_0/(t_p*delta*(1-numerix.exp(-Lx/(2.0*delta)))))*numerix.exp(-(x/delta)-4*numerix.log(2)*((time-2.0*t_p)/t_p)**2)
T_e=CellVariable(name="Electron Temperature", mesh=m, value=300.0, hasOld=True )
T_p=CellVariable(name="Phonon Temperature", mesh=m, value=300.0, hasOld=True )
T_s=CellVariable(name="Non-metal Temperature", mesh=m, value=300.0, hasOld=True )
C_e = ( 68 * T_e * gold + 1065 * T_e * nickel ) + 1 * nonmetal
C_p = 2.5e6 * gold + 4.1e6 * nickel + 1 * nonmetal
C_s = 2.21e6
G_g = 0.21e17*((1.18e7/1.25e11)*(T_e+T_p)+1)
G_n = 3.6e17*((0.59e7/1.4e11)*(T_e+T_p)+1)
K_eg = 318*(1.25e11*T_e/(1.18e7*T_e**2+1.25e11*T_p))
K_en = 90*(1.4e11*T_e/(0.59e7*T_e**2+1.4e11*T_p))
K_e = K_eg * gold + K_en * nickel + 0 * nonmetal
G = G_g * gold + G_n * nickel + 0 * nonmetal
K_s = 0 * gold + 0 * nickel + 9.724 * nonmetal
R_es=5e9
R_ps=1/6.7e-9
a_s = FaceVariable(mesh=m, value=0.0, rank=1)
a_s.setValue((R_es + R_ps)*m.faceNormals, where=interface)
b_s = FaceVariable(mesh=m, value=0.0, rank=0)
b_s.setValue(K_s.faceValue, where=interface)
g_s = FaceVariable(mesh=m, value=0.0, rank=0)
g_s.setValue(R_es*T_e.faceValue + R_ps*T_p.faceValue, where=interface)
eq_e=TransientTerm ( coeff= C_e , var=T_e) == DiffusionTerm (coeff=K_e, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_e) + ImplicitSourceTerm (coeff=G, var=T_p) + S * gold
eq_p=TransientTerm ( coeff= C_p , var=T_p) == DiffusionTerm (coeff=(0.01 * K_e ) , var=T_p) + ImplicitSourceTerm (coeff=G, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_p)
eq_s=TransientTerm ( coeff= C_s , var=T_s) == DiffusionTerm (coeff=K_s, var=T_s) + PowerLawConvectionTerm(coeff=a_s, var=T_s) + DiffusionTerm(coeff=b_s, var=T_s) + (g_s * interface * m.faceNormals).divergence
eq=eq_e & eq_p & eq_s
results_T_e = []
results_T_p = []
results_T_s = []
t_list=[]
solver = LinearPCGSolver(precon=None, tolerance=1e-10, iterations=2000)
progress_bar = tqdm(total=int(T/dt), desc='Solving PDE')
while time()<T:
T_e.updateOld()
T_p.updateOld()
T_s.updateOld()
t_list.append(float(time()))
results_T_e.append(float(T_e.faceValue[int(Lx/(2.0*dx))]))
results_T_p.append(float(T_p.faceValue[int(Lx/(2.0*dx))]))
results_T_s.append(float(T_s.faceValue[int(Lx/(2.0*dx))]))
for i in range(10):
res=eq.sweep(dt=dt, solver=solver)
time.setValue(time() + dt) Did I write the robin condition correctly? If yes then where is the problem? |
Beta Was this translation helpful? Give feedback.
-
Other than that I have some questions regarding fipy use. |
Beta Was this translation helpful? Give feedback.
-
Sir, after I tried many variations this is the code I wrote for from fipy import *
from fipy.solvers import LinearPCGSolver
import matplotlib.pyplot as plt
import scienceplots
plt.style.use(['science','no-latex','notebook'])
from tqdm import tqdm
Lx=2.0e-7
dx=1.0e-10
nx=int(Lx/dx)
T=30e-12
dt=4e-15
I_0 = 50
R = 0.359
delta = 115e-9
t_p = 200e-15
m=Grid1D(nx=nx, dx=dx)
x = m.cellCenters[0]
X = m.faceCenters[0]
time = Variable(0.)
gold = (x <= 9.0 * Lx/20.0 )
nickel = (x > 9.0 * Lx/20.0 ) & (x <= Lx/2.0 )
nonmetal = (x > Lx/2.0 )
interface = ( X >= Lx/2.0)
S = numerix.sqrt(4*numerix.log(2)/numerix.pi)*((1-R)*I_0/(t_p*delta*(1-numerix.exp(-Lx/(2.0*delta)))))*numerix.exp(-(x/delta)-4*numerix.log(2)*((time-2.0*t_p)/t_p)**2)
T_e=CellVariable(name="Electron Temperature", mesh=m, value=300.0, hasOld=True )
T_p=CellVariable(name="Phonon Temperature", mesh=m, value=300.0, hasOld=True )
T_s=CellVariable(name="Non-metal Temperature", mesh=m, value=300.0, hasOld=True )
C_e = 68 * T_e * gold + 1065 * T_e * nickel + 1065 * T_e * nonmetal
C_p = 2.5e6 * gold + 4.1e6 * nickel + 4.1e6 * nonmetal
C_s = 2.21e6
G_g = 1.5e16*((1.2e7/3.6e11)*(T_e+T_p)+1)
G_n = 3.6e17*((0.59e7/1.4e11)*(T_e+T_p)+1)
Theta_e=T_e/6.42e4
Theta_p=T_p/6.42e4
K_eg = 353*((Theta_e*(Theta_e**2 + 0.44)*(Theta_e**2 + 0.16)**1.25)/((Theta_e**2 + 0.16*Theta_p)*(Theta_e**2 + 0.092)**0.5))
K_en = 90*(1.4e11*T_e/(0.59e7*T_e**2+1.4e11*T_p))
K_e = K_eg * gold + K_en * nickel + 0 * nonmetal
G = G_g * gold + G_n * nickel + 0 * nonmetal
K_s = 0 * gold + 0 * nickel + 9.724 * nonmetal
R_es=1/2e-10
R_ps=1/6.7e-9
k_s = FaceVariable(mesh=m, value=0.0, rank=0)
k_s.setValue(K_s.faceValue, where=interface)
R_es_s = FaceVariable(mesh=m, value=0.0, rank=1)
R_es_s.setValue(R_es*m.faceNormals, where=interface)
R_ps_s = FaceVariable(mesh=m, value=0.0, rank=1)
R_ps_s.setValue(R_es*m.faceNormals, where=interface)
eq_e=TransientTerm ( coeff= C_e , var=T_e) == DiffusionTerm (coeff=K_e, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_e) + ImplicitSourceTerm (coeff=G, var=T_p) + S * gold
eq_p=TransientTerm ( coeff= C_p , var=T_p) == DiffusionTerm (coeff=(0.01 * K_e ) , var=T_p) + ImplicitSourceTerm (coeff=G, var=T_e) - ImplicitSourceTerm (coeff=G, var=T_p)
eq_s=TransientTerm ( coeff= C_s , var=T_s) == DiffusionTerm (coeff=K_s, var=T_s) + DiffusionTerm (coeff=k_s, var=T_s) + PowerLawConvectionTerm(coeff=R_es_s, var=T_e) + PowerLawConvectionTerm(coeff=R_ps_s, var=T_p) - PowerLawConvectionTerm(coeff=R_es_s, var=T_s) - PowerLawConvectionTerm(coeff=R_ps_s, var=T_s)
eq=eq_e & eq_p & eq_s
results_T_e = []
results_T_p = []
results_T_s = []
t_list=[]
solver = LinearPCGSolver(precon=None, tolerance=1e-10, iterations=2000)
progress_bar = tqdm(total=int(T/dt), desc='Solving PDE')
while time()<T:
T_e.updateOld()
T_p.updateOld()
T_s.updateOld()
t_list.append(float(time()))
results_T_e.append(float(T_e.faceValue[int(Lx/(2.0*dx) + 1)]))
results_T_p.append(float(T_p.faceValue[int(Lx/(2.0*dx) + 1)]))
results_T_s.append(float(T_s.faceValue[int(Lx/(2.0*dx) + 1)]))
for i in range(10):
res=eq.sweep(dt=dt, solver=solver)
time.setValue(time() + dt)
progress_bar.update()
progress_bar.close()
TSVViewer(vars=( T_e.faceValue,T_p.faceValue,T_s.faceValue)).plot(filename="123 2.txt")
plt.plot(t_list,results_T_e)
plt.plot(t_list,results_T_p)
plt.plot(t_list,results_T_s)
plt.xlabel('X (time)')
plt.ylabel('Y (Temperature)')
plt.title('Temperature')
plt.savefig('Interface 2.png', dpi=1200)
plt.show() But there are still some problems and questions remained. b = FaceVariable(mesh=mesh, value=K_s, rank=0)
b.setValue(0., where=mask)
g = FaceVariable(mesh=mesh, value=..., rank=0)
eqn = (TransientTerm() == DiffusionTerm(coeff=K_s) + PowerLawConvectionTerm(coeff=a) + DiffusionTerm(coeff=b) + (g * mask * mesh.faceNormals).divergence) (v)when I mention the interface the proper region is X==Lx/2.0 but this condition does not give any result but if I mention X>=Lx/2.0 then some changes happen. why? |
Beta Was this translation helpful? Give feedback.
-
That's not true. After just a few time steps, this is what your substrate temperature looks like:
You need to apply the boundary conditions to each field where they apply. Based on your PDF, you have a Robin condition for each of
I don't understand what you're asking. Please show math and/or code to illustrate what you're talking about.
No, because you shouldn't have
interface = ( X > (Lx - dx)/2.0) & ( X < (Lx + dx)/2.0)
What do you mean the signs don't matter? Those aren't doing the same thing. For an internal fixed gradient becomes When When
Experiment but, basically,
It depends on the function. If it's a linear function of T, then subsitute appropriately for
Either should work, but the latter is more physical. Treating fluxes and gradients like they're equivalent is the source of everything wrong in the world. In the future, can I kindly request that you ask questions as they come up? It's a lot of work to parse through a wall of nine questions after two weeks. |
Beta Was this translation helpful? Give feedback.
-
I am very sorry for asking questions after long time. But I always want to use your suggestion to make my code work and experiment first for some time.
I meant that change in interface layer is higher than subsequent facecenter. The change is not consistant as it should be.
If I apply the robin condition to equation of T_e and T_p the solutions do not converge at all.
I meant that when we apply robin condition we take divergence in both sides of
But the main equation contains transient term and diffusion term. Then robin condition comes . Why do we need to exclude diffusion term of main equation?
I want to simulate these equations. Sir, according to the Fourier's Law of heat conduction, heat flux in positive direction is mathematically - thermal conductivity * gradient of temperature. But what I try to simulate is that at the end of metal layer the heat flux from electron of metals to substrate depends linearly of temperature difference of electron and substrate, and the heat flux from phonon of metals to substrate depends linearly of temperature difference of phonon and substrate. I know that you have said many times that flux and gradient are not same. So what should I do to represent this flux condition in fipy? Should it be in thermal conductivity * gradients or in diffuson codition ? This is why I asked this question
|
Beta Was this translation helpful? Give feedback.
Why would
T_s
ever change? The equation you have written is (including source terms that are not in your PDF)Several issues beyond that:
C_s
andK_s
to zero in the gold and chromium domains. Similarly withC_e
,C_p
, andK_e
in the nonmetal domain. This gives undefined behavior. You're basically saying that the diffusion coefficient is 0/0 in that part of th…