Skip to content
Projects

Cell grid

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

curl

functionsource

The in-plane curl of the normal field a on the cell centres.

cut
B=(∂ya, −∂xa)B = (\partial_y a,\ -\partial_x a)
rz
B=(−∂za, ar+∂ra)B = \left(-\partial_z a,\ \frac{a}{r} + \partial_r a\right)
Assumes
  • numpy.gradient on the cell centres: second order inside, one-sided at the edges

curl_curl

functionsource

The curl-curl of the normal field, integrated over the cells (symmetric).

operator
(Ka)i=Vi (∇×∇×a)i,∇×∇×a=−∇2az (cut),−(∇2−1r2)aϕ (r–z)(K a)_i = V_i\, (\nabla\times\nabla\times a)_i, \qquad \nabla\times\nabla\times a = -\nabla^2 a_z \ (\text{cut}), \quad -\left(\nabla^2 - \frac{1}{r^2}\right) a_\phi \ (r\text{–}z)
energy
aTKa=∑fcf μˉf (w+a+−w−a−)2a^T K a = \sum_f c_f\, \bar\mu_f\, (w_+ a_+ - w_- a_-)^2
metric
cut: w=1, c=ℓfΔ;radial face: w=r, c=2π dzrfΔ;axial face: w=1, c=2πr drΔ\text{cut: } w = 1,\ c = \frac{\ell_f}{\Delta}; \qquad \text{radial face: } w = r,\ c = \frac{2\pi\, dz}{r_f \Delta}; \qquad \text{axial face: } w = 1,\ c = \frac{2\pi r\, dr}{\Delta}
axis
aϕ=0 on the axis:c=4π dz, w=1 for the half cell (Bz=2a/r0)a_\phi = 0 \text{ on the axis}: \quad c = 4\pi\, dz,\ w = 1 \text{ for the half cell } (B_z = 2a/r_0)
Order
cut: 2, rz: 2
Assumes
  • symmetric positive; Δ\Delta the distance between the two centres; μˉf\bar\mu_f the mean of the face coefficient's two cells
  • Dirichlet edges add c w2c\, w^2 to the diagonal over the half-cell distance; a face to an inactive cell is a Dirichlet face
  • with the axis term a uniform BzB_z stays a null field of the operator

transport_faces

functionsource

The faces of the cells for finite-volume transport (see TransportFaces).

areas
Af=Δy (cut);Af=2πrf Δz (radial),Af=2πrc Δr=π(r12−r02) (axial)A_f = \Delta y \ (\text{cut}); \qquad A_f = 2\pi r_f\, \Delta z \ (\text{radial}), \quad A_f = 2\pi r_c\, \Delta r = \pi (r_1^2 - r_0^2) \ (\text{axial})
distances
δlow=xf−xlow,δhigh=xhigh−xf\delta_\mathrm{low} = x_f - x_\mathrm{low}, \qquad \delta_\mathrm{high} = x_\mathrm{high} - x_f
Assumes
  • a domain edge is a wall face, except a neumann edge (symmetry), a periodic seam and the axis