-
Notifications
You must be signed in to change notification settings - Fork 172
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
base: development
Are you sure you want to change the base?
Fixing bug with the ES solver and MR: E_aux[lev] = E_fp[lev] in the UpdateAuxilaryData #4922
Conversation
…lgorithms with PML BC
for more information, see https://pre-commit.ci
…y_update_es_solver
for more information, see https://pre-commit.ci
…y_update_es_solver
…/oshapoval/WarpX into mr_fix_auxilary_update_es_solver
for more information, see https://pre-commit.ci
…lysis script with smaller MR patch.
…y_update_es_solver
…/oshapoval/WarpX into mr_fix_auxilary_update_es_solver
for more information, see https://pre-commit.ci
…/oshapoval/WarpX into mr_fix_auxilary_update_es_solver
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
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
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
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 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 asE_aux[lev] = E_fp[lev]
(insideWarpX::UpdateAuxilaryDataStagToNodal()
andWarpX::UpdateAuxilaryDataSameType()
rather thanE_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:
WarpX::UpdateAuxilaryDataStagToNodal ()
amr.max_level = 1
(reused CI testelectrostatic_sphere_eb_mr
)Results after the fix:
Figure(1): with MR patch occupying the whole simulation box:
Figure(2): with MR patch smaller than the simulation box: