From 7a543b983c7ae0a2b204daabbd9ccef6684456b4 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Wed, 19 Apr 2023 14:40:41 -0700 Subject: Add more PICMI options (#3773) * Add PICMI option to cover multiple cuts * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Parse flux_min, flux_tmax from PICMI * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Implement review comments --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- Python/pywarpx/picmi.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Python/pywarpx/picmi.py') diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 9d620eb72..4a3798059 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -416,6 +416,8 @@ class UniformFluxDistribution(picmistandard.PICMI_UniformFluxDistribution, Densi species.flux_normal_axis = self.flux_normal_axis species.surface_flux_pos = self.surface_flux_position species.flux_direction = self.flux_direction + species.flux_tmin = self.flux_tmin + species.flux_tmax = self.flux_tmax # --- Use specific attributes for flux injection species.injection_style = "nfluxpercell" @@ -1341,12 +1343,15 @@ class EmbeddedBoundary(picmistandard.base._ClassWithInit): Analytic expression defining the potential. Can only be specified when the solver is electrostatic. + cover_multiple_cuts: bool, default=None + Whether to cover cells with multiple cuts. + (If False, this will raise an error if some cells have multiple cuts) Parameters used in the analytic expressions should be given as additional keyword arguments. """ def __init__(self, implicit_function=None, stl_file=None, stl_scale=None, stl_center=None, stl_reverse_normal=False, - potential=None, **kw): + potential=None, cover_multiple_cuts=None, **kw): assert stl_file is None or implicit_function is None, Exception('Only one between implicit_function and ' 'stl_file can be specified') @@ -1365,6 +1370,8 @@ class EmbeddedBoundary(picmistandard.base._ClassWithInit): self.potential = potential + self.cover_multiple_cuts = cover_multiple_cuts + # Handle keyword arguments used in expressions self.user_defined_kw = {} for k in list(kw.keys()): @@ -1393,6 +1400,8 @@ class EmbeddedBoundary(picmistandard.base._ClassWithInit): pywarpx.eb2.stl_center = self.stl_center pywarpx.eb2.stl_reverse_normal = self.stl_reverse_normal + pywarpx.eb2.cover_multiple_cuts = self.cover_multiple_cuts + if self.potential is not None: assert isinstance(solver, ElectrostaticSolver), Exception('The potential is only supported with the ElectrostaticSolver') expression = pywarpx.my_constants.mangle_expression(self.potential, self.mangle_dict) -- cgit v1.2.3