aboutsummaryrefslogtreecommitdiff
path: root/Source/Python
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 /Source/Python
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 'Source/Python')
-rw-r--r--Source/Python/WarpXWrappers.H7
-rw-r--r--Source/Python/WarpXWrappers.cpp6
2 files changed, 13 insertions, 0 deletions
diff --git a/Source/Python/WarpXWrappers.H b/Source/Python/WarpXWrappers.H
index 9dbdb02db..708a97cc3 100644
--- a/Source/Python/WarpXWrappers.H
+++ b/Source/Python/WarpXWrappers.H
@@ -171,6 +171,8 @@ extern "C" {
amrex::Real** warpx_getCurrentDensityCP (int lev, int direction, int *return_size, int *ncomps, int **ngrowvect, int **shapes);
amrex::Real** warpx_getCurrentDensityFP (int lev, int direction, int *return_size, int *ncomps, int **ngrowvect, int **shapes);
+ amrex::Real** warpx_getVectorPotentialFP (int lev, int direction, int *return_size, int *ncomps, int **ngrowvect, int **shapes);
+
int* warpx_getEfieldLoVects (int lev, int direction, int *return_size, int **ngrowvect);
int* warpx_getEfieldCPLoVects (int lev, int direction, int *return_size, int **ngrowvect);
int* warpx_getEfieldFPLoVects (int lev, int direction, int *return_size, int **ngrowvect);
@@ -183,6 +185,8 @@ extern "C" {
int* warpx_getCurrentDensityCPLoVects (int lev, int direction, int *return_size, int **ngrowvect);
int* warpx_getCurrentDensityFPLoVects (int lev, int direction, int *return_size, int **ngrowvect);
+ int* warpx_getVectorPotentialFPLoVects (int lev, int direction, int *return_size, int **ngrowvect);
+
amrex::Real** warpx_getEdgeLengths (int lev, int direction, int *return_size, int *ncomps, int **ngrowvect, int **shapes);
int* warpx_getEdgeLengthsLoVects (int lev, int direction, int *return_size, int **ngrowvect);
@@ -195,6 +199,9 @@ extern "C" {
int* warpx_getBx_nodal_flag ();
int* warpx_getBy_nodal_flag ();
int* warpx_getBz_nodal_flag ();
+ int* warpx_getAx_nodal_flag ();
+ int* warpx_getAy_nodal_flag ();
+ int* warpx_getAz_nodal_flag ();
int* warpx_getJx_nodal_flag ();
int* warpx_getJy_nodal_flag ();
int* warpx_getJz_nodal_flag ();
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp
index bbcc26daf..05a2a1061 100644
--- a/Source/Python/WarpXWrappers.cpp
+++ b/Source/Python/WarpXWrappers.cpp
@@ -289,6 +289,8 @@ namespace
WARPX_GET_FIELD(warpx_getCurrentDensityCP, WarpX::GetInstance().get_pointer_current_cp)
WARPX_GET_FIELD(warpx_getCurrentDensityFP, WarpX::GetInstance().get_pointer_current_fp)
+ WARPX_GET_FIELD(warpx_getVectorPotentialFP, WarpX::GetInstance().get_pointer_vector_potential_fp)
+
WARPX_GET_LOVECTS(warpx_getEfieldLoVects, WarpX::GetInstance().get_pointer_Efield_aux)
WARPX_GET_LOVECTS(warpx_getEfieldCPLoVects, WarpX::GetInstance().get_pointer_Efield_cp)
WARPX_GET_LOVECTS(warpx_getEfieldFPLoVects, WarpX::GetInstance().get_pointer_Efield_fp)
@@ -300,6 +302,7 @@ namespace
WARPX_GET_LOVECTS(warpx_getCurrentDensityLoVects, WarpX::GetInstance().get_pointer_current_fp)
WARPX_GET_LOVECTS(warpx_getCurrentDensityCPLoVects, WarpX::GetInstance().get_pointer_current_cp)
WARPX_GET_LOVECTS(warpx_getCurrentDensityFPLoVects, WarpX::GetInstance().get_pointer_current_fp)
+ WARPX_GET_LOVECTS(warpx_getVectorPotentialFPLoVects, WarpX::GetInstance().get_pointer_vector_potential_fp)
WARPX_GET_LOVECTS(warpx_getEdgeLengthsLoVects, WarpX::GetInstance().get_pointer_edge_lengths)
WARPX_GET_LOVECTS(warpx_getFaceAreasLoVects, WarpX::GetInstance().get_pointer_face_areas)
@@ -313,6 +316,9 @@ namespace
int* warpx_getJx_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_current_fp(0,0) );}
int* warpx_getJy_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_current_fp(0,1) );}
int* warpx_getJz_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_current_fp(0,2) );}
+ int* warpx_getAx_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_vector_potential_fp(0,0) );}
+ int* warpx_getAy_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_vector_potential_fp(0,1) );}
+ int* warpx_getAz_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_vector_potential_fp(0,2) );}
int* warpx_getRho_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_rho_fp(0) );}
int* warpx_getPhi_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_phi_fp(0) );}
int* warpx_getF_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().get_pointer_F_fp(0) );}