Skip to content

A2 3-D operators ​

IDGroupTypeBackendsFigureProgram
A2AccuracyPCPU (gfortran R4P, R8P, R16P; nvfortran); the CI matrixnogideon_test_operators_3d

Case and scope ​

The gradient, divergence, curl and Laplacian are sums of 1-D kernels over directional stencils, gathered by the caller (ADAM's FNL signature: vy_x is the y component along x). What can go wrong is not a row, already verified, but the wiring: a component on the wrong axis, a step of another direction, a sign of the curl. This case checks each operator, FD and FV, at every order, through its run-time dispatcher, against exact derivatives of random polynomials, with unequal steps so that a swapped step shows. Their equality with ADAM's 3-D operators is in C5.

Models and numerics ​

ItemChoiceCode
Fieldsthree random polynomials of total degree p (the order), coefficients in [−1,1], around (0.3,−0.2,0.1); steps (0.5,0.25,0.75)gideon_test_operators_3d.F90
FD datapoint values along each axisline
FV dataaverages over the 1-D cells along the axis of each stencil (the cells the FV operators difference); targets the averages of the derivatives over that cellline, dmean
Exactnessa first derivative of order p is exact on degree p, a second derivative of order p on degree p+1: both on these fields
Assertederror ≤104ε(1+max|data|)/min(h)n, frozencheck
NaNorder 3 (no kernel) returns NaN from the gradient and the Laplacian, FD and FV
Operatorsbelow, one dispatcher per operator and datagideon_operators_3d.F90 (generated)
DataOperatorOrdersDispatcher
FDgradient2, 4, 6, 8, 10gideon_fd_gradient_c
FDdivergence2, 4, 6, 8, 10gideon_fd_divergence_c
FDcurl2, 4, 6, 8, 10gideon_fd_curl_c
FDlaplacian2, 4, 6, 8, 10gideon_fd_laplacian_c
FVgradient2, 4, 6, 8, 10gideon_fv_gradient_c
FVdivergence2, 4, 6, 8, 10gideon_fv_divergence_c
FVcurl2, 4, 6, 8, 10gideon_fv_curl_c
FVlaplacian2, 4, 6, 8, 10gideon_fv_laplacian_c

Program ​

bash
./exe/gideon_test_operators_3d

Results ​

BuildCasesFailures
gfortran, R4P4 operators x 2 data x 5 orders0
gfortran, R8P4 operators x 2 data x 5 orders0
gfortran, R16P4 operators x 2 data x 5 orders0
nvfortran -acc, R8P4 operators x 2 data x 5 orders0

Findings ​

  • Every operator is exact on polynomials of its degree, with unequal steps, in every kind: the stencils and the steps are wired to the right axes.
  • The test is exactness, not convergence: the 3-D operators add no arithmetic beyond the 1-D kernels' (a sum per component), so their orders are those of A1. Three of the mutants of Mutation testing (a curl component, a divergence step, a Laplacian direction) are killed here and by C5.

Released under your choice of GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT.