vc_gauss: Compare outward flux and volume divergence in Gauss' theorem

View source: R/gauss.R

vc_gaussR Documentation

Compare outward flux and volume divergence in Gauss' theorem

Description

Compare outward flux and volume divergence in Gauss' theorem

Usage

vc_gauss(
  field,
  x_range,
  y_range,
  z_range,
  divergence = NULL,
  h = NULL,
  method = c("simpson", "trapezoid"),
  n_outer = 4L,
  n_middle = 4L,
  n_inner = 4L,
  abs_tol = 1e-08,
  rel_tol = 1e-08
)

Arguments

field

Function of one Cartesian vector returning a finite three-component vector.

x_range, y_range, z_range

Finite strictly increasing endpoint pairs defining an axis-aligned box.

divergence

Optional function of position giving the scalar divergence. Defaults to vc_divergence().

h

Optional numerical divergence step or three coordinate steps.

method

Simpson or trapezoid fixed quadrature.

n_outer, n_middle, n_inner

Initial cell counts, each refined internally.

abs_tol, rel_tol

Nonnegative diagnostic tolerances, one positive.

Details

The six outward unit normals are exact signed coordinate axes. The same coordinate-specific cell counts are used on each face and in the volume, with x outermost, then y and z. The caller supplies a C1 field on a neighborhood of the box. Central stencils can leave the box. Numerical agreement does not establish theorem hypotheses and quadrature indicators do not include derivative error.

Value

List with total outward flux, volume divergence, signed difference (flux minus divergence integral), comparison tolerance, per-face flux and quadrature diagnostics, outward normals and derivative sensitivity.

Examples

vc_gauss(identity,c(0,1),c(0,1),c(0,1),n_outer=2,n_middle=2,n_inner=2)$outward_flux

vectorialcalculus documentation built on Nov. 17, 2026, 1:09 a.m.