Skip to content

Commit

Permalink
fix normalization of charge density
Browse files Browse the repository at this point in the history
  • Loading branch information
roelof-groenewald committed Sep 30, 2024
1 parent e49017e commit 705bc70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,8 @@ void HybridPICModel::HybridPICPoissonSolve (
*(m_electrostatic_solver->m_poisson_boundary_handler) = boundary_handler_copy;
for (int lev = 0; lev <= finest_level; ++lev)
{
// Multiply charge density with -eps0 to get proper charge density (this
// involves a peculiarity of the ES solver in which we don't rescale rho
// back after the Poisson solve)
rho_fp_temp[lev]->mult(-ablastr::constant::SI::ep0);
// Multiply charge density with -1 to now get the proper charge density
rho_fp_temp[lev]->mult(-1);
}
// Appropriately set domain boundary potentials
m_electrostatic_solver->setPhiBC(phi_fp, warpx.gett_new(0));
Expand Down
4 changes: 2 additions & 2 deletions Source/ablastr/fields/SemiImplicitPoissonSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ computeSemiImplicitPhi (
for (int lev=0; lev<=finest_level; lev++) {

// Use the Multigrid (MLMG) solver but first scale rho appropriately
using namespace ablastr::constant::SI;
rho[lev]->mult(-1._rt/ep0); // TODO: when do we "un-multiply" this? We need to document this side-effect!
rho[lev]->mult(-1._rt/ablastr::constant::SI::ep0);

#if defined(AMREX_USE_EB) || defined(WARPX_DIM_RZ)
// Use the EB enabled solver.
Expand Down Expand Up @@ -246,6 +245,7 @@ computeSemiImplicitPhi (
post_phi_calculation.value()(mlmg, lev);
}
}
rho[lev]->mult(-ablastr::constant::SI::ep0); // Multiply rho by epsilon again

} // loop over lev(els)
}
Expand Down

0 comments on commit 705bc70

Please sign in to comment.