# Advanced Time-Stepping Methods in USim¶

USim implements methods that allows a simulation to be advanced on the timestep associated with the inviscid equations (e.g. the Euler equations), rather than that associated with (for example) the Navier-Stokes equations or complex reaction chemistry. These methods typically allow a speed up $$\sim \sqrt{N}$$ where $$N$$ is the ratio of the inviscid to the (for example) viscous timesteps.

## Subcycling for Complex Chemsitry¶

The Flow over cylindrical rod example of the USimHS package of USim implements methods for accelerating chemical reaction rates through sub-cycling. An example updater block that implements these methods is shown below:

<Updater chemistryUpdater>
kind = stsUpdater2d
onGrid = domain
timeIntegrationScheme = zerothOrder
updaters = [sourceUpdater]

integrationVariablesIn = [qSpecies]
integrationVariablesOut = [qSpeciesNew]
timeStepRestrictions = [reactionrateDT]
dummyVariables_qSpecies = [dummySpecies1, dummySpecies2, dummySpecies3, dummySpecies4, dummySpecies5]
</Updater>


The meanings for the input blocks in this updater are as follows:

kind (string)

Specifies the stsUpdater2d updater, which tells USim to advance the solution vector super time stepping methods in 2d.

timeIntegratioScheme (string)

The order of accuracy of the time-integration scheme that to be used. Here we have specified a sub-cycling scheme using zerothOrder.

updaters (string)

The list of updaters that are used to perform the time integration. This is equivalent to the loop field of the update-sequence that was discussed in USimBase Tutorial on Euler Equations, input file, with the exception that updater are called directly, rather than through an update-step. In this case, we call one updater sourceUpdater, which calculates chemical reaction rates.

integrationVariablesIn (string)

Specifies the data structure that contains the conserved state at time $$t$$, here this is qSpecies.

integrationVariablesOut (string)

Specifies the data structure that contains the conserved state updated to time $$t+\Delta t$$, here this is qSpeciesNew

timeStepRestrictions (string)

Specifies the dynVector data structure that holds the timestep associated with the chemical reaction. Here, this is reactionrateDT, which is defined through:

<DataStruct reactionrateDT>
kind = dynVector
numComponents = 1
writeOut = false
</DataStruct>


The timestep restriction is calculated using the dynVectorOperator updater:

<Updater fixDt>
# to fix dt to specified value
kind = dynVectorOperator
in = [ ]
out = [reactionrateDT]
onGrid = [domain]

maxDt = MAX_DT

exprs = ["maxDt"]
</Updater>


This updater sets the dynVector called reactionrateDT to hold the value specified by MAX_DT.

dummyVariables_q (string)

A list of dummy variables that are used by the multiUpdater to perform the integration. These are subsitituted for the qSpecies vector and should have the same number of components. The stsUpdater requires five dummy vectors, irrespective of the choice of timeIntegrationScheme.

## Super Time Stepping for Viscous Operators¶

The Flow over cylindrical rod example of the USimHS package of USim implements methods for accelerating chemical reaction rates through sub-cycling. An example updater block that implements these methods is shown below:

<Updater stsUpdater>
kind = stsUpdater2d
onGrid = domain
timeIntegrationScheme = secondOrder

updaters = [bcAxis, bcInflow, bcWall, bcOutflow,bcFreeflow, \
computeViscousSource,setViscSource]

integrationVariablesIn = [q]
integrationVariablesOut = [qnew]
timeStepRestrictions = [diffDT1,diffDT2]
dummyVariables_q = [dummy1, dummy2, dummy3, dummy4, dummy5]
</Updater>


The meanings for the input blocks in this updater are as follows:

timeIntegratioScheme (string)

The order of accuracy of the time-integration scheme that to be used. Here we have specified a second order super time stepping scheme using secondOrder.

timeStepRestrictions (string)

Specifies the dynVector data structure that holds the timestep associated with the chemical reaction. Here, this is [diffDT1,diffDT2], which are defined through:

<DataStruct diffDT1>
kind = dynVector
numComponents = 1
writeOut = false
</DataStruct>

<DataStruct diffDT2>
kind = dynVector
numComponents = 1
writeOut = false
</DataStruct>


These timestep restriction are calculated using the getTimeStepRestriction updater:

 <Updater getDiffDT1>
kind = getTimeStepUpdater2d
in = [kinematicViscosity]
out = [diffDT1]
onGrid = domain

cfl = CFL
</TimeStepRestriction>
</Updater>

<Updater getDiffDT2>
kind = getTimeStepUpdater2d
in = [kinematicConductivity]
out = [diffDT2]
onGrid = domain