aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/picmi.py
diff options
context:
space:
mode:
authorGravatar S. Eric Clark <25495882+clarkse@users.noreply.github.com> 2022-12-22 11:53:58 -0800
committerGravatar GitHub <noreply@github.com> 2022-12-22 19:53:58 +0000
commit850a07d586ef82530066a54dd766622469b03849 (patch)
tree2c1348f6a9fca4b02652717ca1af89158ea6e514 /Python/pywarpx/picmi.py
parent3329b5281dd27bfa276585bdfe94fbc5a95a9ae0 (diff)
downloadWarpX-850a07d586ef82530066a54dd766622469b03849.tar.gz
WarpX-850a07d586ef82530066a54dd766622469b03849.tar.zst
WarpX-850a07d586ef82530066a54dd766622469b03849.zip
Feature magnetostatic solver (#3551)
* Initial working Magnetostatic solver integration into warpx. Includes hooks in Python library, and a test problem. Build files updates. New solver algorithm and inputs. * Fixed indexing to allow Magnetostatic solver to work in RZ and 3D. * Removing trailing whitespace. * Adding basic regression testing with benchmarks. * Updated Regression test ini * Augmented test scripts to compare to analytical results for uniform beam. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Updating CI tests for magnetostatic solver. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Updated magnetostatic CI tests to pass locally in regression testing framework. * Adjusting tolerance on magnetostatic_rz regression test to allow for noise in near zero fields. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Converted particle layout to Gridded instead of PsedupRandom to improve reproducibility of particle deposition for regression testing. * Dropped benchmark field comparisons with fields near zero. Dropped particle benchmark for magnetostatic_eb_rz regression test due to randomized particle theta adding noise to fields after a timestep. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Found and fixed a bug in syncronization of MultiFabs when interpolating between grids in the magnetostatic solver. Added Python output for nodal current and vector potential. Updated the CI tests to disable dynamic scheduling and enbale serialization of initial conditions. Updated benchmarks fro tests. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.cpp Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.cpp Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Adding random_theta flag to PICMI interface and updating RZ CI test and benchmark with change to disable randomized theta. * Added documentation to parameters.rst for relativistic-magnetostatic flag. Documentation corrections. Removal of commented source. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removing need to use do_current_centering. Updated current density inverse scaling support for nodal Jr in radius. Added flag to check for m_rz_random_theta when laying down particles in RZ. * Remove dA/dt term to decouple electrostatic and magnetostatic solvers. * Remove update of auxiliary fields * Adding non-Python test case for magnetostatic solver. Updating benchmarks. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.cpp Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Python/pywarpx/_libwarpx.py Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Python/pywarpx/_libwarpx.py Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Python/pywarpx/_libwarpx.py Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Python/pywarpx/_libwarpx.py Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Source/Diagnostics/Diagnostics.cpp Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Source/Evolve/WarpXEvolve.cpp Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Update Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.H Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Refactor names of functions for magnetostatic solver implementation. Remove current_fp_nodal python interface. Drop extraneous ghost cell exchanges. * Adding radial weighting at r=0 for Jr if nodal. * Splitting off Amrex bucket and adjustments to RZ radial weighting into different branches to be merged. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.cpp Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Switch name to labfame-electromagnetostatic * Update example scripts Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r--Python/pywarpx/picmi.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py
index aac083af0..dff224d07 100644
--- a/Python/pywarpx/picmi.py
+++ b/Python/pywarpx/picmi.py
@@ -73,6 +73,10 @@ class Species(picmistandard.PICMI_Species):
Whether or not to deposit the charge and current density for
for this species
+ warpx_random_theta: bool, default=True
+ Whether or not to add random angle to the particles in theta
+ when in RZ mode.
+
warpx_reflection_model_xlo: string, default='0.'
Expression (in terms of the velocity "v") specifying the probability
that the particle will reflect on the lower x boundary
@@ -170,6 +174,7 @@ class Species(picmistandard.PICMI_Species):
self.self_fields_verbosity = kw.pop('warpx_self_fields_verbosity', None)
self.save_previous_position = kw.pop('warpx_save_previous_position', None)
self.do_not_deposit = kw.pop('warpx_do_not_deposit', None)
+ self.random_theta = kw.pop('warpx_random_theta', None)
# For particle reflection
self.reflection_model_xlo = kw.pop('warpx_reflection_model_xlo', None)
@@ -221,7 +226,8 @@ class Species(picmistandard.PICMI_Species):
save_particles_at_zhi = self.save_particles_at_zhi,
save_particles_at_eb = self.save_particles_at_eb,
save_previous_position = self.save_previous_position,
- do_not_deposit = self.do_not_deposit)
+ do_not_deposit = self.do_not_deposit,
+ random_theta = self.random_theta)
# add reflection models
self.species.add_new_attr("reflection_model_xlo(E)", self.reflection_model_xlo)
@@ -988,6 +994,7 @@ class ElectrostaticSolver(picmistandard.PICMI_ElectrostaticSolver):
self.relativistic = kw.pop('warpx_relativistic', False)
self.absolute_tolerance = kw.pop('warpx_absolute_tolerance', None)
self.self_fields_verbosity = kw.pop('warpx_self_fields_verbosity', None)
+ self.magnetostatic = kw.pop('warpx_magnetostatic', False)
def initialize_inputs(self):
@@ -996,7 +1003,10 @@ class ElectrostaticSolver(picmistandard.PICMI_ElectrostaticSolver):
if self.relativistic:
pywarpx.warpx.do_electrostatic = 'relativistic'
else:
- pywarpx.warpx.do_electrostatic = 'labframe'
+ if self.magnetostatic:
+ pywarpx.warpx.do_electrostatic = 'labframe-electromagnetostatic'
+ else:
+ pywarpx.warpx.do_electrostatic = 'labframe'
pywarpx.warpx.self_fields_required_precision = self.required_precision
pywarpx.warpx.self_fields_absolute_tolerance = self.absolute_tolerance
pywarpx.warpx.self_fields_max_iters = self.maximum_iterations
@@ -1748,7 +1758,11 @@ class FieldDiagnostic(picmistandard.PICMI_FieldDiagnostic, WarpXDiagnosticBase):
fields_to_plot.add('jx')
fields_to_plot.add('jy')
fields_to_plot.add('jz')
- elif dataname in ['Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz', 'rho', 'phi', 'F', 'proc_number', 'part_per_cell']:
+ elif dataname == 'A':
+ fields_to_plot.add('Ax')
+ fields_to_plot.add('Ay')
+ fields_to_plot.add('Az')
+ elif dataname in ['Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz', 'Ax', 'Ay', 'Az', 'rho', 'phi', 'F', 'proc_number', 'part_per_cell']:
fields_to_plot.add(dataname)
elif dataname in ['Jx', 'Jy', 'Jz']:
fields_to_plot.add(dataname.lower())