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

Fixing bug with the ES solver and MR: E_aux[lev] = E_fp[lev] in the UpdateAuxilaryData #4922

Open
wants to merge 27 commits into
base: development
Choose a base branch
from

Conversation

oshapoval
Copy link
Member

@oshapoval oshapoval commented May 10, 2024

This PR fixes a bug with the ES solver and MR. This issues was initially observed by @aeriforme. Worked on the issue with @RemiLehe.
Problem: observed doubling of the E field for lev>0.
Solution: when ES solver is used we have E_cp[levl] =0 and we should update the auxiliary data as E_aux[lev] = E_fp[lev] (inside WarpX::UpdateAuxilaryDataStagToNodal() and WarpX::UpdateAuxilaryDataSameType() rather than E_aux[lev] = E_fp[lev] - E_cp[lev] + E_aux[lev-1] in contrast to the EM solver. Otherwise it would result in doubling of E field we observed.

To do:

  • do the same in WarpX::UpdateAuxilaryDataStagToNodal ()
  • add CI test with amr.max_level = 1 (reused CI test electrostatic_sphere_eb_mr)
  • fix scrapping CI tests.
    Results after the fix:
    Figure(1): with MR patch occupying the whole simulation box:
    Figure 32-4

Figure(2): with MR patch smaller than the simulation box:
Figure 31-6

@oshapoval oshapoval requested a review from RemiLehe May 10, 2024 01:12
@ax3l ax3l added bug Something isn't working component: electrostatic electrostatic solver bug: affects latest release Bug also exists in latest release version component: mesh refinement (A)MR labels May 12, 2024
@RemiLehe RemiLehe self-assigned this May 20, 2024
for j in np.arange(0,nj,1):
if (matrix[i][j] != 0) and (matrix[i][j] != np.nan):
return (i, j)
stop

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
for j in np.arange(nj-1, -1, -1):
if (matrix[i][j] != 0) and (matrix[i][j] != np.nan):
return (i, j)
stop

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
for j in np.arange(0,nj,1):
if (matrix[i][j] != 0) and (matrix[i][j] != np.nan):
return (i, j)
stop

Check warning

Code scanning / CodeQL

Unreachable code Warning

This statement is unreachable.
for j in np.arange(nj-1, -1, -1):
if (matrix[i][j] != 0) and (matrix[i][j] != np.nan):
return (i, j)
stop

Check warning

Code scanning / CodeQL

Unreachable code Warning

This statement is unreachable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working component: electrostatic electrostatic solver component: mesh refinement (A)MR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants