AMR-Wind  v0.1.0
CFD solver for wind plant simulations
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
amr_wind::SimTime Class Reference

Time manager for simulations. More...

#include <SimTime.H>

Public Member Functions

 SimTime ()=default
 
 ~SimTime ()=default
 
bool new_timestep ()
 Advance to a new time state and update internal time states. More...
 
bool continue_simulation () const
 Return true if simulation should continue. More...
 
bool do_regrid () const
 Return true if mesh refinement should be performed at this timestep. More...
 
bool write_plot_file () const
 Return true if plot files should be written at this timestep. More...
 
bool write_checkpoint () const
 Return true if checkpoint files should be written at this timestep. More...
 
bool write_last_plot_file () const
 Return true if plot files should be written at this timestep. More...
 
bool write_last_checkpoint () const
 Return true if checkpoint files should be written at this timestep. More...
 
void 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. More...
 
void set_restart_time (int tidx, amrex::Real time)
 Set start time and index based on checkpoint/restart file. More...
 
AMREX_FORCE_INLINE amrex::Real deltaT () const
 
AMREX_FORCE_INLINE amrex::Real & deltaT ()
 
AMREX_FORCE_INLINE amrex::Real deltaTNm1 () const
 
AMREX_FORCE_INLINE amrex::Real deltaTNm2 () const
 
AMREX_FORCE_INLINE amrex::Real & deltaTNm1 ()
 
AMREX_FORCE_INLINE amrex::Real & deltaTNm2 ()
 
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. More...
 

Static Public Attributes

static constexpr int max_time_states = 3
 

Private Attributes

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

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

◆ deltaT() [1/2]

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

◆ deltaT() [2/2]

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

◆ deltaTNm1() [1/2]

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

◆ deltaTNm1() [2/2]

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

◆ deltaTNm2() [1/2]

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

◆ deltaTNm2() [2/2]

AMREX_FORCE_INLINE amrex::Real amr_wind::SimTime::deltaTNm2 ( ) 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 deltaT 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 deltaT 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

constexpr int amr_wind::SimTime::max_time_states = 3
staticconstexpr

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