aboutsummaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorGravatar Axel Huebl <axel.huebl@plasma.ninja> 2021-12-20 18:39:08 -0800
committerGravatar GitHub <noreply@github.com> 2021-12-21 02:39:08 +0000
commitaafb6da2362374eb255eff450b846c4fec20ac5e (patch)
tree8a24908133d464a84aedd82d07ccc720808e8b6a /Python
parent634a2833a7a13cffde77c5d3229e0566c327f096 (diff)
downloadWarpX-aafb6da2362374eb255eff450b846c4fec20ac5e.tar.gz
WarpX-aafb6da2362374eb255eff450b846c4fec20ac5e.tar.zst
WarpX-aafb6da2362374eb255eff450b846c4fec20ac5e.zip
Inputs: `geometry.dims` option (#2685)
* Docs: `geometry.dims` option Add a new, required option to specify the geometry of an inputs file at runtime. * Check & Report Runtime Dims Mismatch * Examples: add `geometry.dims` * Deprecation Warning: `geometry.coord_sys` * PICMI: `geometry.dims` * Improve error message sounds a bit better * Improve Doc Description Co-authored-by: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com> Co-authored-by: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com>
Diffstat (limited to 'Python')
-rwxr-xr-xPython/pywarpx/_libwarpx.py10
-rw-r--r--Python/pywarpx/picmi.py8
2 files changed, 9 insertions, 9 deletions
diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py
index 5ffb74360..2c942c49d 100755
--- a/Python/pywarpx/_libwarpx.py
+++ b/Python/pywarpx/_libwarpx.py
@@ -84,16 +84,16 @@ class LibWarpX():
# --- The geometry must be setup before the lib warpx shared object can be loaded.
try:
_prob_lo = geometry.prob_lo
- _coord_sys = geometry.coord_sys
+ _dims = geometry.dims
except AttributeError:
raise Exception('The shared object could not be loaded. The geometry must be setup before the WarpX shared object can be accessesd. The geometry determines which version of the shared object to load.')
- if _coord_sys == 0:
- self.geometry_dim = '%dd'%len(_prob_lo)
- elif _coord_sys == 1:
+ if _dims == 'RZ':
self.geometry_dim = 'rz'
+ elif (_dims == '1' or _dims == '2' or _dims == '3'):
+ self.geometry_dim = '%dd'%len(_prob_lo)
else:
- raise Exception('Undefined coordinate system %d'%_coord_sys)
+ raise Exception('Undefined geometry %d'%_dims)
# this is a plain C/C++ shared library, not a Python module
if os.name == 'nt':
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py
index ebfb6830a..677253405 100644
--- a/Python/pywarpx/picmi.py
+++ b/Python/pywarpx/picmi.py
@@ -432,7 +432,7 @@ class CylindricalGrid(picmistandard.PICMI_CylindricalGrid):
assert self.bc_rmin != 'periodic' and self.bc_rmax != 'periodic', Exception('Radial boundaries can not be periodic')
# Geometry
- pywarpx.geometry.coord_sys = 1 # RZ
+ pywarpx.geometry.dims = 'RZ'
pywarpx.geometry.prob_lo = self.lower_bound # physical domain
pywarpx.geometry.prob_hi = self.upper_bound
pywarpx.warpx.n_rz_azimuthal_modes = self.n_azimuthal_modes
@@ -488,7 +488,7 @@ class Cartesian1DGrid(picmistandard.PICMI_Cartesian1DGrid):
pywarpx.amr.blocking_factor_x = self.blocking_factor_x
# Geometry
- pywarpx.geometry.coord_sys = 0 # Cartesian
+ pywarpx.geometry.dims = '1'
pywarpx.geometry.prob_lo = self.lower_bound # physical domain
pywarpx.geometry.prob_hi = self.upper_bound
@@ -543,7 +543,7 @@ class Cartesian2DGrid(picmistandard.PICMI_Cartesian2DGrid):
pywarpx.amr.blocking_factor_y = self.blocking_factor_y
# Geometry
- pywarpx.geometry.coord_sys = 0 # Cartesian
+ pywarpx.geometry.dims = '2'
pywarpx.geometry.prob_lo = self.lower_bound # physical domain
pywarpx.geometry.prob_hi = self.upper_bound
@@ -606,7 +606,7 @@ class Cartesian3DGrid(picmistandard.PICMI_Cartesian3DGrid):
pywarpx.amr.blocking_factor_z = self.blocking_factor_z
# Geometry
- pywarpx.geometry.coord_sys = 0 # Cartesian
+ pywarpx.geometry.dims = '3'
pywarpx.geometry.prob_lo = self.lower_bound # physical domain
pywarpx.geometry.prob_hi = self.upper_bound