aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/BTDiagnostics.cpp
diff options
context:
space:
mode:
authorGravatar Ryan Sandberg <RSandberg@lbl.gov> 2022-09-23 20:01:19 -0700
committerGravatar GitHub <noreply@github.com> 2022-09-24 03:01:19 +0000
commitcf74a5b3e6de44a030bdc004802050b9427dcdbc (patch)
treedcccba2dd3e5c9f6b020ffc1c7c9d3cfa9d57b40 /Source/Diagnostics/BTDiagnostics.cpp
parent6febc63b4d58e7bacc38d1a2a98d5852663d1b31 (diff)
downloadWarpX-cf74a5b3e6de44a030bdc004802050b9427dcdbc.tar.gz
WarpX-cf74a5b3e6de44a030bdc004802050b9427dcdbc.tar.zst
WarpX-cf74a5b3e6de44a030bdc004802050b9427dcdbc.zip
BTD diagnostics specified by intervals (#3367)
* BTD diagnostics specified by intervals * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * address CI errors * refactor and test * no duplicate or out-of-order snapshots * update documentation and tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * clean for CI * still fighting CI * Update Source/Diagnostics/BTDiagnostics.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * refactor includes * add an explicit constexpr * Apply suggestions from code review Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * describe algorithm for BTD intervals list * revert to old description of num_snapshots_lab * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * preserve behavior of num_snapshots_lab Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Diffstat (limited to 'Source/Diagnostics/BTDiagnostics.cpp')
-rw-r--r--Source/Diagnostics/BTDiagnostics.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp
index 1bd200fb4..beb367309 100644
--- a/Source/Diagnostics/BTDiagnostics.cpp
+++ b/Source/Diagnostics/BTDiagnostics.cpp
@@ -161,8 +161,18 @@ BTDiagnostics::ReadParameters ()
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(m_do_back_transformed_fields, " fields must be turned on for the new back-transformed diagnostics");
if (m_do_back_transformed_fields == false) m_varnames.clear();
- getWithParser(pp_diag_name, "num_snapshots_lab", m_num_snapshots_lab);
- m_num_buffers = m_num_snapshots_lab;
+
+ std::vector<std::string> intervals_string_vec = {"0"};
+ bool const num_snapshots_specified = queryWithParser(pp_diag_name, "num_snapshots_lab", m_num_snapshots_lab);
+ bool const intervals_specified = pp_diag_name.queryarr("intervals", intervals_string_vec);
+ if (num_snapshots_specified)
+ {
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE(!intervals_specified,
+ "For back-transformed diagnostics, user should specify either num_snapshots_lab or intervals, not both");
+ intervals_string_vec = {":" + std::to_string(m_num_snapshots_lab-1)};
+ }
+ m_intervals = BTDIntervalsParser(intervals_string_vec);
+ m_num_buffers = m_intervals.NumSnapshots();
// Read either dz_snapshots_lab or dt_snapshots_lab
bool snapshot_interval_is_specified = false;
@@ -241,7 +251,7 @@ BTDiagnostics::InitializeBufferData ( int i_buffer , int lev)
auto & warpx = WarpX::GetInstance();
// Lab-frame time for the i^th snapshot
amrex::Real zmax_0 = warpx.Geom(lev).ProbHi(m_moving_window_dir);
- m_t_lab.at(i_buffer) = i_buffer * m_dt_snapshots_lab
+ m_t_lab.at(i_buffer) = m_intervals.GetBTDIteration(i_buffer) * m_dt_snapshots_lab
+ m_gamma_boost*m_beta_boost*zmax_0/PhysConst::c;
// Define buffer domain in boosted frame at level, lev, with user-defined lo and hi