Skip to main content

Implementation details

For a cell with volume VV, Gauss' theorem is applied to give:

u=1VV(u)dV=1VS(nu)dS=1VinFaceuf,iSf,i \div \u = \frac{1}{V}\int_V \left( \div \u \right) dV = \frac{1}{V} \oint_S \left( \vec{n} \dprod \u \right) d\vec{S} = \frac{1}{V} \sum_i^{\mathrm{nFace}}\u_{f,i} \dprod \vec{S}_{f,i}

i.e. the divergence is given by the sum over all faces of the dot product of the face normal with the vector quantity at the face. To transform the quantity from the cell centre to the face centre, an interpolation scheme is required.

The divergence term contributions enter the system of equations via the owner and neighbour cells (see gaussConvectionScheme.C)

fvm.lower() = -weights.internalField()*faceFlux.internalField();
fvm.upper() = fvm.lower() + faceFlux.internalField();
fvm.negSumDiag();

The overall weights ww are derived from the selected scheme weights, Ψ\Psi, and the linear wlw_l interpolation weights, such that for a positive flux:

w=wlΨ+(1Ψ)u w = w_l \Psi + (1 - \Psi)_u

where the subscript ()u()_u denotes the upwind contribution. The face values are then calculated as:

ϕf=ϕN+w(ϕPϕN) \phi_f = \phi_N + w \left(\phi_P - \phi_N \right)

Source code: