$ \newcommand{\Ua}{\mathrm{a}} \newcommand{\Ub}{\mathrm{b}} \newcommand{\Uc}{\mathrm{c}} \newcommand{\Ud}{\mathrm{d}} \newcommand{\Ue}{\mathrm{e}} \newcommand{\Uf}{\mathrm{f}} \newcommand{\Ug}{\mathrm{g}} \newcommand{\Uh}{\mathrm{h}} \newcommand{\Ui}{\mathrm{i}} \newcommand{\Uj}{\mathrm{j}} \newcommand{\Uk}{\mathrm{k}} \newcommand{\Ul}{\mathrm{l}} \newcommand{\Um}{\mathrm{m}} \newcommand{\Un}{\mathrm{n}} \newcommand{\Uo}{\mathrm{o}} \newcommand{\Up}{\mathrm{p}} \newcommand{\Uq}{\mathrm{q}} \newcommand{\Ur}{\mathrm{r}} \newcommand{\Us}{\mathrm{s}} \newcommand{\Ut}{\mathrm{t}} \newcommand{\Uu}{\mathrm{u}} \newcommand{\Uv}{\mathrm{v}} \newcommand{\Uw}{\mathrm{w}} \newcommand{\Ux}{\mathrm{x}} \newcommand{\Uy}{\mathrm{y}} \newcommand{\Uz}{\mathrm{z}} \newcommand{\UA}{\mathrm{A}} \newcommand{\UB}{\mathrm{B}} \newcommand{\UC}{\mathrm{C}} \newcommand{\UD}{\mathrm{D}} \newcommand{\UE}{\mathrm{E}} \newcommand{\UF}{\mathrm{F}} \newcommand{\UG}{\mathrm{G}} \newcommand{\UH}{\mathrm{H}} \newcommand{\UI}{\mathrm{I}} \newcommand{\UJ}{\mathrm{J}} \newcommand{\UK}{\mathrm{K}} \newcommand{\UL}{\mathrm{L}} \newcommand{\UM}{\mathrm{M}} \newcommand{\UN}{\mathrm{N}} \newcommand{\UO}{\mathrm{O}} \newcommand{\UP}{\mathrm{P}} \newcommand{\UQ}{\mathrm{Q}} \newcommand{\UR}{\mathrm{R}} \newcommand{\US}{\mathrm{S}} \newcommand{\UT}{\mathrm{T}} \newcommand{\UU}{\mathrm{U}} \newcommand{\UV}{\mathrm{V}} \newcommand{\UW}{\mathrm{W}} \newcommand{\UX}{\mathrm{X}} \newcommand{\UY}{\mathrm{Y}} \newcommand{\UZ}{\mathrm{Z}} % \newcommand{\Uzero }{\mathrm{0}} \newcommand{\Uone }{\mathrm{1}} \newcommand{\Utwo }{\mathrm{2}} \newcommand{\Uthree}{\mathrm{3}} \newcommand{\Ufour }{\mathrm{4}} \newcommand{\Ufive }{\mathrm{5}} \newcommand{\Usix }{\mathrm{6}} \newcommand{\Useven}{\mathrm{7}} \newcommand{\Ueight}{\mathrm{8}} \newcommand{\Unine }{\mathrm{9}} % \newcommand{\Ja}{\mathit{a}} \newcommand{\Jb}{\mathit{b}} \newcommand{\Jc}{\mathit{c}} \newcommand{\Jd}{\mathit{d}} \newcommand{\Je}{\mathit{e}} \newcommand{\Jf}{\mathit{f}} \newcommand{\Jg}{\mathit{g}} \newcommand{\Jh}{\mathit{h}} \newcommand{\Ji}{\mathit{i}} \newcommand{\Jj}{\mathit{j}} \newcommand{\Jk}{\mathit{k}} \newcommand{\Jl}{\mathit{l}} \newcommand{\Jm}{\mathit{m}} \newcommand{\Jn}{\mathit{n}} \newcommand{\Jo}{\mathit{o}} \newcommand{\Jp}{\mathit{p}} \newcommand{\Jq}{\mathit{q}} \newcommand{\Jr}{\mathit{r}} \newcommand{\Js}{\mathit{s}} \newcommand{\Jt}{\mathit{t}} \newcommand{\Ju}{\mathit{u}} \newcommand{\Jv}{\mathit{v}} \newcommand{\Jw}{\mathit{w}} \newcommand{\Jx}{\mathit{x}} \newcommand{\Jy}{\mathit{y}} \newcommand{\Jz}{\mathit{z}} \newcommand{\JA}{\mathit{A}} \newcommand{\JB}{\mathit{B}} \newcommand{\JC}{\mathit{C}} \newcommand{\JD}{\mathit{D}} \newcommand{\JE}{\mathit{E}} \newcommand{\JF}{\mathit{F}} \newcommand{\JG}{\mathit{G}} \newcommand{\JH}{\mathit{H}} \newcommand{\JI}{\mathit{I}} \newcommand{\JJ}{\mathit{J}} \newcommand{\JK}{\mathit{K}} \newcommand{\JL}{\mathit{L}} \newcommand{\JM}{\mathit{M}} \newcommand{\JN}{\mathit{N}} \newcommand{\JO}{\mathit{O}} \newcommand{\JP}{\mathit{P}} \newcommand{\JQ}{\mathit{Q}} \newcommand{\JR}{\mathit{R}} \newcommand{\JS}{\mathit{S}} \newcommand{\JT}{\mathit{T}} \newcommand{\JU}{\mathit{U}} \newcommand{\JV}{\mathit{V}} \newcommand{\JW}{\mathit{W}} \newcommand{\JX}{\mathit{X}} \newcommand{\JY}{\mathit{Y}} \newcommand{\JZ}{\mathit{Z}} % \newcommand{\Jzero }{\mathit{0}} \newcommand{\Jone }{\mathit{1}} \newcommand{\Jtwo }{\mathit{2}} \newcommand{\Jthree}{\mathit{3}} \newcommand{\Jfour }{\mathit{4}} \newcommand{\Jfive }{\mathit{5}} \newcommand{\Jsix }{\mathit{6}} \newcommand{\Jseven}{\mathit{7}} \newcommand{\Jeight}{\mathit{8}} \newcommand{\Jnine }{\mathit{9}} % \newcommand{\BA}{\boldsymbol{A}} \newcommand{\BB}{\boldsymbol{B}} \newcommand{\BC}{\boldsymbol{C}} \newcommand{\BD}{\boldsymbol{D}} \newcommand{\BE}{\boldsymbol{E}} \newcommand{\BF}{\boldsymbol{F}} \newcommand{\BG}{\boldsymbol{G}} \newcommand{\BH}{\boldsymbol{H}} \newcommand{\BI}{\boldsymbol{I}} \newcommand{\BJ}{\boldsymbol{J}} \newcommand{\BK}{\boldsymbol{K}} \newcommand{\BL}{\boldsymbol{L}} \newcommand{\BM}{\boldsymbol{M}} \newcommand{\BN}{\boldsymbol{N}} \newcommand{\BO}{\boldsymbol{O}} \newcommand{\BP}{\boldsymbol{P}} \newcommand{\BQ}{\boldsymbol{Q}} \newcommand{\BR}{\boldsymbol{R}} \newcommand{\BS}{\boldsymbol{S}} \newcommand{\BT}{\boldsymbol{T}} \newcommand{\BU}{\boldsymbol{U}} \newcommand{\BV}{\boldsymbol{V}} \newcommand{\BW}{\boldsymbol{W}} \newcommand{\BX}{\boldsymbol{X}} \newcommand{\BY}{\boldsymbol{Y}} \newcommand{\BZ}{\boldsymbol{Z}} \newcommand{\Ba}{\boldsymbol{a}} \newcommand{\Bb}{\boldsymbol{b}} \newcommand{\Bc}{\boldsymbol{c}} \newcommand{\Bd}{\boldsymbol{d}} \newcommand{\Be}{\boldsymbol{e}} \newcommand{\Bf}{\boldsymbol{f}} \newcommand{\Bg}{\boldsymbol{g}} \newcommand{\Bh}{\boldsymbol{h}} \newcommand{\Bi}{\boldsymbol{i}} \newcommand{\Bj}{\boldsymbol{j}} \newcommand{\Bk}{\boldsymbol{k}} \newcommand{\Bl}{\boldsymbol{l}} \newcommand{\Bm}{\boldsymbol{m}} \newcommand{\Bn}{\boldsymbol{n}} \newcommand{\Bo}{\boldsymbol{o}} \newcommand{\Bp}{\boldsymbol{p}} \newcommand{\Bq}{\boldsymbol{q}} \newcommand{\Br}{\boldsymbol{r}} \newcommand{\Bs}{\boldsymbol{s}} \newcommand{\Bt}{\boldsymbol{t}} \newcommand{\Bu}{\boldsymbol{u}} \newcommand{\Bv}{\boldsymbol{v}} \newcommand{\Bw}{\boldsymbol{w}} \newcommand{\Bx}{\boldsymbol{x}} \newcommand{\By}{\boldsymbol{y}} \newcommand{\Bz}{\boldsymbol{z}} % \newcommand{\Bzero }{\boldsymbol{0}} \newcommand{\Bone }{\boldsymbol{1}} \newcommand{\Btwo }{\boldsymbol{2}} \newcommand{\Bthree}{\boldsymbol{3}} \newcommand{\Bfour }{\boldsymbol{4}} \newcommand{\Bfive }{\boldsymbol{5}} \newcommand{\Bsix }{\boldsymbol{6}} \newcommand{\Bseven}{\boldsymbol{7}} \newcommand{\Beight}{\boldsymbol{8}} \newcommand{\Bnine }{\boldsymbol{9}} % \newcommand{\Balpha }{\boldsymbol{\alpha} } \newcommand{\Bbeta }{\boldsymbol{\beta} } \newcommand{\Bgamma }{\boldsymbol{\gamma} } \newcommand{\Bdelta }{\boldsymbol{\delta} } \newcommand{\Bepsilon}{\boldsymbol{\epsilon} } \newcommand{\Bvareps }{\boldsymbol{\varepsilon} } \newcommand{\Bvarepsilon}{\boldsymbol{\varepsilon}} \newcommand{\Bzeta }{\boldsymbol{\zeta} } \newcommand{\Beta }{\boldsymbol{\eta} } \newcommand{\Btheta }{\boldsymbol{\theta} } \newcommand{\Bvarthe }{\boldsymbol{\vartheta} } \newcommand{\Biota }{\boldsymbol{\iota} } \newcommand{\Bkappa }{\boldsymbol{\kappa} } \newcommand{\Blambda }{\boldsymbol{\lambda} } \newcommand{\Bmu }{\boldsymbol{\mu} } \newcommand{\Bnu }{\boldsymbol{\nu} } \newcommand{\Bxi }{\boldsymbol{\xi} } \newcommand{\Bpi }{\boldsymbol{\pi} } \newcommand{\Brho }{\boldsymbol{\rho} } \newcommand{\Bvrho }{\boldsymbol{\varrho} } \newcommand{\Bsigma }{\boldsymbol{\sigma} } \newcommand{\Bvsigma }{\boldsymbol{\varsigma} } \newcommand{\Btau }{\boldsymbol{\tau} } \newcommand{\Bupsilon}{\boldsymbol{\upsilon} } \newcommand{\Bphi }{\boldsymbol{\phi} } \newcommand{\Bvarphi }{\boldsymbol{\varphi} } \newcommand{\Bchi }{\boldsymbol{\chi} } \newcommand{\Bpsi }{\boldsymbol{\psi} } \newcommand{\Bomega }{\boldsymbol{\omega} } \newcommand{\BGamma }{\boldsymbol{\Gamma} } \newcommand{\BDelta }{\boldsymbol{\Delta} } \newcommand{\BTheta }{\boldsymbol{\Theta} } \newcommand{\BLambda }{\boldsymbol{\Lambda} } \newcommand{\BXi }{\boldsymbol{\Xi} } \newcommand{\BPi }{\boldsymbol{\Pi} } \newcommand{\BSigma }{\boldsymbol{\Sigma} } \newcommand{\BUpsilon}{\boldsymbol{\Upsilon} } \newcommand{\BPhi }{\boldsymbol{\Phi} } \newcommand{\BPsi }{\boldsymbol{\Psi} } \newcommand{\BOmega }{\boldsymbol{\Omega} } % \newcommand{\IA}{\mathbb{A}} \newcommand{\IB}{\mathbb{B}} \newcommand{\IC}{\mathbb{C}} \newcommand{\ID}{\mathbb{D}} \newcommand{\IE}{\mathbb{E}} \newcommand{\IF}{\mathbb{F}} \newcommand{\IG}{\mathbb{G}} \newcommand{\IH}{\mathbb{H}} \newcommand{\II}{\mathbb{I}} \renewcommand{\IJ}{\mathbb{J}} \newcommand{\IK}{\mathbb{K}} \newcommand{\IL}{\mathbb{L}} \newcommand{\IM}{\mathbb{M}} \newcommand{\IN}{\mathbb{N}} \newcommand{\IO}{\mathbb{O}} \newcommand{\IP}{\mathbb{P}} \newcommand{\IQ}{\mathbb{Q}} \newcommand{\IR}{\mathbb{R}} \newcommand{\IS}{\mathbb{S}} \newcommand{\IT}{\mathbb{T}} \newcommand{\IU}{\mathbb{U}} \newcommand{\IV}{\mathbb{V}} \newcommand{\IW}{\mathbb{W}} \newcommand{\IX}{\mathbb{X}} \newcommand{\IY}{\mathbb{Y}} \newcommand{\IZ}{\mathbb{Z}} % \newcommand{\FA}{\mathsf{A}} \newcommand{\FB}{\mathsf{B}} \newcommand{\FC}{\mathsf{C}} \newcommand{\FD}{\mathsf{D}} \newcommand{\FE}{\mathsf{E}} \newcommand{\FF}{\mathsf{F}} \newcommand{\FG}{\mathsf{G}} \newcommand{\FH}{\mathsf{H}} \newcommand{\FI}{\mathsf{I}} \newcommand{\FJ}{\mathsf{J}} \newcommand{\FK}{\mathsf{K}} \newcommand{\FL}{\mathsf{L}} \newcommand{\FM}{\mathsf{M}} \newcommand{\FN}{\mathsf{N}} \newcommand{\FO}{\mathsf{O}} \newcommand{\FP}{\mathsf{P}} \newcommand{\FQ}{\mathsf{Q}} \newcommand{\FR}{\mathsf{R}} \newcommand{\FS}{\mathsf{S}} \newcommand{\FT}{\mathsf{T}} \newcommand{\FU}{\mathsf{U}} \newcommand{\FV}{\mathsf{V}} \newcommand{\FW}{\mathsf{W}} \newcommand{\FX}{\mathsf{X}} \newcommand{\FY}{\mathsf{Y}} \newcommand{\FZ}{\mathsf{Z}} \newcommand{\Fa}{\mathsf{a}} \newcommand{\Fb}{\mathsf{b}} \newcommand{\Fc}{\mathsf{c}} \newcommand{\Fd}{\mathsf{d}} \newcommand{\Fe}{\mathsf{e}} \newcommand{\Ff}{\mathsf{f}} \newcommand{\Fg}{\mathsf{g}} \newcommand{\Fh}{\mathsf{h}} \newcommand{\Fi}{\mathsf{i}} \newcommand{\Fj}{\mathsf{j}} \newcommand{\Fk}{\mathsf{k}} \newcommand{\Fl}{\mathsf{l}} \newcommand{\Fm}{\mathsf{m}} \newcommand{\Fn}{\mathsf{n}} \newcommand{\Fo}{\mathsf{o}} \newcommand{\Fp}{\mathsf{p}} \newcommand{\Fq}{\mathsf{q}} \newcommand{\Fr}{\mathsf{r}} \newcommand{\Fs}{\mathsf{s}} \newcommand{\Ft}{\mathsf{t}} \newcommand{\Fu}{\mathsf{u}} \newcommand{\Fv}{\mathsf{v}} \newcommand{\Fw}{\mathsf{w}} \newcommand{\Fx}{\mathsf{x}} \newcommand{\Fy}{\mathsf{y}} \newcommand{\Fz}{\mathsf{z}} % \newcommand{\Fzero }{\mathsf{0}} \newcommand{\Fone }{\mathsf{1}} \newcommand{\Ftwo }{\mathsf{2}} \newcommand{\Fthree}{\mathsf{3}} \newcommand{\Ffour }{\mathsf{4}} \newcommand{\Ffive }{\mathsf{5}} \newcommand{\Fsix }{\mathsf{6}} \newcommand{\Fseven}{\mathsf{7}} \newcommand{\Feight}{\mathsf{8}} \newcommand{\Fnine }{\mathsf{9}} % \newcommand{\CA}{\mathcal{A}} \newcommand{\CB}{\mathcal{B}} \newcommand{\CC}{\mathcal{C}} \newcommand{\CD}{\mathcal{D}} \newcommand{\CE}{\mathcal{E}} \newcommand{\CF}{\mathcal{F}} \newcommand{\CG}{\mathcal{G}} \newcommand{\CH}{\mathcal{H}} \newcommand{\CI}{\mathcal{I}} \newcommand{\CJ}{\mathcal{J}} \newcommand{\CK}{\mathcal{K}} \newcommand{\CL}{\mathcal{L}} \newcommand{\CM}{\mathcal{M}} \newcommand{\CN}{\mathcal{N}} \newcommand{\CO}{\mathcal{O}} \newcommand{\CP}{\mathcal{P}} \newcommand{\CQ}{\mathcal{Q}} \newcommand{\CR}{\mathcal{R}} \newcommand{\CS}{\mathcal{S}} \newcommand{\CT}{\mathcal{T}} \newcommand{\CU}{\mathcal{U}} \newcommand{\CV}{\mathcal{V}} \newcommand{\CW}{\mathcal{W}} \newcommand{\CX}{\mathcal{X}} \newcommand{\CY}{\mathcal{Y}} \newcommand{\CZ}{\mathcal{Z}} % \newcommand{\KA}{\mathfrak{A}} \newcommand{\KB}{\mathfrak{B}} \newcommand{\KC}{\mathfrak{C}} \newcommand{\KD}{\mathfrak{D}} \newcommand{\KE}{\mathfrak{E}} \newcommand{\KF}{\mathfrak{F}} \newcommand{\KG}{\mathfrak{G}} \newcommand{\KH}{\mathfrak{H}} \newcommand{\KI}{\mathfrak{I}} \newcommand{\KJ}{\mathfrak{J}} \newcommand{\KK}{\mathfrak{K}} \newcommand{\KL}{\mathfrak{L}} \newcommand{\KM}{\mathfrak{M}} \newcommand{\KN}{\mathfrak{N}} \newcommand{\KO}{\mathfrak{O}} \newcommand{\KP}{\mathfrak{P}} \newcommand{\KQ}{\mathfrak{Q}} \newcommand{\KR}{\mathfrak{R}} \newcommand{\KS}{\mathfrak{S}} \newcommand{\KT}{\mathfrak{T}} \newcommand{\KU}{\mathfrak{U}} \newcommand{\KV}{\mathfrak{V}} \newcommand{\KW}{\mathfrak{W}} \newcommand{\KX}{\mathfrak{X}} \newcommand{\KY}{\mathfrak{Y}} \newcommand{\KZ}{\mathfrak{Z}} \newcommand{\Ka}{\mathfrak{a}} \newcommand{\Kb}{\mathfrak{b}} \newcommand{\Kc}{\mathfrak{c}} \newcommand{\Kd}{\mathfrak{d}} \newcommand{\Ke}{\mathfrak{e}} \newcommand{\Kf}{\mathfrak{f}} \newcommand{\Kg}{\mathfrak{g}} \newcommand{\Kh}{\mathfrak{h}} \newcommand{\Ki}{\mathfrak{i}} \newcommand{\Kj}{\mathfrak{j}} \newcommand{\Kk}{\mathfrak{k}} \newcommand{\Kl}{\mathfrak{l}} \newcommand{\Km}{\mathfrak{m}} \newcommand{\Kn}{\mathfrak{n}} \newcommand{\Ko}{\mathfrak{o}} \newcommand{\Kp}{\mathfrak{p}} \newcommand{\Kq}{\mathfrak{q}} \newcommand{\Kr}{\mathfrak{r}} \newcommand{\Ks}{\mathfrak{s}} \newcommand{\Kt}{\mathfrak{t}} \newcommand{\Ku}{\mathfrak{u}} \newcommand{\Kv}{\mathfrak{v}} \newcommand{\Kw}{\mathfrak{w}} \newcommand{\Kx}{\mathfrak{x}} \newcommand{\Ky}{\mathfrak{y}} \newcommand{\Kz}{\mathfrak{z}} % \newcommand{\Kzero }{\mathfrak{0}} \newcommand{\Kone }{\mathfrak{1}} \newcommand{\Ktwo }{\mathfrak{2}} \newcommand{\Kthree}{\mathfrak{3}} \newcommand{\Kfour }{\mathfrak{4}} \newcommand{\Kfive }{\mathfrak{5}} \newcommand{\Ksix }{\mathfrak{6}} \newcommand{\Kseven}{\mathfrak{7}} \newcommand{\Keight}{\mathfrak{8}} \newcommand{\Knine }{\mathfrak{9}} % $

$ \newcommand{\div}{\mathop{\rm div}\nolimits} \newcommand{\llbracket}{[[} \newcommand{\rrbracket}{]]} $

In lecture notes related to the Discontinuous Galerkin method, there is mention of a magic formula which AFAIK first appeared on a paper1 by Douglas Arnold (at least in this context).

It has been proven and all, but it’s still called magic because its reasoning is not apparent at first glance. The magic formula is actually a superset of the divergence theorem, generalized to discontinuous fields. But to make that generalization, we need to abandon the standard formulation which starts by creating a triangular mesh, and consider arbitrary partitionings of a domain.

A domain $\Omega$ is partitioned into parts $P^i$, $i=1,\dots,n$ as follows:

\[\Omega=\bigcup_{i=1}^{n} P^i\] \[\mathcal{P} = \{P^1,\dots,P^{n}\}\]

We call the set of parts $\mathcal{P}$ a partition of $\Omega$.

Broken Hilbert Spaces

We allow the vector field $\boldsymbol{u}$ to be discontinuous at boundaries $\partial P^i$ and continuous in $P^i$, $i=1,\dots,n$. To this end, we define the broken Hilbert space over partition $\mathcal{P}$

\[\begin{equation} H^m(\mathcal{P}) := \{\boldsymbol{v}\in L^2(\Omega)^{n_d} \mid \forall P\in\mathcal{P}, \boldsymbol{v}|_P \in H^m(P)\} \end{equation}\]

It can be seen that $H^m(\mathcal{P})\subseteq H^m(\Omega)$.

Part Boundaries

Topologically, a part may share boundary with $\Omega$, like $P^4$. In that case, the boundary of the part is divided into an interior boundary and exterior boundary:

\[\begin{equation} \partial P_{\text{ext}}^i = \partial P^i \cap \partial\Omega \quad\text{and}\quad \partial P_{\text{int}}^i = \partial P^i \setminus \partial P_{\text{ext}}^i \end{equation}\]

If a part has an exterior boundary, it is said to be an external part ($P^3$, $P^4$, $P^5$, $P^6$). If it does not have any exterior boundary, it is said to be an internal part.($P^1$, $P^2$).

Divergence theorem over parts

For a vector field $\boldsymbol{v}\in H^1(\mathcal{P})$, $i=1,\dots,n$, we can write the following integral as a sum and apply the divergence theorem afterward

\[\begin{equation} \begin{aligned} \int_\Omega \div{\boldsymbol{v}} \,dV &= \sum\limits_{i=1}^{n}\int_{P^i}\div\boldsymbol{v} \,dV = \sum\limits_{i=1}^{n}\int_{\partial P^i} \boldsymbol{v}\cdot\boldsymbol{n} \,dA \\ &= \sum\limits_{i=1}^{n}\int_{\partial P_{\text{ext}}^i} \boldsymbol{v}\cdot\boldsymbol{n} \,dA +\sum\limits_{i=1}^{n}\int_{\partial P_{\text{int}}^i} \boldsymbol{v}\cdot\boldsymbol{n} \,dA \end{aligned} \end{equation}\]

We define the portion $\Gamma^{ij}$ of the boundary that part $P^i$ shares with $P^j$ as the interface between $P^i$ and $P^j$.

\[\begin{equation} \Gamma^{ij} = \partial P^i \cap \partial P^j \end{equation}\]

If $P^i$ and $P^j$ are not neighbors, we simply have $\Gamma^{ij}=\emptyset$.

Integrals over interior boundaries

For opposing parts $P^i$ and $P^j$,

we have different values of the function $\boldsymbol{v}^{ij} = \boldsymbol{v}|_{\Gamma^{ij}}$ and conjugate normal vectors at the interface $\Gamma^{ij}$:

\[\begin{equation} \boldsymbol{v}^{ij}\neq\boldsymbol{v}^{ji} \quad\text{and}\quad \boldsymbol{n}^{ij} = -\boldsymbol{n}^{ji} \end{equation}\]

Since

\[\begin{equation} \partial P_{\text{int}}^i = \bigcup_{j=1}^{n} \Gamma^{ij} \quad \text{for}\quad i=1,\dots,n \end{equation}\]

we can rearrange the integral over interior boundaries as

\[\begin{equation} \sum\limits_{i=1}^{n}\int_{\partial P_{\text{int}}^i} \boldsymbol{v}\cdot\boldsymbol{n} \,dA = \sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}\int_{\Gamma^{ij}} \boldsymbol{v}^{ij}\cdot\boldsymbol{n}^{ij} \,dA \end{equation}\]

The jump operator

Integrals over the same interface can be grouped together:

\[\begin{equation} \sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}\int_{\Gamma^{ij}} \boldsymbol{v}^{ij}\cdot\boldsymbol{n}^{ij} \,dA = \sum\limits_{i=1}^{n}\sum\limits_{j=i}^{n}\int_{\Gamma^{ij}\equiv\Gamma^{ji}} (\boldsymbol{v}^{ij}\cdot\boldsymbol{n}^{ij} + \boldsymbol{v}^{ji}\cdot\boldsymbol{n}^{ji}) \,dA \end{equation}\]

Defining the jump of $\boldsymbol{v}$ across $\Gamma^{ij}$

\[\begin{equation} \llbracket\boldsymbol{v}\rrbracket_{\Gamma^{ij}} = \boldsymbol{v}^{ij} - \boldsymbol{v}^{ji} \end{equation}\]

The jump of a function measures its discontinuity across interfaces. We can write

\[\begin{equation} \int_{\Gamma^{ij}} \llbracket\boldsymbol{v}\rrbracket_{\Gamma^{ij}}\cdot\boldsymbol{n}^{ij} \,dA = \int_{\Gamma^{ij}} (\boldsymbol{v}^{ij}\cdot\boldsymbol{n}^{ij} + \boldsymbol{v}^{ji}\cdot\boldsymbol{n}^{ji}) \,dA \end{equation}\]

We may drop the superscripts where there is no confusion.

Interfaces and external boundaries

It is convenient to group the interfaces:

\[\begin{equation} \boxed{ \mathcal{I} := \{\Gamma^{ij}\mid i=1,\dots,n; j=i,\dots,n\} } \end{equation}\]

which allows us to write

\[\begin{equation} \sum\limits_{i=1}^{n}\sum\limits_{j=i}^{n} \int_{\Gamma^{ij}} \llbracket\boldsymbol{v}\rrbracket\cdot\boldsymbol{n} \,dA = \sum\limits_{\Gamma\in\mathcal{I}} \int_{\Gamma} \llbracket\boldsymbol{v}\rrbracket\cdot\boldsymbol{n}\,dA \end{equation}\]

It’s obvious that the union of part external boundaries equals the domain boundary:

\[\begin{equation} \bigcup_{i=1}^{n} \partial P_{\text{ext}}^i = \partial \Omega \end{equation}\]

which allows us to write

\[\begin{equation} \sum\limits_{i=1}^{n}\int_{\partial P_{\text{ext}}^i} \boldsymbol{v}\cdot\boldsymbol{n} \,dA = \int_{\partial\Omega} \boldsymbol{v}\cdot\boldsymbol{n} \,dA \end{equation}\]

With the results obtained, we put forward a generalized version of the divergence theorem: Let $\boldsymbol{v}\in H^1(\mathcal{P})$ be a vector field. Then we have

\[\begin{equation} \boxed{ \int_\Omega \div\boldsymbol{v} \,dV = \int_{\partial\Omega} \boldsymbol{v}\cdot\boldsymbol{n} \,dA + \sum\limits_{\Gamma\in\mathcal{I}} \int_{\Gamma} \llbracket\boldsymbol{v}\rrbracket\cdot\boldsymbol{n} \,dA } \end{equation}\]

Verbally, the integral of the divergence of a vector field over a domain $\Omega$ equals its integral over the domain boundary $\partial\Omega$, plus the integral of its jump over part interfaces $\mathcal{I}$.

In the case of a continuous field, the jumps vanish and this reduces to the regular divergence theorem.

The Magic Formula

There are different versions of the magic formula for scalar, vector and tensor fields, and for different IBVPs. I won’t try to derive them all, but give an example: If we were substitute a linear mapping $\boldsymbol{A}\boldsymbol{v}$ instead of $\boldsymbol{v}$, we would have the jump $\llbracket \boldsymbol{A}\boldsymbol{v} \rrbracket$ on the right-hand side.

We introduce the vector and tensor average operator \(\{\cdot\}\)

\[\begin{equation} \{\boldsymbol{v}\}_{\Gamma^{ij}} = \frac{1}{2} (\boldsymbol{v}^{ij} + \boldsymbol{v}^{ji}) \quad\text{and}\quad \{\boldsymbol{A}\}_{\Gamma^{ij}} = \frac{1}{2} (\boldsymbol{A}^{ij} + \boldsymbol{A}^{ji}) \end{equation}\]

and tensor jump operator $\llbracket\cdot\rrbracket$

\[\begin{equation} \llbracket\boldsymbol{A}\rrbracket_{\Gamma^{ij}} = \boldsymbol{A}^{ij} - \boldsymbol{A}^{ji} \end{equation}\]

We also note the boundary jump/average property which is used on the integral over $\partial\Omega$

\[\begin{equation} \boxed{ \{\boldsymbol{v}\} = \llbracket\boldsymbol{v}\rrbracket = \boldsymbol{v} \quad \text{on}\quad\partial\Omega } \label{eq:property1} \end{equation}\]

(This property is used implicitly in many places, and often causes confusion).

These definitions allow us to write the identity

\[\begin{equation} \boxed{ \llbracket\boldsymbol{A}\boldsymbol{v}\rrbracket = \llbracket\boldsymbol{A}\rrbracket\{\boldsymbol{v}\} + \{\boldsymbol{A}\}\llbracket\boldsymbol{v}\rrbracket } \end{equation}\]

which is easily proven when expanded.

The different versions of the magic formula are obtained by substituting the identities above—or their analogs—in the discontinuous divergence theorem.

  1. Douglas N. Arnold. An interior penalty finite element method with discontinuous elements. SIAM J. Numer. Anal., 19(4):742–760, 1982.