aboutsummaryrefslogtreecommitdiff
path: root/Source/Python
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2021-08-26 13:03:40 -0700
committerGravatar GitHub <noreply@github.com> 2021-08-26 13:03:40 -0700
commit71fbd848580b1d249a4c6dc7f3bb1b253d631b87 (patch)
tree778fd6ff5c033b833a0e0100abaa11347405cf05 /Source/Python
parentdf4504de42360074b9cfdcef8c03d248459c047e (diff)
downloadWarpX-71fbd848580b1d249a4c6dc7f3bb1b253d631b87.tar.gz
WarpX-71fbd848580b1d249a4c6dc7f3bb1b253d631b87.tar.zst
WarpX-71fbd848580b1d249a4c6dc7f3bb1b253d631b87.zip
Improvement in electrostic field solve when using EB & a small refactoring of the Electrostatic solver (#2143)
* refactored parts of the electrostatic solver to allow an outside Poisson solver to be installed * added callback to install a Poisson solver that can be used instead of the MLMG solver * added call to the poissonsolver callback if one is installed and updated ElectrostaticSolver.cpp to calculate the electric field directly in amrex if EBs are used * fixed issue causing ElectrostaticSphereEB test to crash * fixed the logic for when to call computeE * added function to allow charge density to be deposited in rho_fp from outside WarpX * fixed inconsistency between labframe and relativistic electrostatic simulation setup * fixed typo * fixed issue that caused ElectrostaticSphere test to fail and removed unnecessary call to multiply E_y by -1 when doing a 2d simulation * revert edit to error handling string * changes requested during PR review * additional change requested during PR review * fixed typo * revert unnecessary changes
Diffstat (limited to 'Source/Python')
-rw-r--r--Source/Python/WarpXWrappers.cpp4
-rw-r--r--Source/Python/WarpXWrappers.h1
-rw-r--r--Source/Python/WarpX_py.H1
-rw-r--r--Source/Python/WarpX_py.cpp1
4 files changed, 7 insertions, 0 deletions
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp
index 24ee25dcf..1450011f9 100644
--- a/Source/Python/WarpXWrappers.cpp
+++ b/Source/Python/WarpXWrappers.cpp
@@ -181,6 +181,10 @@ extern "C"
{
warpx_py_beforeEsolve = callback;
}
+ void warpx_set_callback_py_poissonsolver (WARPX_CALLBACK_PY_FUNC_0 callback)
+ {
+ warpx_py_poissonsolver = callback;
+ }
void warpx_set_callback_py_afterEsolve (WARPX_CALLBACK_PY_FUNC_0 callback)
{
warpx_py_afterEsolve = callback;
diff --git a/Source/Python/WarpXWrappers.h b/Source/Python/WarpXWrappers.h
index 9237cefe5..53d461e65 100644
--- a/Source/Python/WarpXWrappers.h
+++ b/Source/Python/WarpXWrappers.h
@@ -52,6 +52,7 @@ extern "C" {
void warpx_set_callback_py_afterinit (WARPX_CALLBACK_PY_FUNC_0);
void warpx_set_callback_py_beforeEsolve (WARPX_CALLBACK_PY_FUNC_0);
+ void warpx_set_callback_py_poissonsolver (WARPX_CALLBACK_PY_FUNC_0);
void warpx_set_callback_py_afterEsolve (WARPX_CALLBACK_PY_FUNC_0);
void warpx_set_callback_py_beforedeposition (WARPX_CALLBACK_PY_FUNC_0);
void warpx_set_callback_py_afterdeposition (WARPX_CALLBACK_PY_FUNC_0);
diff --git a/Source/Python/WarpX_py.H b/Source/Python/WarpX_py.H
index a40df9728..dff61c2b5 100644
--- a/Source/Python/WarpX_py.H
+++ b/Source/Python/WarpX_py.H
@@ -15,6 +15,7 @@ extern "C" {
extern WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterinit;
extern WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforeEsolve;
+ extern WARPX_CALLBACK_PY_FUNC_0 warpx_py_poissonsolver;
extern WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterEsolve;
extern WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforedeposition;
extern WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterdeposition;
diff --git a/Source/Python/WarpX_py.cpp b/Source/Python/WarpX_py.cpp
index f53bc007c..79beed3c6 100644
--- a/Source/Python/WarpX_py.cpp
+++ b/Source/Python/WarpX_py.cpp
@@ -12,6 +12,7 @@ extern "C" {
WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterinit = nullptr;
WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforeEsolve = nullptr;
+ WARPX_CALLBACK_PY_FUNC_0 warpx_py_poissonsolver = nullptr;
WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterEsolve = nullptr;
WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforedeposition = nullptr;
WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterdeposition = nullptr;