WarpX
Loading...
Searching...
No Matches
FieldReduction Class Reference

#include <FieldReduction.H>

Inheritance diagram for FieldReduction:
ReducedDiags

Public Member Functions

 FieldReduction (const std::string &rd_name)
 
void ComputeDiags (int step) final
 
void BackwardCompatibility ()
 
template<typename ReduceOp>
void ComputeFieldReduction ()
 
- Public Member Functions inherited from ReducedDiags
 ReducedDiags (const std::string &rd_name)
 
virtual ~ReducedDiags ()=default
 
 ReducedDiags (const ReducedDiags &)=default
 
ReducedDiagsoperator= (const ReducedDiags &)=default
 
 ReducedDiags (ReducedDiags &&)=default
 
ReducedDiagsoperator= (ReducedDiags &&)=default
 
virtual void InitData ()
 
virtual void LoadBalance ()
 
virtual void ComputeDiagsMidStep (int step)
 
virtual void WriteToFile (int step) const
 
bool DoDiags (int step) const
 
virtual void WriteCheckpointData (std::string const &dir)
 Write out checkpoint related data.
 
virtual void ReadCheckpointData (std::string const &dir)
 Read in checkpoint related data.
 
void BackwardCompatibility () const
 

Private Attributes

std::unique_ptr< amrex::Parserm_parser
 
ReductionType m_reduction_type
 

Static Private Attributes

static constexpr int m_nvars = 12
 

Additional Inherited Members

- Public Attributes inherited from ReducedDiags
std::string m_path = "./diags/reducedfiles/"
 output path (default)
 
std::string m_extension = "txt"
 output extension (default)
 
std::string m_rd_name
 diags name
 
utils::parser::IntervalsParser m_intervals
 output intervals
 
bool m_write_header = false
 check if header should be written
 
std::string m_sep = " "
 separator in the output file
 
int m_precision = 14
 precision for data in the output file
 
std::vector< amrex::Real > m_data
 output data
 

Detailed Description

This class contains a function that computes an arbitrary reduction of the fields. The function used in the reduction is defined by an input file parser expression and the reduction operation can be either Maximum, Minimum, or Integral (Sum multiplied by cell volume).

Constructor & Destructor Documentation

◆ FieldReduction()

FieldReduction::FieldReduction ( const std::string & rd_name)

constructor

Parameters
[in]rd_namereduced diags names

Member Function Documentation

◆ BackwardCompatibility()

void FieldReduction::BackwardCompatibility ( )

This function queries deprecated input parameters and aborts the run if one of them is specified.

◆ ComputeDiags()

void FieldReduction::ComputeDiags ( int step)
finalvirtual

This function is called at every time step, and if necessary calls the templated function ComputeFieldReduction(), which does the actual reduction computation.

Parameters
[in]stepthe timestep

Implements ReducedDiags.

◆ ComputeFieldReduction()

template<typename ReduceOp>
void FieldReduction::ComputeFieldReduction ( )
inline

This function does the actual reduction computation. The fields are first interpolated on the cell centers and the reduction operation is then performed using amrex::ReduceOps.

Template Parameters
ReduceOpthe type of reduction that is performed. This is typically amrex::ReduceOpMax, amrex::ReduceOpMin or amrex::ReduceOpSum.

Member Data Documentation

◆ m_nvars

int FieldReduction::m_nvars = 12
staticconstexprprivate

Parser to read expression to be reduced from the input file. 12 elements are x, y, z, Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz

◆ m_parser

std::unique_ptr<amrex::Parser> FieldReduction::m_parser
private

◆ m_reduction_type

ReductionType FieldReduction::m_reduction_type
private

The documentation for this class was generated from the following files: