Hipace
Public Member Functions | Public Attributes | Private Attributes | List of all members
AdaptiveTimeStep Class Reference

class handling the adaptive time step More...

#include <AdaptiveTimeStep.H>

Public Member Functions

 AdaptiveTimeStep (const int nbeams)
 
void BroadcastTimeStep (amrex::Real &dt)
 
void GatherMinUzSlice (MultiBeam &beams, const bool initial)
 
void CalculateFromMinUz (amrex::Real t, amrex::Real &dt, MultiBeam &beams, MultiPlasma &plasmas)
 
void GatherMinAccSlice (MultiBeam &beams, const amrex::Geometry &geom, const Fields &fields)
 
void CalculateFromDensity (amrex::Real t, amrex::Real &dt, MultiPlasma &plasmas)
 

Public Attributes

bool m_do_adaptive_time_step = false
 
bool m_adaptive_gather_ez = false
 

Private Attributes

amrex::Vector< amrex::Vector< amrex::Real > > m_timestep_data
 
amrex::Real m_nt_per_betatron = 20.
 
amrex::Real m_dt_max = std::numeric_limits<amrex::Real>::infinity()
 
amrex::Real m_min_uz = std::numeric_limits<amrex::Real>::max()
 
amrex::Real m_threshold_uz = 2.
 
bool m_adaptive_predict_step = true
 
bool m_adaptive_control_phase_advance = true
 
amrex::Real m_adaptive_phase_tolerance = 4.e-4
 
int m_adaptive_phase_substeps = 2000
 
int m_nbeams = 0
 

Detailed Description

class handling the adaptive time step

Constructor & Destructor Documentation

◆ AdaptiveTimeStep()

AdaptiveTimeStep::AdaptiveTimeStep ( const int  nbeams)
explicit

Constructor

Member Function Documentation

◆ BroadcastTimeStep()

void AdaptiveTimeStep::BroadcastTimeStep ( amrex::Real &  dt)

Head rank initial time step

Parameters
[in,out]dtinitial time step

◆ CalculateFromDensity()

void AdaptiveTimeStep::CalculateFromDensity ( amrex::Real  t,
amrex::Real &  dt,
MultiPlasma plasmas 
)

Right before starting a time step, correct its dt to account for local plasma density and resolve density gradients.

Parameters
[in]tcurrent physical time
[in,out]dtthe time step
[in]plasmasmultiplasma to get density profile info

◆ CalculateFromMinUz()

void AdaptiveTimeStep::CalculateFromMinUz ( amrex::Real  t,
amrex::Real &  dt,
MultiBeam beams,
MultiPlasma plasmas 
)

calculate the adaptive time step based on the beam energy

Parameters
[in]tcurrent physical time
[in,out]dtthe time step
[in]beamsmultibeam containing all beams
[in]plasmasmultiplasma to get density profile info

◆ GatherMinAccSlice()

void AdaptiveTimeStep::GatherMinAccSlice ( MultiBeam beams,
const amrex::Geometry geom,
const Fields fields 
)

gather min Ez from the beam slice

Parameters
[in]beamsmultibeam containing all beams
[in]geomgeometry object
[in]fieldsfield object

◆ GatherMinUzSlice()

void AdaptiveTimeStep::GatherMinUzSlice ( MultiBeam beams,
const bool  initial 
)

gather min uz from the beam slice

Parameters
[in]beamsmultibeam containing all beams
[in]initialwhether to calculate the initial dt from the beam init slice

Member Data Documentation

◆ m_adaptive_control_phase_advance

bool AdaptiveTimeStep::m_adaptive_control_phase_advance = true
private

If true, a test on the phase advance sets the time step so it matches the phase advance expected for a uniform plasma. Relevant in the presence of density gradients. The tolerance on the phase advance difference is controlled by m_adaptive_phase_tolerance

◆ m_adaptive_gather_ez

bool AdaptiveTimeStep::m_adaptive_gather_ez = false

Whether to Gather Ez to take into account the deceleration of a particle when calculating the time step for parallel jobs.

◆ m_adaptive_phase_substeps

int AdaptiveTimeStep::m_adaptive_phase_substeps = 2000
private

Number of substeps on which the phase advance is monitored

◆ m_adaptive_phase_tolerance

amrex::Real AdaptiveTimeStep::m_adaptive_phase_tolerance = 4.e-4
private

Phase shift tolerance. Relevant when density gradients are present. Lower is more accurate.

◆ m_adaptive_predict_step

bool AdaptiveTimeStep::m_adaptive_predict_step = true
private

Whether to predict the next time steps. More accurate for parallel simulations

◆ m_do_adaptive_time_step

bool AdaptiveTimeStep::m_do_adaptive_time_step = false

Whether to use an adaptive time step

◆ m_dt_max

amrex::Real AdaptiveTimeStep::m_dt_max = std::numeric_limits<amrex::Real>::infinity()
private

Upper bound of the time step. Avoid gigantic time step(s) when beam starts near vacuum

◆ m_min_uz

amrex::Real AdaptiveTimeStep::m_min_uz = std::numeric_limits<amrex::Real>::max()
private

uz of the slowest particles

◆ m_nbeams

int AdaptiveTimeStep::m_nbeams = 0
private

Number of beam species for which adaptive time step is computed

◆ m_nt_per_betatron

amrex::Real AdaptiveTimeStep::m_nt_per_betatron = 20.
private

Number of time steps per betatron period for the adaptive time step

◆ m_threshold_uz

amrex::Real AdaptiveTimeStep::m_threshold_uz = 2.
private

Threshold beam momentum, below which the time step is not decreased

◆ m_timestep_data

amrex::Vector<amrex::Vector<amrex::Real> > AdaptiveTimeStep::m_timestep_data
private

container including dt, min_gamma, sum of weights and the sum of weights times gamma


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