The equations of carafe.spatial.fluid , declared on the code that implements them and checked by the tests.
The plasma on the cells of a grid; see the module docstring.
continuity ∂ t n s + ∇ ⋅ Γ s = S s \partial_t n_s + \nabla\cdot\boldsymbol\Gamma_s = S_s ∂ t n s + ∇ ⋅ Γ s = S s ion momentum ∂ t ( n i v i ) + ∇ ⋅ ( n i v i v i ) = z i e M i n i E − e T g M i ∇ n i − ν i n i v i − L i v i \partial_t(n_i\mathbf v_i) + \nabla\cdot(n_i\mathbf v_i\mathbf v_i) = \frac{z_i e}{M_i} n_i\mathbf E - \frac{e T_g}{M_i}\nabla n_i - \nu_i n_i\mathbf v_i - L_i\mathbf v_i ∂ t ( n i v i ) + ∇ ⋅ ( n i v i v i ) = M i z i e n i E − M i e T g ∇ n i − ν i n i v i − L i v i ion friction ν i = e M i μ i or ν i = 8 e T g / ( π M i ) + ∣ v i ∣ 2 λ i \nu_i = \frac{e}{M_i\mu_i} \quad \text{or} \quad \nu_i = \frac{\sqrt{8 e T_g/(\pi M_i) + |\mathbf v_i|^2}}{\lambda_i} ν i = M i μ i e or ν i = λ i 8 e T g / ( π M i ) + ∣ v i ∣ 2 electrons Γ e = − μ e n e ( E − F e ) − ∇ ( D e n e ) , F = − e 2 R e ( u n ^ × B ∗ ) , μ e = e m e ν \boldsymbol\Gamma_e = -\mu_e n_e\left(\mathbf E - \frac{\mathbf F}{e}\right) - \nabla(D_e n_e), \qquad \mathbf F = -\frac{e}{2}\mathrm{Re}\left(u\,\hat{\mathbf n}\times\mathbf B^*\right), \qquad \mu_e = \frac{e}{m_e \nu} Γ e = − μ e n e ( E − e F ) − ∇ ( D e n e ) , F = − 2 e Re ( u n ^ × B ∗ ) , μ e = m e ν e energy ∂ t w + ∇ ⋅ Γ w = − Γ e ⋅ E − ∑ R ε e + p R F e , p R F = 1 2 R e ( J E ∗ ) \partial_t w + \nabla\cdot\boldsymbol\Gamma_w = -\boldsymbol\Gamma_e\cdot\mathbf E - \sum R\,\varepsilon_e + \frac{p_\mathrm{RF}}{e}, \qquad p_\mathrm{RF} = \tfrac12\mathrm{Re}(J E^*) ∂ t w + ∇ ⋅ Γ w = − Γ e ⋅ E − ∑ R ε e + e p RF , p RF = 2 1 Re ( J E ∗ ) quasineutral n e = ∑ i z i n i , ∇ ⋅ ∑ s z s Γ s = 0 n_e = \sum_i z_i n_i, \qquad \nabla\cdot\sum_s z_s\boldsymbol\Gamma_s = 0 n e = i ∑ z i n i , ∇ ⋅ s ∑ z s Γ s = 0 poisson ∇ ⋅ E = e ε 0 ∑ s z s n s \nabla\cdot\mathbf E = \frac{e}{\varepsilon_0}\sum_s z_s n_s ∇ ⋅ E = ε 0 e s ∑ z s n s sheath Γ i , w a l l = n s m o o t h m a x ( v n , u B ) , u B = z e T e M , Γ e , w a l l = 1 4 n e v ˉ e e − ( ϕ − ϕ w ) / T e , 2 T e + ( ϕ − ϕ w ) each \Gamma_{i,\mathrm{wall}} = n\,\mathrm{smoothmax}(v_n, u_B), \quad u_B = \sqrt{\frac{z e T_e}{M}}, \qquad \Gamma_{e,\mathrm{wall}} = \tfrac14 n_e \bar v_e\, e^{-(\phi - \phi_w)/T_e}, \quad 2T_e + (\phi - \phi_w) \text{ each} Γ i , wall = n smoothmax ( v n , u B ) , u B = M z e T e , Γ e , wall = 4 1 n e v ˉ e e − ( ϕ − ϕ w ) / T e , 2 T e + ( ϕ − ϕ w ) each rusanov F n = 1 2 ( n l v l + n h v h ) − 1 2 c ( n h − n l ) , c = v l 2 + v h 2 + e ( z T ˉ e + T g ) / M F_n = \tfrac12(n_l v_l + n_h v_h) - \tfrac12 c\,(n_h - n_l), \qquad c = \sqrt{v_l^2 + v_h^2 + e(z\bar T_e + T_g)/M} F n = 2 1 ( n l v l + n h v h ) − 2 1 c ( n h − n l ) , c = v l 2 + v h 2 + e ( z T ˉ e + T g ) / M divergence ( ∇ ⋅ Γ ) c e l l = 1 V c e l l ∑ f A f Γ f ( one flux per face, across levels too ) (\nabla\cdot\boldsymbol\Gamma)_\mathrm{cell} = \frac{1}{V_\mathrm{cell}}\sum_f A_f \Gamma_f \quad (\text{one flux per face, across levels too}) ( ∇ ⋅ Γ ) cell = V cell 1 f ∑ A f Γ f ( one flux per face, across levels too ) Order 1 Assumes Scharfetter-Gummel fluxes for electrons and drift-diffusion ions with face coefficients the mean of the two cells; Rusanov (first order) for the inertial ions ions at T g T_g T g , born at rest, L i L_i L i the rate of the reactions destroying them; the gas a fixed background unless coupled the quasi-neutral sheath edge takes the wall cell's density, a first-order error u B h / ( 2 D ) u_B h/(2D) u B h / ( 2 D ) ; Poisson needs the Debye length resolved s m o o t h m a x ( a , b ) = 1 2 ( a + b + ( a − b ) 2 + ϵ 2 ) \mathrm{smoothmax}(a, b) = \tfrac12(a + b + \sqrt{(a - b)^2 + \epsilon^2}) smoothmax ( a , b ) = 2 1 ( a + b + ( a − b ) 2 + ϵ 2 ) , ϵ = 10 − 2 u B \epsilon = 10^{-2} u_B ϵ = 1 0 − 2 u B ; the RF force does no workcoarse-fine faces: the coarse value interpolated quadratically along the face to its middle (logarithms of positive fields) the order is that of ambipolar diffusion in a slab from a uniform source (the problem of the tests) References Built from Return the steady state.
backward euler u n + 1 − u n Δ t = F ( u n + 1 ) , u = ( ln n s , v i , ln w , ϕ ) \frac{u^{n+1} - u^n}{\Delta t} = F(u^{n+1}), \qquad u = (\ln n_s,\ \mathbf v_i,\ \ln w,\ \phi) Δ t u n + 1 − u n = F ( u n + 1 ) , u = ( ln n s , v i , ln w , ϕ ) newton J δ = − r , J : , j ≈ r ( u + ϵ j e j ) − r ( u ) ϵ j , ϵ j = 10 − 7 max ( 1 , ∣ u j ∣ ) J\,\delta = -r, \qquad J_{:,j} \approx \frac{r(u + \epsilon_j e_j) - r(u)}{\epsilon_j}, \quad \epsilon_j = 10^{-7}\max(1, |u_j|) J δ = − r , J : , j ≈ ϵ j r ( u + ϵ j e j ) − r ( u ) , ϵ j = 1 0 − 7 max ( 1 , ∣ u j ∣ ) damping ∣ δ ln ∣ ≤ 2 , ∣ δ ϕ ∣ ≤ 2 max T e , ∣ δ v ∣ ≤ 0.5 e max T e / M |\delta_{\ln}| \le 2, \qquad |\delta\phi| \le 2\max T_e, \qquad |\delta\mathbf v| \le 0.5\sqrt{e\max T_e/M} ∣ δ l n ∣ ≤ 2 , ∣ δ ϕ ∣ ≤ 2 max T e , ∣ δ v ∣ ≤ 0.5 e max T e / M pseudo time Δ t ← growth 2 Δ t after at most 4 iterations, else growth ⋅ Δ t ; Δ t ← Δ t / 4 after a failure \Delta t \leftarrow \text{growth}^2\,\Delta t \text{ after at most 4 iterations, else growth}\cdot\Delta t; \qquad \Delta t \leftarrow \Delta t/4 \text{ after a failure} Δ t ← growth 2 Δ t after at most 4 iterations, else growth ⋅ Δ t ; Δ t ← Δ t /4 after a failure Assumes forward differences on a distance-2 colouring of the cells; the LU (splu) reused while undamped steps shrink fourfold converged when every log change is below 10 − 10 10^{-10} 1 0 − 10 and every linear one below 10 − 10 ( 1 + ∣ u ∣ ) 10^{-10}(1 + |u|) 1 0 − 10 ( 1 + ∣ u ∣ ) ; 15 iterations per step, 40 for the steady equations