diff options
author | 2021-10-29 13:26:46 -0700 | |
---|---|---|
committer | 2021-10-29 13:26:46 -0700 | |
commit | baf842c2cc8c83518d678ec9bd1eaef23e0cb06e (patch) | |
tree | ae386c5c4edc437126a6c53675e965f3663735d1 /Python/pywarpx/picmi.py | |
parent | 0ee4b81bd28128175b634a0c6b08ff8f6c4d8207 (diff) | |
download | WarpX-baf842c2cc8c83518d678ec9bd1eaef23e0cb06e.tar.gz WarpX-baf842c2cc8c83518d678ec9bd1eaef23e0cb06e.tar.zst WarpX-baf842c2cc8c83518d678ec9bd1eaef23e0cb06e.zip |
Add option to specificy absolute tolerance for the MLMG solver (#2410)
* added option to specify absolute tolerance for the MLMG solver used in the electrostatic field solve
* added absolute tolerance argument to the documentation
* fixed bug introduced during copy and paste
* expanded documentation for MLMG solver absolute tolerance (added unit) and added a link to the AMReX documentation describing the MLMG solver parameters
* possibly more robust handling of the MLMG convergence
* switched from std::max to amrex::max to hopefully fix compiler complaints
* updated checksum values for MCC test (background_mcc); the values changed only slightly, presumably due to a difference in the initial field solve which would now have the absolute tolerance value included, but since the Python version of this same test (which uses the direct solver) still passes the change is assumed to be inconsequential
* another try to fix the compile issues
* print a message to notify user if the max norm of rho is zero
* Apply suggestions from code review
Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
* switched print statements to the new warning logger
Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r-- | Python/pywarpx/picmi.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 52449b23f..ef2371699 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -82,6 +82,7 @@ class Species(picmistandard.PICMI_Species): # For the relativistic electrostatic solver self.self_fields_required_precision = kw.pop('warpx_self_fields_required_precision', None) + self.self_fields_absolute_tolerance = kw.pop('warpx_self_fields_absolute_tolerance', None) self.self_fields_max_iters = kw.pop('warpx_self_fields_max_iters', None) self.self_fields_verbosity = kw.pop('warpx_self_fields_verbosity', None) self.save_previous_position = kw.pop('warpx_save_previous_position', None) @@ -126,6 +127,7 @@ class Species(picmistandard.PICMI_Species): initialize_self_fields = int(initialize_self_fields), boost_adjust_transverse_positions = self.boost_adjust_transverse_positions, self_fields_required_precision = self.self_fields_required_precision, + self_fields_absolute_tolerance = self.self_fields_absolute_tolerance, self_fields_max_iters = self.self_fields_max_iters, self_fields_verbosity = self.self_fields_verbosity, save_particles_at_xlo = self.save_particles_at_xlo, @@ -621,7 +623,9 @@ class ElectromagneticSolver(picmistandard.PICMI_ElectromagneticSolver): class ElectrostaticSolver(picmistandard.PICMI_ElectrostaticSolver): def init(self, kw): 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) + def initialize_inputs(self): self.grid.initialize_inputs() @@ -631,6 +635,7 @@ class ElectrostaticSolver(picmistandard.PICMI_ElectrostaticSolver): 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 pywarpx.warpx.self_fields_verbosity = self.self_fields_verbosity pywarpx.boundary.potential_lo_x = self.grid.potential_xmin |