aboutsummaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2022-01-21 13:25:03 -0800
committerGravatar GitHub <noreply@github.com> 2022-01-21 13:25:03 -0800
commit23ff60beeaaa08263aaa9680f82cab20803ce9e7 (patch)
tree7662f99230a789f21f529bed40fea2829efbc76a /Python
parenta3561eedf9fc0ac58c067b95258fb9b69e5cf07a (diff)
downloadWarpX-23ff60beeaaa08263aaa9680f82cab20803ce9e7.tar.gz
WarpX-23ff60beeaaa08263aaa9680f82cab20803ce9e7.tar.zst
WarpX-23ff60beeaaa08263aaa9680f82cab20803ce9e7.zip
Access species specific charge density from python (#2710)
* added python wrapper function to deposit a specific species density in rho_fp * added 1D ES input file with MCC that uses the charge deposition functionality * reset rho_fp[lev] before depositing * updated documentation * switch to using simulation.extension in Poisson solver * Apply suggestion from code review Co-authored-by: Phil Miller <phil.miller@intensecomputing.com> * suggested changes from code review * add comment explaining why a direct Poisson solver is used * removed direct solver in 1D example since it is actually slower than the MLMG solver * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * added docstring for warpx_depositChargeDensity * fixed order of imports in new PICMI input file Co-authored-by: Phil Miller <phil.miller@intensecomputing.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Python')
-rwxr-xr-xPython/pywarpx/_libwarpx.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py
index 105bfc37f..2475d8938 100755
--- a/Python/pywarpx/_libwarpx.py
+++ b/Python/pywarpx/_libwarpx.py
@@ -1048,6 +1048,23 @@ class LibWarpX():
'''
self.libwarpx_so.warpx_clearParticleBoundaryBuffer()
+ def depositChargeDensity(self, species_name, level):
+ '''
+
+ Deposit the specified species' charge density in rho_fp in order to
+ access that data via pywarpx.fields.RhoFPWrapper()
+
+ Parameters
+ ----------
+
+ species_name : the species name that will be deposited.
+ level : Which AMR level to retrieve scraped particle data from.
+
+ '''
+ self.libwarpx_so.warpx_depositChargeDensity(
+ ctypes.c_char_p(species_name.encode('utf-8')), level
+ )
+
def _get_mesh_field_list(self, warpx_func, level, direction, include_ghosts):
"""
Generic routine to fetch the list of field data arrays.