diff options
author | 2022-12-22 11:53:58 -0800 | |
---|---|---|
committer | 2022-12-22 19:53:58 +0000 | |
commit | 850a07d586ef82530066a54dd766622469b03849 (patch) | |
tree | 2c1348f6a9fca4b02652717ca1af89158ea6e514 /Python/pywarpx/_libwarpx.py | |
parent | 3329b5281dd27bfa276585bdfe94fbc5a95a9ae0 (diff) | |
download | WarpX-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/_libwarpx.py')
-rwxr-xr-x | Python/pywarpx/_libwarpx.py | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py index 44426d624..c2c3a774b 100755 --- a/Python/pywarpx/_libwarpx.py +++ b/Python/pywarpx/_libwarpx.py @@ -206,6 +206,8 @@ class LibWarpX(): self.libwarpx_so.warpx_getChargeDensityFPLoVects.restype = _LP_c_int self.libwarpx_so.warpx_getPhiFP.restype = _LP_LP_c_real self.libwarpx_so.warpx_getPhiFPLoVects.restype = _LP_c_int + self.libwarpx_so.warpx_getVectorPotentialFP.restype = _LP_LP_c_real + self.libwarpx_so.warpx_getVectorPotentialFPLoVects.restype = _LP_c_int self.libwarpx_so.warpx_getFfieldCP.restype = _LP_LP_c_real self.libwarpx_so.warpx_getFfieldCPLoVects.restype = _LP_c_int self.libwarpx_so.warpx_getFfieldFP.restype = _LP_LP_c_real @@ -242,6 +244,9 @@ class LibWarpX(): self.libwarpx_so.warpx_getJx_nodal_flag.restype = _LP_c_int self.libwarpx_so.warpx_getJy_nodal_flag.restype = _LP_c_int self.libwarpx_so.warpx_getJz_nodal_flag.restype = _LP_c_int + self.libwarpx_so.warpx_getAx_nodal_flag.restype = _LP_c_int + self.libwarpx_so.warpx_getAy_nodal_flag.restype = _LP_c_int + self.libwarpx_so.warpx_getAz_nodal_flag.restype = _LP_c_int self.libwarpx_so.warpx_getRho_nodal_flag.restype = _LP_c_int self.libwarpx_so.warpx_getPhi_nodal_flag.restype = _LP_c_int self.libwarpx_so.warpx_getF_nodal_flag.restype = _LP_c_int @@ -1462,6 +1467,32 @@ class LibWarpX(): return self._get_mesh_field_list(self.libwarpx_so.warpx_getBfieldFP, level, direction, include_ghosts) + def get_mesh_vector_potential_fp(self, level, direction, include_ghosts=True): + ''' + + This returns a list of numpy arrays containing the mesh vector potential + data on each grid for this process. This version returns the field on + the fine patch for the given level. + + The data for the numpy arrays are not copied, but share the underlying + memory buffer with WarpX. The numpy arrays are fully writeable. + + Parameters + ---------- + + level : the AMR level to get the data for + direction : the component of the data you want + include_ghosts : whether to include ghost zones or not + + Returns + ------- + + A List of numpy arrays. + + ''' + + return self._get_mesh_field_list(self.libwarpx_so.warpx_getVectorPotentialFP, level, direction, include_ghosts) + def get_mesh_magnetic_field_cp_pml(self, level, direction, include_ghosts=True): ''' @@ -2199,6 +2230,27 @@ class LibWarpX(): ''' return self._get_mesh_array_lovects(level, direction, include_ghosts, self.libwarpx_so.warpx_getBfieldFPLoVects) + def get_mesh_vector_potential_fp_lovects(self, level, direction, include_ghosts=True): + ''' + + This returns a list of the lo vectors of the arrays containing the mesh vector potential field + data on each grid for this process. + + Parameters + ---------- + + level : the AMR level to get the data for + direction : the component of the data you want + include_ghosts : whether to include ghost zones or not + + Returns + ------- + + A 2d numpy array of the lo vector for each grid with the shape (dims, number of grids) + + ''' + return self._get_mesh_array_lovects(level, direction, include_ghosts, self.libwarpx_so.warpx_getVectorPotentialFPLoVects) + def get_mesh_magnetic_field_cp_lovects_pml(self, level, direction, include_ghosts=True): ''' @@ -2700,6 +2752,24 @@ class LibWarpX(): ''' return self._get_nodal_flag(self.libwarpx_so.warpx_getJz_nodal_flag) + def get_Ax_nodal_flag(self): + ''' + This returns a 1d array of the nodal flags for Ax along each direction. A 1 means node centered, and 0 cell centered. + ''' + return self._get_nodal_flag(self.libwarpx_so.warpx_getAx_nodal_flag) + + def get_Ay_nodal_flag(self): + ''' + This returns a 1d array of the nodal flags for Ay along each direction. A 1 means node centered, and 0 cell centered. + ''' + return self._get_nodal_flag(self.libwarpx_so.warpx_getAy_nodal_flag) + + def get_Az_nodal_flag(self): + ''' + This returns a 1d array of the nodal flags for Az along each direction. A 1 means node centered, and 0 cell centered. + ''' + return self._get_nodal_flag(self.libwarpx_so.warpx_getAz_nodal_flag) + def get_Rho_nodal_flag(self): ''' This returns a 1d array of the nodal flags for Rho along each direction. A 1 means node centered, and 0 cell centered. |