Skip to content

Commit 2106601

Browse files
Abort if BTD selected for RZ, and unsupported field/particle varnames (#3074)
* abort if BTD selected for RZ, and unsupported field/particle varnames * add doc * particle fields to plot not supported for BTD * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * WARPX_ALWAYS_ASSERT_WITH_MESSAGE * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * use unified txt message syntax for abort * fix logic in assert Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 1af7c05 commit 2106601

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

Docs/source/usage/parameters.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a
19881988
19891989
* ``<diag_name>.fields_to_plot`` (list of `strings`, optional)
19901990
Fields written to output.
1991-
Possible scalar fields: ``part_per_cell`` ``rho`` ``phi`` ``F`` ``part_per_grid`` ``divE`` ``divB`` and ``rho_<species_name>``, where ``<species_name>`` must match the name of one of the available particle species. Note that ``phi`` will only be written out when do_electrostatic==labframe.
1991+
Possible scalar fields: ``part_per_cell`` ``rho`` ``phi`` ``F`` ``part_per_grid`` ``divE`` ``divB`` and ``rho_<species_name>``, where ``<species_name>`` must match the name of one of the available particle species. Note that ``phi`` will only be written out when do_electrostatic==labframe. Also, note that for ``<diag_name>.diag_type = BackTransformed``, the only scalar field currently supported is ``rho``.
19921992
Possible vector field components in Cartesian geometry: ``Ex`` ``Ey`` ``Ez`` ``Bx`` ``By`` ``Bz`` ``jx`` ``jy`` ``jz``.
19931993
Possible vector field components in RZ geometry: ``Er`` ``Et`` ``Ez`` ``Br`` ``Bt`` ``Bz`` ``jr`` ``jt`` ``jz``.
19941994
Default is ``<diag_name>.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz``,
@@ -2006,6 +2006,7 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a
20062006
Note that these averages do not respect the particle shape factor, and instead use nearest-grid point interpolation.
20072007
Default is none.
20082008
Parser functions for these field names are specified by ``<diag_name>.particle_fields.<field_name>(x,y,z,ux,uy,uz)``.
2009+
Also, note that this option is only available for ``<diag_name>.diag_type = Full``
20092010

20102011
* ``<diag_name>.particle_fields_species`` (list of `strings`, optional)
20112012
Species for which to calculate ``particle_fields_to_plot``.
@@ -2115,7 +2116,7 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a
21152116
BackTransformed Diagnostics (with support for Plotfile/openPMD output)
21162117
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21172118

2118-
``BackTransformed`` diag type are used when running a simulation in a boosted frame, to reconstruct output data to the lab frame. This option can be set using ``<diag_name>.diag_type = BackTransformed``. Additional options for this diagnostic include:
2119+
``BackTransformed`` diag type are used when running a simulation in a boosted frame, to reconstruct output data to the lab frame. This option can be set using ``<diag_name>.diag_type = BackTransformed``. Note that this diagnostic is not currently supported for RZ. Additional options for this diagnostic include:
21192120

21202121
* ``<diag_name>.num_snapshots_lab`` (`integer`)
21212122
Only used when ``<diag_name>.diag_type`` is ``BackTransformed``.

Source/Diagnostics/BTDiagnostics.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,20 @@ BTDiagnostics::ReadParameters ()
170170
if(m_max_box_size < m_buffer_size) m_max_box_size = m_buffer_size;
171171
}
172172

173+
174+
amrex::Vector< std::string > BTD_varnames_supported = {"Ex", "Ey", "Ez",
175+
"Bx", "By", "Bz",
176+
"jx", "jy", "jz", "rho"};
177+
178+
for (const auto& var : m_varnames) {
179+
WARPX_ALWAYS_ASSERT_WITH_MESSAGE( (WarpXUtilStr::is_in(BTD_varnames_supported, var )), "Input error: field variable " + var + " in " + m_diag_name
180+
+ ".fields_to_plot is not supported for BackTransformed diagnostics. Currently supported field variables for BackTransformed diagnostics include Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz, and rho");
181+
}
182+
183+
bool particle_fields_to_plot_specified = pp_diag_name.queryarr("particle_fields_to_plot", m_pfield_varnames);
184+
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(!particle_fields_to_plot_specified, "particle_fields_to_plot is currently not supported for BackTransformed Diagnostics");
185+
186+
173187
}
174188

175189
bool

Source/Diagnostics/BackTransformedDiagnostic.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "Parallelization/WarpXCommUtil.H"
1111
#include "Utils/WarpXConst.H"
1212
#include "Utils/WarpXProfilerWrapper.H"
13+
#include "Utils/TextMsg.H"
1314
#include "WarpX.H"
1415

1516
#include <AMReX_Array4.H>
@@ -577,7 +578,9 @@ BackTransformedDiagnostic (Real zmin_lab, Real zmax_lab, Real v_window_lab,
577578
m_particle_slice_width_lab_(particle_slice_width_lab)
578579
{
579580

580-
581+
#ifdef WARPX_DIM_RZ
582+
amrex::Abort(Utils::TextMsg::Err("BackTransformed diagnostics is currently not supported with RZ"));
583+
#endif
581584
WARPX_PROFILE("BackTransformedDiagnostic::BackTransformedDiagnostic");
582585

583586
AMREX_ALWAYS_ASSERT(WarpX::do_back_transformed_fields or

Source/Diagnostics/MultiDiagnostics.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "Diagnostics/BTDiagnostics.H"
44
#include "Diagnostics/FullDiagnostics.H"
5+
#include "Utils/TextMsg.H"
56

67
#include <AMReX_ParmParse.H>
78
#include <AMReX.H>
@@ -22,7 +23,11 @@ MultiDiagnostics::MultiDiagnostics ()
2223
if ( diags_types[i] == DiagTypes::Full ){
2324
alldiags[i] = std::make_unique<FullDiagnostics>(i, diags_names[i]);
2425
} else if ( diags_types[i] == DiagTypes::BackTransformed ){
26+
#ifdef WARPX_DIM_RZ
27+
amrex::Abort(Utils::TextMsg::Err("BackTransformed diagnostics is currently not supported for RZ"));
28+
#else
2529
alldiags[i] = std::make_unique<BTDiagnostics>(i, diags_names[i]);
30+
#endif
2631
} else {
2732
amrex::Abort("Unknown diagnostic type");
2833
}

0 commit comments

Comments
 (0)