SpECTRE
v2024.06.18

A weighted exponential averager of \(Q\) and its derivatives implementing Appendix A in [87]. More...
#include <Averager.hpp>
Classes  
struct  Average0thDeriv 
struct  AverageTimescaleFraction 
Public Types  
using  options = tmpl::list< AverageTimescaleFraction, Average0thDeriv > 
Public Member Functions  
Averager (double avg_timescale_frac, bool average_0th_deriv_of_q)  
avg_timescale_frac determines the exponential averaging timescale through \(\tau_\mathrm{avg} = \)avg_timescale_frac \(\times \tau\), where \(\tau\) is the damping time. avg_timescale_frac must be positive. average_0th_deriv_of_q determines whether the call operator returns an averaged or unaveraged quantity for the 0th derivative of \(Q\). true returns an averaged 0th derivative of \(Q\). false returns the raw 0th derivative of \(Q\). The derivatives are always averaged (to reduce noise due to numerical differentiation), so the average_0th_deriv_of_q option only specifies whether to return an averaged value for the 0th derivative piece of the function.  
Averager (Averager &&rhs)  
Averager &  operator= (Averager &&rhs) 
Averager (const Averager &)=default  
Averager &  operator= (const Averager &)=default 
const std::optional< std::array< DataVector, DerivOrder+1 > > &  operator() (double time) const 
Returns \(Q\) and its derivatives at \(t=\)time , provided there is sufficient data. The averager is limited by the need for at least (DerivOrder + 1) data points in order to provide the DerivOrder 'th derivative. If sufficient data is available, it returns \(Q\) and averaged derivatives of \(Q\) up to the DerivOrder 'th derivative, at \(t=\)time . If using_average_0th_deriv_of_q() is true , then the returned 0th derivative of \(Q\) is also averaged. In the case that there is insufficient data, the operator returns an invalid std::optional .  
void  clear () 
A function that allows for resetting the averager.  
void  update (double time, const DataVector &raw_q, const DataVector ×cales) 
The function responsible for updating the averaged values at \(t=\)time . Requires raw_q (the raw components of \(Q(t)\)) and timescales (the associated damping times for each component).  
double  last_time_updated () const 
Returns the latest time at which the averager has sufficient data to return \(Q\) and its derivatives.  
double  average_time (double time) const 
Returns the exponentially averaged time at \(t=\)time . The time is averaged along side \(Q\) to determine the effective time at which the average value is computed. The effective time is retarded, due to the weighting of past times.  
bool  using_average_0th_deriv_of_q () const 
Returns a bool corresponding to whether average_0th_deriv_of_q is true /false .  
double  avg_timescale_frac () const 
Returns the averaging timescale fraction.  
void  assign_time_between_measurements (const double current_time_between_measurements) 
Assign the minimum of the measurement timescales related to a specific control system to time_between_measurements_.  
bool  is_ready (const double time) const 
Returns true if the averager is ready to receive a measurement.  
void  pup (PUP::er &p) 
Static Public Attributes  
static constexpr Options::String  help 
Friends  
template<size_t DDerivOrder>  
bool  operator== (const Averager< DDerivOrder > &, const Averager< DDerivOrder > &) 
A weighted exponential averager of \(Q\) and its derivatives implementing Appendix A in [87].
The purpose of the averager is to provide \(Q\) and 'smoothed' numerical derivatives of \(Q\) up to the DerivOrder
'th derivative. The 0th derivative of \(Q\) is not typically averaged, since no differencing is necessary and no noise is introduced. The average_0th_deriv_of_q
option allows for specifying that the 0th derivative should be averaged in addition to the derivatives. This may be desirable for control systems where \(Q\) contains some 'noise', e.g. size control typically uses an averaged \(Q\) since the raw computed \(Q\) is a function of the minimum on a surface and may jump around discontinuously.
The averager is designed to support DerivOrders 1, 2, and 3. If an additional DerivOrder is needed, finite differencing needs to be implemented to specifically handle that order (as it seems like overkill to generalize the differencing stencil at this time).

staticconstexpr 