AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ > Class Template Reference#

DiFfRG: DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ > Class Template Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows
DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ > Class Template Referenceabstract

The abstract base class for all timestepping algorithms. It provides a standard constructor which populates typical timestepping parameters from a given JSONValue object, such as the timestep sizes, tolerances, verbosity, etc. that are used in the timestepping algorithms. More...

#include <abstract_timestepper.hh>

Classes

struct  ConsoleOutStats
 
struct  ExplicitParameters
 
struct  ImplicitParameters
 

Public Member Functions

 AbstractTimestepper (const JSONValue &json, AbstractAssembler< VectorType, SparseMatrixType, dim > *assembler, DataOutput< dim, VectorType > *data_out=nullptr, AbstractAdaptor< VectorType > *adaptor=nullptr)
 Construct a new Abstract Timestepper object.
 
DataOutput< dim, VectorType > * get_data_out ()
 Utility function to obtain a DataOutput object. If no DataOutput object is provided, a default one is created.
 
AbstractAdaptor< VectorType > * get_adaptor ()
 Utility function to obtain an Adaptor object. If no Adaptor object is provided, a default one is created, which is the NoAdaptivity object, i.e. no mesh adaptivity is used.
 
virtual void run (AbstractFlowingVariables< NumberType > *initial_condition, const double t_start, const double t_stop)=0
 Any derived class must implement this method to run the timestepping algorithm.
 

Protected Types

using VectorType = VectorType_
 
using NumberType = typename get_type::NumberType< VectorType >
 
using SparseMatrixType = SparseMatrixType_
 
using InverseSparseMatrixType = typename get_type::InverseSparseMatrixType< SparseMatrixType >
 
using BlockVectorType = dealii::BlockVector< NumberType >
 

Protected Member Functions

void print_console_out (const std::string &name, const double t, const size_t milliseconds, const std::optional< std::string > calc_dt=std::nullopt, const size_t calls=0) const
 
void console_out (const double t, const std::string name, const int verbosity_level, const double calc_dt_ms=-1.0) const
 Pretty-print the status of the timestepping algorithm to the console.
 

Static Protected Member Functions

static std::string console_out_category (const std::string &name)
 
static std::string format_uncertain_ms (const double mean_ms, const double uncertainty_ms)
 

Protected Attributes

const JSONValue json
 
AbstractAssembler< VectorType, SparseMatrixType, dim > * assembler
 
DataOutput< dim, VectorType > * data_out
 
AbstractAdaptor< VectorType > * adaptor
 
const std::chrono::time_point< std::chrono::high_resolution_clock > start_time
 
std::shared_ptr< NoAdaptivity< VectorType > > adaptor_default
 
std::shared_ptr< DataOutput< dim, VectorType > > data_out_default
 
double Lambda
 
int verbosity
 
double output_dt
 
struct DiFfRG::AbstractTimestepper::ImplicitParameters impl
 
struct DiFfRG::AbstractTimestepper::ExplicitParameters expl
 
std::unordered_map< std::string, ConsoleOutStatsconsole_out_stats_by_category
 

Static Protected Attributes

static constexpr uint dim = dim_
 
static constexpr size_t console_name_width = 21
 

Detailed Description

template<typename VectorType_, typename SparseMatrixType_, uint dim_>
class DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >

The abstract base class for all timestepping algorithms. It provides a standard constructor which populates typical timestepping parameters from a given JSONValue object, such as the timestep sizes, tolerances, verbosity, etc. that are used in the timestepping algorithms.

In the JSONValue object, a /timestepping/ section must be present with the following parameters:

  • /timestepping/output_dt: The output timestep size.
  • /timestepping/implicit/dt: The timestep size for an implicit timestepping algorithm.
  • /timestepping/implicit/minimal_dt: The minimal timestep size for an implicit timestepping algorithm.
  • /timestepping/implicit/maximal_dt: The maximal timestep size for an implicit timestepping algorithm.
  • /timestepping/implicit/abs_tol: The absolute tolerance for an implicit timestepping algorithm.
  • /timestepping/implicit/rel_tol: The relative tolerance for an implicit timestepping algorithm.
  • /timestepping/implicit/max_steps: The maximal number of internal SUNDIALS steps between outputs.
  • /timestepping/explicit/dt: The timestep size for an explicit timestepping algorithm.
  • /timestepping/explicit/minimal_dt: The minimal timestep size for an explicit timestepping algorithm.
  • /timestepping/explicit/maximal_dt: The maximal timestep size for an explicit timestepping algorithm.
  • /timestepping/explicit/abs_tol: The absolute tolerance for an explicit timestepping algorithm.
  • /timestepping/explicit/rel_tol: The relative tolerance for an explicit timestepping algorithm.

Additionally, the following parameters are being used:

  • /output/verbosity: The verbosity level of the output.
  • /physical/Lambda: The RG scale parameter Lambda. If not present, no RG scale is given when console_out is called.

The console_out method is used to print information about the current time, the calculation time and the current RG scale k to the console in a standardized way.

Template Parameters
VectorType_The type of the vector used in the timestepping algorithm.. Currently only Vector<double> is supported.
SparseMatrixType_The type of the sparse matrix used in the timestepping algorithm. This depends on the assembler used in the computation.
dim_The dimensionality of the spatial discretization.

Member Typedef Documentation

◆ BlockVectorType

using DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::BlockVectorType = dealii::BlockVector<NumberType>
protected

◆ InverseSparseMatrixType

◆ NumberType

◆ SparseMatrixType

◆ VectorType

Constructor & Destructor Documentation

◆ AbstractTimestepper()

Construct a new Abstract Timestepper object.

Parameters
jsonThe JSONValue object must contain a /timestepping/ section with all necessary parameters.
assembler
data_out
adaptor

Member Function Documentation

◆ console_out()

void DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::console_out ( const double  t,
const std::string  name,
const int  verbosity_level,
const double  calc_dt_ms = -1.0 
) const
inlineprotected

Pretty-print the status of the timestepping algorithm to the console.

Parameters
tCurrent time.
nameA tag prepended to the output.
verbosity_levelThe verbosity level of the output.
calc_dt_msIf >= 0, the time in milliseconds it took to calculate the current timestep.

◆ console_out_category()

static std::string DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::console_out_category ( const std::string &  name)
inlinestaticprotected

◆ format_uncertain_ms()

static std::string DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::format_uncertain_ms ( const double  mean_ms,
const double  uncertainty_ms 
)
inlinestaticprotected

◆ get_adaptor()

Utility function to obtain an Adaptor object. If no Adaptor object is provided, a default one is created, which is the NoAdaptivity object, i.e. no mesh adaptivity is used.

Returns
AbstractAdaptor<VectorType>* A pointer to the Adaptor object.

◆ get_data_out()

Utility function to obtain a DataOutput object. If no DataOutput object is provided, a default one is created.

Returns
DataOutput<dim, VectorType>* A pointer to the DataOutput object.

◆ print_console_out()

void DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::print_console_out ( const std::string &  name,
const double  t,
const size_t  milliseconds,
const std::optional< std::string >  calc_dt = std::nullopt,
const size_t  calls = 0 
) const
inlineprotected

◆ run()

Member Data Documentation

◆ adaptor

◆ adaptor_default

◆ assembler

◆ console_name_width

constexpr size_t DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::console_name_width = 21
staticconstexprprotected

◆ console_out_stats_by_category

std::unordered_map<std::string, ConsoleOutStats> DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::console_out_stats_by_category
mutableprotected

◆ data_out

◆ data_out_default

◆ dim

◆ expl

◆ impl

◆ json

◆ Lambda

◆ output_dt

◆ start_time

const std::chrono::time_point<std::chrono::high_resolution_clock> DiFfRG::AbstractTimestepper< VectorType_, SparseMatrixType_, dim_ >::start_time
protected

◆ verbosity


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