Use simple average when computing cell-centered B #122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The current second-order accurate conversion from face-averaged to cell-centered B field
references the volume centered and cell face and volume center positions to compute the weighted average coefficients, for example:
which should reduce to 0.5 for uniform Cartesian coordinates. However, due to floating point round-off error,
x2f(j+1) - x2v(j) != dx2f(j)/2.0
e.g., so the coefficientslw, rw
wont add up to 1.0 exactly. Note for uniform meshes,dx2f = dx2v
exactly, but the positions are inexact.This PR simply uses the existing
uniform_limiter[3]
switches in the Reconstruction class to determine if the simple averaging formula can be used to compute the cell-centered magnetic field from the face-averaged magnetic fields in each direction.Testing and validation
mhd-rotor-2D-nx1-32-ic-Bcc1-master.pdf plots the current
nx1=nx2=20
withNGHOST=2
initial conditionBcc1
for the 2D MHD rotor problem. The ghost zones are also shown. The initial condition is supposed to have uniform B1 corresponding tobx0=1.410474
requested in theathinput.rotor
file, but banding of deviations appear in x1 ranging from min/max:Since the fixes in #98, the deviations are symmetric about the midplane.
mhd-rotor-2D-nx1-32-ic-Bcc1-fix.pdf shows the uniform Bcc1 after the adding the switch in this PR, where all zones real and ghost have
equivalent to 0552802248421E0 in binary.
To-do