vc_stokes: Compare circulation and curl flux in Stokes' theorem

View source: R/stokes.R

vc_stokesR Documentation

Compare circulation and curl flux in Stokes' theorem

Description

Compare circulation and curl flux in Stokes' theorem

Usage

vc_stokes(
  field,
  surface,
  u_range,
  v_range,
  jacobian = NULL,
  curl = NULL,
  orientation = c("forward", "reverse"),
  h = NULL,
  curl_h = NULL,
  boundary_method = c("simpson", "trapezoid", "adaptive"),
  n_boundary = 16L,
  method = c("simpson", "trapezoid"),
  n_outer = 8L,
  n_inner = 8L,
  abs_tol = 1e-08,
  rel_tol = 1e-08
)

Arguments

field

Spatial vector field accepting one Cartesian vector.

surface

Function of one vector c(u,v) returning a finite Cartesian three-vector.

u_range, v_range

Finite strictly increasing parameter endpoint pairs.

jacobian

Optional function of c(u,v) returning a finite real 3 by 2 matrix, with surface derivatives as columns. Defaults to vc_jacobian().

curl

Optional function of position giving the three Cartesian curl components. Defaults to vc_curl().

orientation

Forward uses the u derivative crossed with the v derivative. Reverse negates the normal and reverses the boundary.

h

Optional numerical Jacobian step or two coordinate steps.

curl_h

Optional numerical step or three coordinate steps for curl.

boundary_method

Rule for vc_line_integral().

n_boundary

Initial fixed-rule cell count per boundary edge.

method

Simpson or trapezoid rule.

n_outer, n_inner

Initial cell counts, refined at both levels.

abs_tol, rel_tol

Nonnegative diagnostic tolerances, one positive.

Details

The boundary follows the four edges of the parameter rectangle. Forward traversal starts along increasing u at minimum v. A supplied surface Jacobian is also used for edge velocities. The caller supplies the smoothness, orientation and boundary hypotheses of Stokes' theorem. Multiple charts, trimming and topology inference are outside this API. Central stencils can leave the supplied domains. Agreement is diagnostic.

Value

List with boundary circulation, curl flux, signed difference, comparison tolerance, both quadrature results and derivative diagnostics.

Examples

patch <- function(p)c(p[1],p[2],p[1]+p[2])
vc_stokes(function(p)c(-p[2],p[1],0),patch,c(0,1),c(0,1),
  n_boundary=4,n_outer=2,n_inner=2)$curl_flux

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