Open MTCam opened 1 year ago
Adding uniform noise of magnitude (in front of arrow) results in magnitude (behind arrow):
# 0 -> 1.4e-11
# 1e-14 -> 1.7e-11
# 1e-13 -> 3.5e-11
# 1e-12 -> 2.9e-10
IF ( 1e-11 -> ~3e-09 AND same trend for easy/lazy/numpy ) THEN “I might be a believer” END IF
More data:
# Eager
# 0 -> 1.4e-11
# 1e-14 -> 1.7e-11
# 1e-13 -> 3.5e-11
# 1e-12 -> 2.9e-10
# 1e-11 -> 3e-9
# Lazy
# 0 -> 1.1e-11
# 1e-14 -> 1.3e-11
# 1e-13 -> 3e-11
# 1e-12 -> 3.1e-10
# 1e-11 -> 2.8e-9
Evaluating your conditional @jbfreund, you might be a believer? :slightly_smiling_face:
Assert(@jbfreund is a believer)
I do think we're seeing roundoff errors.
A possible explanation for lower errors near the origin is that the Jacobians arise from differentiating the nodal field (aka the interpolant of the local-to-global map). Those increase as you get away from the origin (that's their job), and so the Jacobians pick up increasing amounts of cancellation error as you get away from the origin.
We have noticed that there seems to be some numerical artifacts in the result of gradient (or any weak differentiation operator) which we import from
grudge
. The example below prescribes a uniform constant field $A$ on a periodic 2d mesh [-0.5, 0.5 ] x [-0.5, 0.5], and then computes the gradient with weak operators using a central flux ($\frac{A^- + A^+}{2}\hat{\mathbf{n}})$. The exact answer is 0, so we expect the computed answer to be 0(ish). For weak operators, the results seem to have abnormally high magnitude and an unexplained spatial dependence. Strong form gradients appear to have nominal behavior.The magnitude of the weak operator errors increases with increasing distance from the absolute physical space origin (0, 0, 0). The error behaves as roundoff, proportional to the magnitude of the input field, and to the inverse of the grid spacing.
As a consequence of these errors, comparisons of results computed between different array contexts (eager vs. lazy vs. numpy) often fails when compared quantities involve derivatives.
Snapshot of the computed weak form $\nabla{A}, A=10^5$:
Snapshot of the computed strong form gradient ($\nabla{A}, A=10^5$):
The code to reproduce:
From offline discussions:
blah blah blah
Open questions:
HWCode = Codes-1.1
(code that goes with Hesthaven/Warburton Nodal DG book) appears to be subject to roundoff, but not like mirgecomGradient (HWCode/Grad2D) magnitude for constant ($A = 10^5$) scalar field:
HWCode/Grad2D: