Skip to content
Projects

Fluid 1D

The equations of carafe.fluid1d, declared on the code that implements them and checked by the tests.

Boundary

classsource

The condition of one species at one end.

wall
Γout=1−r1+r(max⁡(zμEout,0)+s vˉ) n,vˉ=8eTπm\Gamma_\mathrm{out} = \frac{1 - r}{1 + r}\Big(\max(z\mu E_\mathrm{out}, 0) + s\,\bar v\Big)\, n, \qquad \bar v = \sqrt{\frac{8 e T}{\pi m}}
wall energy
Γw,out=1−r1+r(53max⁡(zμEout,0)+43s vˉ) w(2Te per thermal electron)\Gamma_{w,\mathrm{out}} = \frac{1 - r}{1 + r}\Big(\tfrac53\max(z\mu E_\mathrm{out}, 0) + \tfrac43 s\,\bar v\Big)\, w \quad (2 T_e \text{ per thermal electron})
density
Γ=SG flux between nb and ncell over h/2,wb=32nbTb\Gamma = \text{SG flux between } n_b \text{ and } n_\mathrm{cell} \text{ over } h/2, \qquad w_b = \tfrac32 n_b T_b
flux
Γin=value,Γw,in=2T Γin\Gamma_\mathrm{in} = \text{value}, \qquad \Gamma_{w,\mathrm{in}} = 2T\, \Gamma_\mathrm{in}
outflow
Γout=v ncell,Γw,out=f Te v ncell\Gamma_\mathrm{out} = v\, n_\mathrm{cell}, \qquad \Gamma_{w,\mathrm{out}} = f\, T_e\, v\, n_\mathrm{cell}
momentum wall
Γout=2cb+b2+4ac+s vˉ n,a=2hn,b=eMμ,c=2Πh+zeEoutnM\Gamma_\mathrm{out} = \frac{2c}{b + \sqrt{b^2 + 4ac}} + s\,\bar v\, n, \qquad a = \frac{2}{h n}, \quad b = \frac{e}{M\mu}, \quad c = \frac{2\Pi}{h} + \frac{z e E_\mathrm{out} n}{M}
Assumes
  • nn, TT those of the cell next to the end (TeT_e for electrons, TgT_g for the rest); a species without a condition has a wall
  • s=1/2s = 1/2: the density of the outgoing half-Maxwellian (Hagelaar et al. 2000); s=1/4s = 1/4: a full Maxwellian; the two floating sheaths differ by Teln⁡2T_e \ln 2
  • the momentum wall: the half cell's steady momentum balance, nothing coming back (supersonic), Π\Pi the momentum flux arriving; zero if c≤0c \le 0
References

Fluid1D

classsource

A plasma between x = 0 and length on cells cells; see the module docstring.

continuity
∂tns+∂xΓs=Ss,Γs=zsμsnsE−Ds∂xns\partial_t n_s + \partial_x \Gamma_s = S_s, \qquad \Gamma_s = z_s \mu_s n_s E - D_s \partial_x n_s
energy
∂tw+∂xΓw=−ΓeE−Ploss+Pexte,w=32neTe,Γw=Γ[53μe,53De](w)\partial_t w + \partial_x \Gamma_w = -\Gamma_e E - P_\mathrm{loss} + \frac{P_\mathrm{ext}}{e}, \qquad w = \tfrac32 n_e T_e, \qquad \Gamma_w = \Gamma[\tfrac53\mu_e, \tfrac53 D_e](w)
poisson
∂x2ϕ=−eε0∑szsns,E=−∂xϕ\partial_x^2 \phi = -\frac{e}{\varepsilon_0}\sum_s z_s n_s, \qquad E = -\partial_x\phi
momentum
∂tΓ+∂xΓ2n=zeMnE−eTgM∂xn−(ν+Ln)Γ,ν=eMμ\partial_t \Gamma + \partial_x \frac{\Gamma^2}{n} = \frac{z e}{M} n E - \frac{e T_g}{M} \partial_x n - \left(\nu + \frac{L}{n}\right)\Gamma, \qquad \nu = \frac{e}{M\mu}
losses
Ploss=∑R εe−∑S εsrcP_\mathrm{loss} = \sum R\,\varepsilon_e - \sum S\,\varepsilon_\mathrm{src}
grid
xi=(i+12)h,Ei+1/2=−ϕi+1−ϕih,Ei−1/2−Ei+1/2h+eρiε0=0x_i = (i + \tfrac12) h, \qquad E_{i+1/2} = -\frac{\phi_{i+1} - \phi_i}{h}, \qquad \frac{E_{i-1/2} - E_{i+1/2}}{h} + \frac{e\rho_i}{\varepsilon_0} = 0
staggered
Γi+1/2=ui+1/2 ni+ni+12,Πi+1−Πih−νΓi+1/2SG+(ν+L/n‾)Γi+1/2=0\Gamma_{i+1/2} = u_{i+1/2}\, \frac{n_i + n_{i+1}}{2}, \qquad \frac{\Pi_{i+1} - \Pi_i}{h} - \nu \Gamma^\mathrm{SG}_{i+1/2} + \left(\nu + \overline{L/n}\right)\Gamma_{i+1/2} = 0
Order
2
Assumes
  • D=μTD = \mu T unless given (TeT_e for electrons, TgT_g otherwise); constant transport coefficients; no gas or ion energy equation
  • Scharfetter-Gummel fluxes on uniform cells; DeD_e on a face with the mean TeT_e of its cells; the Joule term the mean of −ΓE-\Gamma E on the two faces
  • a momentum ion: its face velocity an unknown, Π=Γ2/nˉ\Pi = \Gamma^2/\bar n upwinded on the cells, its force e/(Mμ)e/(M\mu) times the SG flux with D=μTgD = \mu T_g; without inertia the SG flux exactly
  • LL the rate of the reactions destroying it (ions born at rest); Poisson's equation needs the Debye length resolved
  • the order is that of a steady diffusion problem with held densities (the problem of the tests)
References
Built from

steady_state

functionsource

Return the steady state.

backward euler
un+1−unΔt=F(un+1)(Poisson included),then F(u)=0\frac{u^{n+1} - u^n}{\Delta t} = F(u^{n+1}) \quad (\text{Poisson included}), \qquad \text{then } F(u) = 0
newton
J δ=−r,u=(ln⁡ns, ln⁡w, ui+1/2, ϕ),J:,j≈r(u+ϵjej)−r(u−ϵjej)2ϵj,ϵj=10−6max⁡(1,∣uj∣)J\,\delta = -r, \qquad u = (\ln n_s,\ \ln w,\ u_{i+1/2},\ \phi), \qquad J_{:,j} \approx \frac{r(u + \epsilon_j e_j) - r(u - \epsilon_j e_j)}{2\epsilon_j}, \quad \epsilon_j = 10^{-6}\max(1, |u_j|)
damping
δ←δ min⁡(1,2max⁡∣δln⁡∣),converged: ∣δln⁡∣<10−10, ∣δlin∣<10−10(1+max⁡∣u∣)\delta \leftarrow \delta\, \min\left(1, \frac{2}{\max |\delta_{\ln}|}\right), \qquad \text{converged: } |\delta_{\ln}| < 10^{-10},\ |\delta_\mathrm{lin}| < 10^{-10}(1 + \max|u|)
pseudo time
Δt←growth⋅Δt after a step,Δt←Δt/4 after a failure\Delta t \leftarrow \text{growth}\cdot\Delta t \text{ after a step}, \qquad \Delta t \leftarrow \Delta t / 4 \text{ after a failure}
Assumes
  • the Jacobian on a 3-colouring of the cells (a residual depends on its neighbours only), spsolve; at most 30 iterations
  • stops growing once a step of at least max_dt succeeds (at most max_steps), or fails below 10−610^{-6} of the first step
  • with a momentum species the upwinded Π\Pi reaches two cells, which the colouring misses: only the convergence rate can suffer

scharfetter_gummel

functionsource

The Scharfetter-Gummel flux from left to right, a distance apart.

flux
Γi+1/2=Dh(B(−Pe) ni−B(Pe) ni+1),Pe=zμEhD,B(x)=xex−1\Gamma_{i+1/2} = \frac{D}{h}\Big(B(-\mathrm{Pe})\, n_i - B(\mathrm{Pe})\, n_{i+1}\Big), \qquad \mathrm{Pe} = \frac{z \mu E h}{D}, \qquad B(x) = \frac{x}{e^x - 1}
series
B(x)=1−x2+x212−x4720(∣x∣<10−3)B(x) = 1 - \frac{x}{2} + \frac{x^2}{12} - \frac{x^4}{720} \quad (|x| < 10^{-3})
drift only
Γ=zμE nupwind(D=0)\Gamma = z\mu E\, n_\mathrm{upwind} \quad (D = 0)
Order
2
Assumes
  • exact for a constant flux and field between the two points, so a steady state has no artificial diffusion
  • the series below ∣x∣=10−3|x| = 10^{-3} is exact to round-off; a shorter one errs by x2/12x^2/12, noise in a finite-difference Jacobian
  • the order is that of the face flux of a smooth profile in a varying field
References