From 80d468572d6a12bc514f274cb7ae95f3582eb6e5 Mon Sep 17 00:00:00 2001 From: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> Date: Tue, 25 Jan 2022 15:01:59 -0800 Subject: Add SyncRho call to warpx_depositChargeDensity (#2777) * add SyncRho call to warpx_depositChargeDensity * expose SyncRho to Python; add warpx_clearChargeDensity to reset rho_fp before deposition * remove unneeded warpx_clearChargeDensity function * Apply suggestions from code review Co-authored-by: Axel Huebl * add (default) option to depositChargeDensity to call SyncRho after deposition * added option to depositChargeDensity to zero out rho_fp before deposition * code cleanup * import fields from inside depositChargeDensity Co-authored-by: Axel Huebl --- Source/Python/WarpXWrappers.H | 1 + Source/Python/WarpXWrappers.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'Source/Python') diff --git a/Source/Python/WarpXWrappers.H b/Source/Python/WarpXWrappers.H index bd47a3ebb..9c9f63133 100644 --- a/Source/Python/WarpXWrappers.H +++ b/Source/Python/WarpXWrappers.H @@ -127,6 +127,7 @@ extern "C" { void warpx_EvolveB (amrex::Real dt, DtType a_dt_type); void warpx_FillBoundaryE (); void warpx_FillBoundaryB (); + void warpx_SyncRho (); void warpx_SyncCurrent (); void warpx_UpdateAuxilaryData (); void warpx_PushParticlesandDepose (amrex::Real cur_time); diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp index 061e80c6a..6703bb665 100644 --- a/Source/Python/WarpXWrappers.cpp +++ b/Source/Python/WarpXWrappers.cpp @@ -623,9 +623,6 @@ namespace return; } - // reset rho before depositing - rho_fp->setVal(0.); - for (WarpXParIter pti(myspc, lev); pti.isValid(); ++pti) { const long np = pti.numParticles(); @@ -662,6 +659,10 @@ namespace WarpX& warpx = WarpX::GetInstance(); warpx.FillBoundaryB (warpx.getngE()); } + void warpx_SyncRho () { + WarpX& warpx = WarpX::GetInstance(); + warpx.SyncRho(); + } void warpx_SyncCurrent () { WarpX& warpx = WarpX::GetInstance(); warpx.SyncCurrent (); -- cgit v1.2.3