A2 3-D operators
| ID | Group | Type | Backends | Figure | Program |
|---|---|---|---|---|---|
| A2 | Accuracy | P | CPU (gfortran R4P, R8P, R16P; nvfortran); the CI matrix | no | gideon_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
| Item | Choice | Code |
|---|---|---|
| Fields | three random polynomials of total degree | gideon_test_operators_3d.F90 |
| FD data | point values along each axis | line |
| FV data | averages 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 cell | line, dmean |
| Exactness | a first derivative of order | |
| Asserted | error | check |
| NaN | order 3 (no kernel) returns NaN from the gradient and the Laplacian, FD and FV | |
| Operators | below, one dispatcher per operator and data | gideon_operators_3d.F90 (generated) |
| Data | Operator | Orders | Dispatcher |
|---|---|---|---|
| FD | gradient | 2, 4, 6, 8, 10 | gideon_fd_gradient_c |
| FD | divergence | 2, 4, 6, 8, 10 | gideon_fd_divergence_c |
| FD | curl | 2, 4, 6, 8, 10 | gideon_fd_curl_c |
| FD | laplacian | 2, 4, 6, 8, 10 | gideon_fd_laplacian_c |
| FV | gradient | 2, 4, 6, 8, 10 | gideon_fv_gradient_c |
| FV | divergence | 2, 4, 6, 8, 10 | gideon_fv_divergence_c |
| FV | curl | 2, 4, 6, 8, 10 | gideon_fv_curl_c |
| FV | laplacian | 2, 4, 6, 8, 10 | gideon_fv_laplacian_c |
Program
bash
./exe/gideon_test_operators_3dResults
| Build | Cases | Failures |
|---|---|---|
| gfortran, R4P | 4 operators x 2 data x 5 orders | 0 |
| gfortran, R8P | 4 operators x 2 data x 5 orders | 0 |
| gfortran, R16P | 4 operators x 2 data x 5 orders | 0 |
| nvfortran -acc, R8P | 4 operators x 2 data x 5 orders | 0 |
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.