SimTime Class Reference

AMR-Wind API: amr_wind::SimTime Class Reference
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches

#include <SimTime.H>

Public Member Functions

 SimTime ()=default
 
 ~SimTime ()=default
 
bool new_timestep ()
 
bool continue_simulation () const
 
bool do_regrid () const
 
bool write_plot_file () const
 
bool write_checkpoint () const
 
bool write_last_plot_file () const
 
bool write_last_checkpoint () const
 
void set_current_cfl (const amrex::Real conv_cfl, const amrex::Real diff_cfl, const amrex::Real src_cfl)
 
void set_restart_time (int tidx, amrex::Real time)
 
AMREX_FORCE_INLINE amrex::Real delta_t () const
 
AMREX_FORCE_INLINE amrex::Real & delta_t ()
 
AMREX_FORCE_INLINE amrex::Real delta_t_nm1 () const
 
AMREX_FORCE_INLINE amrex::Real delta_t_nm2 () const
 
AMREX_FORCE_INLINE amrex::Real & delta_t_nm1 ()
 
AMREX_FORCE_INLINE amrex::Real & delta_t_nm2 ()
 
AMREX_FORCE_INLINE amrex::Real current_time () const
 
AMREX_FORCE_INLINE amrex::Real & current_time ()
 
AMREX_FORCE_INLINE amrex::Real new_time () const
 
AMREX_FORCE_INLINE amrex::Real max_cfl () const
 
AMREX_FORCE_INLINE int time_index () const
 
AMREX_FORCE_INLINE int & time_index ()
 
AMREX_FORCE_INLINE bool adaptive_timestep () const
 
AMREX_FORCE_INLINE bool use_force_cfl () const
 
AMREX_FORCE_INLINE int regrid_interval () const
 
AMREX_FORCE_INLINE amrex::Real start_time () const
 
AMREX_FORCE_INLINE amrex::Real stop_time () const
 
AMREX_FORCE_INLINE int start_time_index () const
 
AMREX_FORCE_INLINE int stop_time_index () const
 
AMREX_FORCE_INLINE int chkpt_interval () const
 
void parse_parameters ()
 Read user defined options from input file.
 

Static Public Attributes

static constexpr int max_time_states = 3
 

Private Attributes

amrex::Vector< amrex::Real > m_dt
 Timestep sizes.
 
amrex::Real m_cur_time {0.0}
 Current simulation time.
 
amrex::Real m_new_time {0.0}
 Time where a new timestep will advance to.
 
amrex::Real m_start_time {0.0}
 Starting simulation time (to track restart)
 
amrex::Real m_stop_time {-1.0}
 Max time for simulation.
 
amrex::Real m_max_cfl {0.5}
 Maximum CFL constraint.
 
amrex::Real m_fixed_dt {-1.0}
 Fixed delta_t indicated by user.
 
amrex::Real m_initial_dt {-1.0}
 Initial delta_t indicated by user.
 
amrex::Real m_current_cfl {0.0}
 Current CFL.
 
amrex::Real m_init_shrink {0.1}
 Initial reduction in timestep size for startup.
 
amrex::Real m_dt_growth {0.1}
 Maximum growth of dt between timesteps.
 
amrex::Real m_chkpt_t_interval {-1.0}
 Time interval for writing checkpoint/restart files.
 
amrex::Real m_chkpt_t_delay {0.0}
 Time delay for checkpoint/restart output.
 
amrex::Real m_chkpt_t_tol {1e-8}
 Relative (to dt) tolerance for checkpoint time interval output.
 
amrex::Real m_force_chkpt_tol {1e-3}
 Relative (to chkpt_t_interval) tolerance for enforcing dt.
 
amrex::Real m_plt_t_interval {-1.0}
 Time interval for plot file output.
 
amrex::Real m_plt_t_delay {0.0}
 Time delay for plot file output.
 
amrex::Real m_plt_t_tol {1e-8}
 Relative (to dt) tolerance for plot time interval output.
 
amrex::Real m_force_plt_tol {1e-3}
 Relative (to plt_t_interval) tolerance for enforcing dt.
 
int m_time_index {0}
 Counter for the number of timesteps since start of simulation.
 
int m_start_time_index {0}
 Initial starting time index.
 
int m_chkpt_start_index {0}
 Initial starting time index for generating checkpoint files.
 
int m_plt_start_index {0}
 Initial starting time index for generating output files.
 
int m_regrid_start_index {0}
 Initial starting time index for regriding.
 
int m_stop_time_index {-1}
 Maximum timesteps for simulation.
 
int m_chkpt_interval {-1}
 Time step interval for writing checkpoint/restart files.
 
int m_chkpt_delay {0}
 
int m_plt_interval {-1}
 Time step interval for plot file output.
 
int m_plt_delay {0}
 Time step delay for plot file output.
 
int m_regrid_interval {-1}
 Time interval for regridding.
 
int m_verbose {0}
 Verbosity.
 
bool m_adaptive {false}
 Flag indicating whether timestep is adaptive.
 
bool m_is_init {true}
 Flag indicating if this is initialization.
 
bool m_use_force_cfl {true}
 Flag indicating if forcing should be included in CFL calculation.
 
bool m_force_chkpt_dt {false}
 Bool for if checkpoint time interval should be forced.
 
bool m_force_plt_dt {false}
 Bool for if plt time interval should be forced.
 

Detailed Description

Time manager for simulations

Constructor & Destructor Documentation

◆ SimTime()

amr_wind::SimTime::SimTime ( )
default

◆ ~SimTime()

amr_wind::SimTime::~SimTime ( )
default

Member Function Documentation

◆ adaptive_timestep()

AMREX_FORCE_INLINE bool amr_wind::SimTime::adaptive_timestep ( ) const
inline

◆ chkpt_interval()

AMREX_FORCE_INLINE int amr_wind::SimTime::chkpt_interval ( ) const
inline

◆ continue_simulation()

bool amr_wind::SimTime::continue_simulation ( ) const

Return true if simulation should continue

◆ current_time() [1/2]

AMREX_FORCE_INLINE amrex::Real & amr_wind::SimTime::current_time ( )
inline

◆ current_time() [2/2]

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::current_time ( ) const
inline

◆ delta_t() [1/2]

AMREX_FORCE_INLINE amrex::Real & amr_wind::SimTime::delta_t ( )
inline

◆ delta_t() [2/2]

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::delta_t ( ) const
inline

◆ delta_t_nm1() [1/2]

AMREX_FORCE_INLINE amrex::Real & amr_wind::SimTime::delta_t_nm1 ( )
inline

◆ delta_t_nm1() [2/2]

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::delta_t_nm1 ( ) const
inline

◆ delta_t_nm2() [1/2]

AMREX_FORCE_INLINE amrex::Real & amr_wind::SimTime::delta_t_nm2 ( )
inline

◆ delta_t_nm2() [2/2]

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::delta_t_nm2 ( ) const
inline

◆ do_regrid()

bool amr_wind::SimTime::do_regrid ( ) const

Return true if mesh refinement should be performed at this timestep

◆ max_cfl()

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::max_cfl ( ) const
inline

◆ new_time()

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::new_time ( ) const
inline

◆ new_timestep()

bool amr_wind::SimTime::new_timestep ( )

Advance to a new time state and update internal time states

Return a boolean flag indicating if the simulation should continue.

◆ parse_parameters()

void amr_wind::SimTime::parse_parameters ( )

Read user defined options from input file.

◆ regrid_interval()

AMREX_FORCE_INLINE int amr_wind::SimTime::regrid_interval ( ) const
inline

◆ set_current_cfl()

void amr_wind::SimTime::set_current_cfl ( const amrex::Real conv_cfl,
const amrex::Real diff_cfl,
const amrex::Real src_cfl )

Set current CFL and update timestep based on CFL components

◆ set_restart_time()

void amr_wind::SimTime::set_restart_time ( int tidx,
amrex::Real time )

Set start time and index based on checkpoint/restart file

Parameters
tidxTime index from checkpoint file
timeTime read from checkpoint file

◆ start_time()

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::start_time ( ) const
inline

◆ start_time_index()

AMREX_FORCE_INLINE int amr_wind::SimTime::start_time_index ( ) const
inline

◆ stop_time()

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::stop_time ( ) const
inline

◆ stop_time_index()

AMREX_FORCE_INLINE int amr_wind::SimTime::stop_time_index ( ) const
inline

◆ time_index() [1/2]

AMREX_FORCE_INLINE int & amr_wind::SimTime::time_index ( )
inline

◆ time_index() [2/2]

AMREX_FORCE_INLINE int amr_wind::SimTime::time_index ( ) const
inline

◆ use_force_cfl()

AMREX_FORCE_INLINE bool amr_wind::SimTime::use_force_cfl ( ) const
inline

◆ write_checkpoint()

bool amr_wind::SimTime::write_checkpoint ( ) const

Return true if checkpoint files should be written at this timestep

◆ write_last_checkpoint()

bool amr_wind::SimTime::write_last_checkpoint ( ) const

Return true if checkpoint files should be written at this timestep

◆ write_last_plot_file()

bool amr_wind::SimTime::write_last_plot_file ( ) const

Return true if plot files should be written at this timestep

◆ write_plot_file()

bool amr_wind::SimTime::write_plot_file ( ) const

Return true if plot files should be written at this timestep

Member Data Documentation

◆ m_adaptive

bool amr_wind::SimTime::m_adaptive {false}
private

Flag indicating whether timestep is adaptive.

◆ m_chkpt_delay

int amr_wind::SimTime::m_chkpt_delay {0}
private

Time step delay for checkpoint/restart output (this means that output only happens after the delay)

◆ m_chkpt_interval

int amr_wind::SimTime::m_chkpt_interval {-1}
private

Time step interval for writing checkpoint/restart files.

◆ m_chkpt_start_index

int amr_wind::SimTime::m_chkpt_start_index {0}
private

Initial starting time index for generating checkpoint files.

◆ m_chkpt_t_delay

amrex::Real amr_wind::SimTime::m_chkpt_t_delay {0.0}
private

Time delay for checkpoint/restart output.

◆ m_chkpt_t_interval

amrex::Real amr_wind::SimTime::m_chkpt_t_interval {-1.0}
private

Time interval for writing checkpoint/restart files.

◆ m_chkpt_t_tol

amrex::Real amr_wind::SimTime::m_chkpt_t_tol {1e-8}
private

Relative (to dt) tolerance for checkpoint time interval output.

◆ m_cur_time

amrex::Real amr_wind::SimTime::m_cur_time {0.0}
private

Current simulation time.

◆ m_current_cfl

amrex::Real amr_wind::SimTime::m_current_cfl {0.0}
private

Current CFL.

◆ m_dt

amrex::Vector<amrex::Real> amr_wind::SimTime::m_dt
private
Initial value:
=
amrex::Vector<amrex::Real>(max_time_states, 0.0)
static constexpr int max_time_states
Definition SimTime.H:32

Timestep sizes.

◆ m_dt_growth

amrex::Real amr_wind::SimTime::m_dt_growth {0.1}
private

Maximum growth of dt between timesteps.

◆ m_fixed_dt

amrex::Real amr_wind::SimTime::m_fixed_dt {-1.0}
private

Fixed delta_t indicated by user.

◆ m_force_chkpt_dt

bool amr_wind::SimTime::m_force_chkpt_dt {false}
private

Bool for if checkpoint time interval should be forced.

◆ m_force_chkpt_tol

amrex::Real amr_wind::SimTime::m_force_chkpt_tol {1e-3}
private

Relative (to chkpt_t_interval) tolerance for enforcing dt.

◆ m_force_plt_dt

bool amr_wind::SimTime::m_force_plt_dt {false}
private

Bool for if plt time interval should be forced.

◆ m_force_plt_tol

amrex::Real amr_wind::SimTime::m_force_plt_tol {1e-3}
private

Relative (to plt_t_interval) tolerance for enforcing dt.

◆ m_init_shrink

amrex::Real amr_wind::SimTime::m_init_shrink {0.1}
private

Initial reduction in timestep size for startup.

◆ m_initial_dt

amrex::Real amr_wind::SimTime::m_initial_dt {-1.0}
private

Initial delta_t indicated by user.

◆ m_is_init

bool amr_wind::SimTime::m_is_init {true}
private

Flag indicating if this is initialization.

◆ m_max_cfl

amrex::Real amr_wind::SimTime::m_max_cfl {0.5}
private

Maximum CFL constraint.

◆ m_new_time

amrex::Real amr_wind::SimTime::m_new_time {0.0}
private

Time where a new timestep will advance to.

◆ m_plt_delay

int amr_wind::SimTime::m_plt_delay {0}
private

Time step delay for plot file output.

◆ m_plt_interval

int amr_wind::SimTime::m_plt_interval {-1}
private

Time step interval for plot file output.

◆ m_plt_start_index

int amr_wind::SimTime::m_plt_start_index {0}
private

Initial starting time index for generating output files.

◆ m_plt_t_delay

amrex::Real amr_wind::SimTime::m_plt_t_delay {0.0}
private

Time delay for plot file output.

◆ m_plt_t_interval

amrex::Real amr_wind::SimTime::m_plt_t_interval {-1.0}
private

Time interval for plot file output.

◆ m_plt_t_tol

amrex::Real amr_wind::SimTime::m_plt_t_tol {1e-8}
private

Relative (to dt) tolerance for plot time interval output.

◆ m_regrid_interval

int amr_wind::SimTime::m_regrid_interval {-1}
private

Time interval for regridding.

◆ m_regrid_start_index

int amr_wind::SimTime::m_regrid_start_index {0}
private

Initial starting time index for regriding.

◆ m_start_time

amrex::Real amr_wind::SimTime::m_start_time {0.0}
private

Starting simulation time (to track restart)

◆ m_start_time_index

int amr_wind::SimTime::m_start_time_index {0}
private

Initial starting time index.

◆ m_stop_time

amrex::Real amr_wind::SimTime::m_stop_time {-1.0}
private

Max time for simulation.

◆ m_stop_time_index

int amr_wind::SimTime::m_stop_time_index {-1}
private

Maximum timesteps for simulation.

◆ m_time_index

int amr_wind::SimTime::m_time_index {0}
private

Counter for the number of timesteps since start of simulation.

◆ m_use_force_cfl

bool amr_wind::SimTime::m_use_force_cfl {true}
private

Flag indicating if forcing should be included in CFL calculation.

◆ m_verbose

int amr_wind::SimTime::m_verbose {0}
private

Verbosity.

◆ max_time_states

int amr_wind::SimTime::max_time_states = 3
staticconstexpr

The documentation for this class was generated from the following files:
  • /home/runner/work/amr-wind/amr-wind/amr-wind/core/SimTime.H
  • /home/runner/work/amr-wind/amr-wind/amr-wind/core/SimTime.cpp