diff options
author | 2020-05-01 14:19:48 -0700 | |
---|---|---|
committer | 2020-05-01 14:19:48 -0700 | |
commit | 96a59e58c57814bc3e0eed73f8c8919bd6c48620 (patch) | |
tree | d722475777a3ab27a6370c97d677b41bed6bd4b9 /Python/pywarpx/picmi.py | |
parent | f8941d7e4d1a2e8388360a22e1cbf1ef7bcf2cb3 (diff) | |
download | WarpX-96a59e58c57814bc3e0eed73f8c8919bd6c48620.tar.gz WarpX-96a59e58c57814bc3e0eed73f8c8919bd6c48620.tar.zst WarpX-96a59e58c57814bc3e0eed73f8c8919bd6c48620.zip |
Delete old diagnostics (#933)
* Create subsection for diags documentation in input parameters list
* Replace old diags with new ones IN DOC ONLY
* eol whitespace
* Check first CI test with new diags, before changing all of them
* use diags in all CI
* oops, had forgotten all examples except Tests/
* Updated picmi interface to use the new diagnostics
* fix bug in how field functors are initialized for diags
* fix bug: should always dump output at the end of simulation
* eol
* update test parameters in ini file
* Further fixes to picmi for new diagnostics
* Updates PICMI input files to use the new diagnostics
* avoid dumping final plotfile twoce
* update test to run with new diags
* fix typo introduced when fixing merge conflicts
* had accidentally removed the max_step here, so the run never ended on TravisCI
* Add Diagnostics.py for picmi with new diagnostics
* Adding m_ for member variables in new diags (#934)
* fixing bug to initialize CellCenterFunctor for Bx
* diag_name renamed to m_diag_name
* some more diag members made m_
* renaming member variable mf_avg to m_mf_output
* fixing m_mf_output to mf_dst in comments
* Python documentation updates (#936)
* Update Python documentation
* Added numpy as a requirement for the Python installation
* Cleaned EOL white space in Python documentation
* Add periodictable to the Python packages required
Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja>
* Added periodictable to required packages for pure Python version
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Add hostname to LoadBalanceCosts reduced diagnostic (#902)
* Add hostname to reduced diags
EOL
Fix rd loadbalancecosts test
AMREX_USE_MPI
EOL
move macro to source file
Review changes
eol
add GPU ID if running on GPU
eol
Typo in comment
use vectors to get rid of C-style memory management
Fix for test
eol
* Compute number of unique box data fields in analysis script
* analysis script
* Use amrex Tokenize to split string
* Update WarpXUtil.cpp
* Update WarpXUtil.H
* [mini] Add contact us section to documentation (#941)
* add contact us section to doc
* Update Docs/source/contact_us.rst
Co-Authored-By: L. Diana Amorim <LDianaAmorim@lbl.gov>
* Update Docs/source/contact_us.rst
Co-authored-by: L. Diana Amorim <LDianaAmorim@lbl.gov>
* stop calling the old WritePlotFile functions
* fix new diags, problem with rho and PSATD and particle output variables
* remove more deprecated code for old diags
* Move checkpoint capability to new diagnostics
* error if user asks custom output for checkpoint
* eol
* some more old diags code deleted
* further cleaning
* eol
* further cleaning, make sure that WarpX compiles with USE_OPENPMD
* remove old diags parameters
* use new option to change the plotfile name
* typo
* do not need checkpoint files
* adapt to new option for checkpoint
* removed unread options as they make tests crash
* remove warpx_checkInt from the Python layer
* remove some more python wrappers
* add checkpoint capability with 2 diags in new output
* fix bug in MultiDiagnostics, and (should) fix checkpoint-restart test
* fix restart CI test
* avoid issue when writing the last plotfile twice
* dpgrote's fix for the Python tests
* update doc for diagnostics
* stop requesting ndiags, this is read from the list of diags
* awk to remove ndiags from all example input files
* Removed diagnostics.ndiags from picmi interface
Co-authored-by: Dave Grote <dpgrote@lbl.gov>
Co-authored-by: Dave Grote <grote1@llnl.gov>
Co-authored-by: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Michael E Rowan <38045958+mrowan137@users.noreply.github.com>
Co-authored-by: L. Diana Amorim <LDianaAmorim@lbl.gov>
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r-- | Python/pywarpx/picmi.py | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 9fe0b0781..86ffad728 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -502,8 +502,6 @@ class LaserAntenna(picmistandard.PICMI_LaserAntenna): class Simulation(picmistandard.PICMI_Simulation): def init(self, kw): - self.plot_int = kw.pop('warpx_plot_int', None) - self.plot_file = kw.pop('warpx_plot_file', None) self.current_deposition_algo = kw.pop('warpx_current_deposition_algo', None) self.charge_deposition_algo = kw.pop('warpx_charge_deposition_algo', None) self.field_gathering_algo = kw.pop('warpx_field_gathering_algo', None) @@ -531,8 +529,6 @@ class Simulation(picmistandard.PICMI_Simulation): pywarpx.warpx.gamma_boost = self.gamma_boost pywarpx.warpx.boost_direction = None - pywarpx.amr.plot_int = self.plot_int - pywarpx.amr.plot_file = self.plot_file pywarpx.algo.current_deposition = self.current_deposition_algo pywarpx.algo.charge_deposition = self.charge_deposition_algo pywarpx.algo.field_gathering = self.field_gathering_algo @@ -610,40 +606,59 @@ class Simulation(picmistandard.PICMI_Simulation): # ---------------------------- -class FieldDiagnostic(picmistandard.PICMI_FieldDiagnostic): +class _WarpX_FieldDiagnostic(picmistandard.PICMI_FieldDiagnostic): def init(self, kw): self.plot_raw_fields = kw.pop('warpx_plot_raw_fields', None) self.plot_raw_fields_guards = kw.pop('warpx_plot_raw_fields_guards', None) self.plot_finepatch = kw.pop('warpx_plot_finepatch', None) self.plot_crsepatch = kw.pop('warpx_plot_crsepatch', None) + self.format = kw.pop('warpx_format', 'plotfile') + self.openpmd_backend = kw.pop('warpx_openpmd_backend', None) + self.file_prefix = kw.pop('warpx_file_prefix', None) def initialize_inputs(self): - # --- For now, the period must be the same as plot_int if set - pywarpx.amr.check_consistency('plot_int', self.period, 'The period must be the same for all simulation frame diagnostics') - pywarpx.amr.plot_int = self.period + self.diagnostics_number = len(pywarpx.Diagnostics.diagnostics_list) + 1 + + # --- This a placeholder until the name attribute is added to the picmi standard + name = getattr(self, 'name', None) + if name is None: + self.name = 'diag{}'.format(self.diagnostics_number) + + self.diagnostic = pywarpx.Bucket.Bucket(self.name) + pywarpx.diagnostics.diags_names.append(self.name) + pywarpx.Diagnostics.diagnostics_list.append(self.diagnostic) + + self.diagnostic.diag_type = 'Full' + self.diagnostic.format = self.format + self.diagnostic.openpmd_backend = self.openpmd_backend + self.diagnostic.period = self.period + self.diagnostic.diag_lo = self.lower_bound + self.diagnostic.diag_hi = self.upper_bound + self.diagnostic.coarsening_ratio = (np.array(self.grid.number_of_cells)/np.array(self.number_of_cells)).astype(int) + self.diagnostic.fields_to_plot = set() for dataname in self.data_list: if dataname == 'E': - pywarpx.warpx.add_field_to_plot('Ex') - pywarpx.warpx.add_field_to_plot('Ey') - pywarpx.warpx.add_field_to_plot('Ez') + self.diagnostic.fields_to_plot.add('Ex') + self.diagnostic.fields_to_plot.add('Ey') + self.diagnostic.fields_to_plot.add('Ez') elif dataname == 'B': - pywarpx.warpx.add_field_to_plot('Bx') - pywarpx.warpx.add_field_to_plot('By') - pywarpx.warpx.add_field_to_plot('Bz') + self.diagnostic.fields_to_plot.add('Bx') + self.diagnostic.fields_to_plot.add('By') + self.diagnostic.fields_to_plot.add('Bz') elif dataname == 'J': - pywarpx.warpx.add_field_to_plot('jx') - pywarpx.warpx.add_field_to_plot('jy') - pywarpx.warpx.add_field_to_plot('jz') - elif dataname in ['Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz', 'rho', 'F', 'proc_number']: - pywarpx.warpx.add_field_to_plot(dataname) + self.diagnostic.fields_to_plot.add('jx') + self.diagnostic.fields_to_plot.add('jy') + self.diagnostic.fields_to_plot.add('jz') + elif dataname in ['Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz', 'rho', 'F', 'proc_number', 'part_per_cell']: + self.diagnostic.fields_to_plot.add(dataname) elif dataname in ['Jx', 'Jy', 'Jz']: - pywarpx.warpx.add_field_to_plot(dataname.lower()) + self.diagnostic.fields_to_plot.add(dataname.lower()) elif dataname == 'dive': - pywarpx.warpx.add_field_to_plot('divE') + self.diagnostic.fields_to_plot.add('divE') elif dataname == 'divb': - pywarpx.warpx.add_field_to_plot('divB') + self.diagnostic.fields_to_plot.add('divB') elif dataname == 'raw_fields': self.plot_raw_fields = 1 elif dataname == 'raw_fields_guards': @@ -653,36 +668,31 @@ class FieldDiagnostic(picmistandard.PICMI_FieldDiagnostic): elif dataname == 'crsepatch': self.plot_crsepatch = 1 - pywarpx.warpx.plot_raw_fields = self.plot_raw_fields - pywarpx.warpx.plot_raw_fields_guards = self.plot_raw_fields_guards + self.diagnostic.plot_raw_fields = self.plot_raw_fields + self.diagnostic.plot_raw_fields_guards = self.plot_raw_fields_guards + self.diagnostic.plot_finepatch = self.plot_finepatch + self.diagnostic.plot_crsepatch = self.plot_crsepatch - pywarpx.warpx.check_consistency('plot_finepatch', self.plot_finepatch, 'The fine patch flag must be the same for all simulation frame field diagnostics') - pywarpx.warpx.check_consistency('plot_crsepatch', self.plot_crsepatch, 'The coarse patch flag must be the same for all simulation frame field diagnostics') - pywarpx.warpx.plot_finepatch = self.plot_finepatch - pywarpx.warpx.plot_crsepatch = self.plot_crsepatch + if self.write_dir is not None or self.file_prefix is not None: + write_dir = (self.write_dir or 'diags') + file_prefix = (self.file_prefix or self.name) + self.diagnostic.file_prefix = write_dir + '/' + file_prefix - if self.write_dir is not None: - plot_file = self.write_dir + '/plotfiles/plt' - pywarpx.amr.check_consistency('plot_file', plot_file, 'The plot directory must be the same for all simulation frame diagnostics') - pywarpx.amr.plot_file = plot_file -class ElectrostaticFieldDiagnostic(picmistandard.PICMI_ElectrostaticFieldDiagnostic): - def initialize_inputs(self): - # --- For now, the period must be the same as plot_int if set - pywarpx.amr.check_consistency('plot_int', self.period, 'The period must be the same for all simulation frame diagnostics') - pywarpx.amr.plot_int = self.period +class FieldDiagnostic(_WarpX_FieldDiagnostic, picmistandard.PICMI_FieldDiagnostic): + pass - if self.write_dir is not None: - plot_file = self.write_dir + '/plotfiles/plt' - pywarpx.amr.check_consistency('plot_file', plot_file, 'The plot directory must be the same for all simulation frame diagnostics') - pywarpx.amr.plot_file = plot_file + +class ElectrostaticFieldDiagnostic(_WarpX_FieldDiagnostic, picmistandard.PICMI_ElectrostaticFieldDiagnostic): + def initialize_inputs(self): + if 'phi' in self.data_list: + # --- phi is not supported by WarpX, but is in the default data_list + self.data_list.remove('phi') + _WarpX_FieldDiagnostic.initialize_inputs(self) class ParticleDiagnostic(picmistandard.PICMI_ParticleDiagnostic): def initialize_inputs(self): - # --- For now, the period must be the same as plot_int if set - pywarpx.amr.check_consistency('plot_int', self.period, 'The period must be the same for all simulation frame diagnostics') - pywarpx.amr.plot_int = self.period plot_vars = set() for dataname in self.data_list: @@ -704,8 +714,6 @@ class ParticleDiagnostic(picmistandard.PICMI_ParticleDiagnostic): plot_vars.add('Bz') elif dataname in ['ux', 'uy', 'uz', 'Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz']: plot_vars.add(dataname) - elif dataname in ['part_per_cell', 'part_per_grid', 'part_per_proc']: - pywarpx.warpx.add_field_to_plot(dataname) if plot_vars: species = self.species @@ -715,11 +723,6 @@ class ParticleDiagnostic(picmistandard.PICMI_ParticleDiagnostic): for var in plot_vars: specie.species.plot_vars.add(var) - if self.write_dir is not None: - plot_file = self.write_dir + '/plotfiles/plt' - pywarpx.amr.check_consistency('plot_file', plot_file, 'The plot directory must be the same for all simulation frame diagnostics') - pywarpx.amr.plot_file = plot_file - # ---------------------------- # Lab frame diagnostics |