Solvers
Solvers
IncompressibleNavierStokes.get_cfl_timestep! Method
get_cfl_timestep!(buf, u, setup) -> Any
Get proposed maximum time step for convection and diffusion terms.
IncompressibleNavierStokes.get_state Method
get_state(
stepper
) -> NamedTuple{(:u, :temp, :t, :n), <:NTuple{4, Any}}
Get state (; u, temp, t, n)
from stepper.
IncompressibleNavierStokes.solve_unsteady Method
solve_unsteady(
;
setup,
tlims,
ustart,
tempstart,
method,
psolver,
Δt,
Δt_min,
cfl,
n_adapt_Δt,
docopy,
processors,
θ,
cache
)
Solve unsteady problem using method
.
If Δt
is a real number, it is rounded such that (t_end - t_start) / Δt
is an integer. If Δt = nothing
, the time step is chosen every n_adapt_Δt
iteration with CFL-number cfl
. If Δt_min
is given, the adaptive time step never goes below it.
The processors
are called after every time step.
Note that the state
observable passed to the processor.initialize
function contains vector living on the device, and you may have to move them back to the host using Array(u)
in the processor.
Return (; u, t), outputs
, where outputs
is a named tuple with the outputs of processors
with the same field names.
Processors
Processors can be used to process the solution in solve_unsteady
after every time step.
IncompressibleNavierStokes.fieldsaver Method
fieldsaver(; setup, nupdate)
Create processor that stores the solution and time every nupdate
time step.
IncompressibleNavierStokes.observefield Method
observefield(state; setup, fieldname, logtol, psolver)
Observe field fieldname
at pressure points.
IncompressibleNavierStokes.observespectrum Method
observespectrum(state; setup, npoint, a)
Observe energy spectrum of state
.
IncompressibleNavierStokes.processor Function
processor(
initialize
) -> NamedTuple{(:initialize, :finalize), <:Tuple{Any, IncompressibleNavierStokes.var"#265#266"}}
processor(
initialize,
finalize
) -> NamedTuple{(:initialize, :finalize), <:Tuple{Any, Any}}
Process results from time stepping. Before time stepping, the initialize
function is called on an observable of the time stepper state
, returning initialized
. The observable is updated every time step.
After timestepping, the finalize
function is called on initialized
and the final state
.
See the following example:
function initialize(state)
s = 0
println("Let's sum up the time steps")
on(state) do (; n, t)
println("The summand is $n, the time is $t")
s = s + n
end
s
end
finalize(i, state) = println("The final sum (at time t=$(state.t)) is $s")
p = processor(initialize, finalize)
When solved for 6 time steps from t=0 to t=2 the displayed output is
Let's sum up the time steps
The summand is 0, the time is 0.0
The summand is 1, the time is 0.4
The summand is 2, the time is 0.8
The summand is 3, the time is 1.2
The summand is 4, the time is 1.6
The summand is 5, the time is 2.0
The final sum (at time t=2.0) is 15
IncompressibleNavierStokes.save_vtk Method
save_vtk(state; setup, filename, kwargs...)
Save fields to vtk file.
The kwargs
are passed to snapshotsaver
.
IncompressibleNavierStokes.snapshotsaver Method
snapshotsaver(state; setup, fieldnames, psolver)
In the case of a 2D setup, the velocity field is saved as a 3D vector with a z-component of zero, as this seems to be preferred by ParaView.
IncompressibleNavierStokes.timelogger Method
timelogger(
;
showiter,
showt,
showdt,
showmax,
showspeed,
nupdate
) -> @NamedTuple{initialize::IncompressibleNavierStokes.var"#268#270"{Bool, Bool, Bool, Bool, Bool, Int64}, finalize::IncompressibleNavierStokes.var"#265#266"}
Create processor that logs time step information.
IncompressibleNavierStokes.vtk_writer Method
vtk_writer(; setup, nupdate, dir, filename, kwargs...)
Create processor that writes the solution every nupdate
time steps to a VTK file. The resulting Paraview data collection file is stored in "$dir/$filename.pvd"
. The kwargs
are passed to snapshotsaver
.