Equations
This page summarizes the assembled formulation implemented in CartesianOperators.jl. The operators are built by build_GHW and applied through gradient/divergence.
Gradient
\[\operatorname{grad}(x^\omega, x^\gamma) = W^{-1}\left(Gx^\omega + Hx^\gamma\right).\]
Split form used by gradient(...; split=true):
\[q^\omega = W^{-1}Gx^\omega, \qquad q^\gamma = W^{-1}Hx^\gamma, \qquad q = q^\omega + q^\gamma.\]
Gradient bulk term
\[\int_{\left(\left]x^\pm_{i-1,j},\,x^\pm_{i,j}\right[\times \Delta^2_j\right)\cap \Omega} \phi^\pm(t,\mathbf x)\,n^{1\pm}(\mathbf x)\,\mathrm dS \simeq \bigl(A^{1\pm}_{i-\sfrac12,j}-B^{1\pm}_{i,j}\bigr)\,\Phi^{\omega\pm}_{i,j}(t) -\bigl(A^{1\pm}_{i-\sfrac12,j}-B^{1\pm}_{i-1,j}\bigr)\,\Phi^{\omega\pm}_{i-1,j}(t).\]
Gradient interface term
\[\int_{\left(\left]x^\pm_{i-1,j},\,x^\pm_{i,j}\right[\times \Delta^2_j\right)\cap \Gamma} \phi^\pm(t,\mathbf x)\,n^{1\pm}(\mathbf x)\,\mathrm dS \simeq \bigl(A^{1\pm}_{i-\sfrac12,j}-B^{1\pm}_{i,j}\bigr)\,\Phi^{\gamma\pm}_{i,j}(t) -\bigl(A^{1\pm}_{i-\sfrac12,j}-B^{1\pm}_{i-1,j}\bigr)\,\Phi^{\gamma\pm}_{i-1,j}(t).\]
Divergence
\[\operatorname{div}(q^\omega, q^\gamma) = -(G^\top + H^\top)q^\omega + H^\top q^\gamma.\]
Split form used by divergence(...; split=true):
\[d_{\text{faces}} = -(G^\top + H^\top)q^\omega, \qquad d_{\text{int}} = H^\top q^\gamma, \qquad d = d_{\text{faces}} + d_{\text{int}}.\]
Curl (2D scalar)
The 2D curl is implemented from Green's circulation theorem on each dual control:
\[\int_{V_i} \left(\partial_x q_y - \partial_y q_x\right)\,\mathrm dV = \oint_{\partial V_i} q\cdot t\,\mathrm ds,\]
with counter-clockwise orientation as positive.
Using the exact identity
\[\operatorname{curl}(q_x, q_y) = \operatorname{div}(q_y, -q_x),\]
define the block rotation operator R(q_x, q_y) = (q_y, -q_x). Then
\[\operatorname{curl}_h(q^\omega, q^\gamma) = \operatorname{div}_h(Rq^\omega, Rq^\gamma).\]
With G = [G_x; G_y] and H = [H_x; H_y], this gives
\[\operatorname{curl}_h = -(G_x^\top + H_x^\top)q_y^\omega + (G_y^\top + H_y^\top)q_x^\omega + H_x^\top q_y^\gamma - H_y^\top q_x^\gamma.\]
Using G_d + H_d = A_d D_d^- (from G_d = D_d^-B_d and H_d = A_dD_d^- - D_d^-B_d), we obtain the clean Green-theorem form:
\[\operatorname{curl}_h = (D_x^-)^\top A_x\,q_y^\omega - (D_y^-)^\top A_y\,q_x^\omega - H_x^\top q_y^\gamma + H_y^\top q_x^\gamma.\]
For full regular cells (H=0, full apertures), this reduces to the standard centered finite-volume approximation of \partial_x q_y - \partial_y q_x.
Curl (3D status)
Exact 3D cut/interface-consistent curl is not implemented yet. It requires dual-edge circulation metrics / edge-control geometry for a Stokes-consistent operator. The target component form is:
\[(\nabla\times q)_x = \partial_y q_z - \partial_z q_y,\quad (\nabla\times q)_y = \partial_z q_x - \partial_x q_z,\quad (\nabla\times q)_z = \partial_x q_y - \partial_y q_x.\]
SBP / Discrete Integration-by-Parts
For any cell field x and face fields (q^\omega, q^\gamma), the assembled operators satisfy
\[x^\top \operatorname{div}(q^\omega, q^\gamma) = -(Gx)^\top q^\omega + (Hx)^\top (q^\gamma - q^\omega).\]
This is the discrete summation-by-parts identity for the split form, with the interface contribution carried by H.
If the same face flux is used in both slots, q^\omega = q^\gamma = q, the H contribution cancels and we get
\[x^\top \operatorname{div}(q, q) = -(Gx)^\top q.\]
This is the adjoint pairing used by the diffusion assembly.
Laplacian from -div(grad, grad)
With
\[q = \operatorname{grad}(x^\omega, x^\gamma) = W^{-1}\left(Gx^\omega + Hx^\gamma\right),\]
the composed operator is
\[-\operatorname{div}(q, q) = G^\top W^{-1}G\,x^\omega + G^\top W^{-1}H\,x^\gamma.\]
In the implementation, W^{-1} is represented by Winv and uses zero entries on invalid/halo face metrics.
Remarks:
G^\top W^{-1}Gis symmetric positive semidefinite.G^\top W^{-1}His an interface-coupling term and is generally nonzero on cut cells, so the mixed expression is not by itself a symmetric SPD operator unless coupled with additional interface equations.
Divergence flux balance form
\[\begin{multline} \int_{\Gamma_{i,j}} \mathbf q^\pm(t,\mathbf x)\cdot \mathbf n^\pm \,\mathrm dS \simeq \bigl(B^{1\pm}_{i,j}-A^{1\pm}_{i+\sfrac12,j}\bigr)\,Q^{1\pm}_{i+\sfrac12,j}(t) +\bigl(A^{1\pm}_{i-\sfrac12,j}-B^{1\pm}_{i,j}\bigr)\,Q^{1\pm}_{i-\sfrac12,j}(t) \\ +\bigl(B^{2\pm}_{i,j}-A^{2\pm}_{i,j+\sfrac12}\bigr)\,Q^{2\pm}_{i,j+\sfrac12}(t) +\bigl(A^{2\pm}_{i,j-\sfrac12}-B^{2\pm}_{i,j}\bigr)\,Q^{2\pm}_{i,j-\sfrac12}(t). \end{multline}\]