Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MHD constrained transport calculations create asymmetric floating-point errors #165

Open
felker opened this issue Oct 6, 2018 · 0 comments
Assignees
Labels
bug Broken functionality or unexpected result MHD Relating to components involving the B field testing Regression test suite and CI
Projects
Milestone

Comments

@felker
Copy link
Contributor

felker commented Oct 6, 2018

Bug report

Summary of issue:

This has been a known issue since April 2018, but I am filing a bug report now in order to document it and help track down the source of the problem soon.

The constrained transport scheme introduces small asymmetries in problems that should be perfectly symmetric: first in the B field, then in the Hydro variables. The high-order solver quickly amplifies these differences into visible asymmetries. I have confirmed that these differences occur even with the second-order scheme with time/xorder=2 PLM and time/integrator=vl2; solving the Orszag-Tang problem at high-resolution will produce visible asymmetries even at second-order accuracy.

Partial fixes have already been applied to various MHD algorithmic components:

Nevertheless, symmetry is still imperfect in the Orszag-Tang solutions, and others have reported asymmetries with a Magnetized Noh implosion problem variant solved using the second order scheme with PPM reconstruction: figure_1

The issue is almost certainly due to the left-to-right associativity of floating-point arithmetic in the calculations of the electric field gradients and the upwinded average at the corner:

// integrate E3 to corner using SG07
for (int k=ks; k<=ke; ++k) {
for (int j=js; j<=je+1; ++j) {
#pragma omp simd
for (int i=is; i<=ie+1; ++i) {
Real de3_l2 = (1.0-w_x1f(k,j-1,i))*(e3_x2f(k,j,i ) - cc_e_(k,j-1,i )) +
( w_x1f(k,j-1,i))*(e3_x2f(k,j,i-1) - cc_e_(k,j-1,i-1));
Real de3_r2 = (1.0-w_x1f(k,j ,i))*(e3_x2f(k,j,i ) - cc_e_(k,j ,i )) +
( w_x1f(k,j ,i))*(e3_x2f(k,j,i-1) - cc_e_(k,j ,i-1));
Real de3_l1 = (1.0-w_x2f(k,j,i-1))*(e3_x1f(k,j ,i) - cc_e_(k,j ,i-1)) +
( w_x2f(k,j,i-1))*(e3_x1f(k,j-1,i) - cc_e_(k,j-1,i-1));
Real de3_r1 = (1.0-w_x2f(k,j,i ))*(e3_x1f(k,j ,i) - cc_e_(k,j ,i )) +
( w_x2f(k,j,i ))*(e3_x1f(k,j-1,i) - cc_e_(k,j-1,i ));
e3(k,j,i) = 0.25*(de3_l1 + de3_r1 + de3_l2 + de3_r2 + e3_x2f(k,j,i-1) +
e3_x2f(k,j,i) + e3_x1f(k,j-1,i) + e3_x1f(k,j,i));
}
}}

However, the CT operations contain many more terms than the analogous sources of asymmetry fixed in #144 (viscosity), #98 (PPM), #112 (x1f calculations), #114 (AMR/SMR prolongation and restriction operators) since those are all 1D stencils. So, rearranging the terms to guarantee that there is no directional bias to the floating-point round-off error will be more difficult.

Proposed steps:

  • Start debugging with the simpler mirror symmetry of the MHD R-T problem before attempting to fix the rotational symmetry of Orszag-Tang
@felker felker added bug Broken functionality or unexpected result testing Regression test suite and CI MHD Relating to components involving the B field labels Oct 6, 2018
@felker felker self-assigned this Oct 6, 2018
@felker felker added this to Needs triage in Bugs Oct 9, 2018
@felker felker added this to the v1.1.x milestone Oct 9, 2018
@felker felker moved this from Needs triage to Low priority in Bugs Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken functionality or unexpected result MHD Relating to components involving the B field testing Regression test suite and CI
Projects
Bugs
  
Low priority
Development

No branches or pull requests

1 participant