Types
AstroNbodySim.CoarseMeshAstroNbodySim.DSAstroNbodySim.DeleteAstroNbodySim.DeviceConfigAstroNbodySim.DirectSumAstroNbodySim.FDMAstroNbodySim.FEMAstroNbodySim.FFTAstroNbodySim.FVMAstroNbodySim.GravityConfigAstroNbodySim.LogInfoAstroNbodySim.MHDAstroNbodySim.MLAstroNbodySim.OutboundLimiterAstroNbodySim.OutputConfigAstroNbodySim.OutputInfoAstroNbodySim.PhysicsInfoAstroNbodySim.SPHAstroNbodySim.SimConfigAstroNbodySim.SimulationAstroNbodySim.SolverConfigAstroNbodySim.StreamInfoAstroNbodySim.TimeConfigAstroNbodySim.TimeInfoAstroNbodySim.TreeAstroNbodySim.TreeSimConfigAstroNbodySim.VisualizationInfo
Core data structures
AstroNbodySim.Simulation — Type
struct Simulation{D}config::Anyid::Pair{Int64, Int64}pids::Vector{Int64}simdata::Anytimeinfo::Any:::TimeInfooutputinfo::Any:::OutputInfologinfo::Any:::LogInfophysics::Any:::PhysicsInfostream::Any:::StreamInfovisinfo::Any:::VisualizationInfobuffer::Any:::Bufferbgforce::Anybgpotential::Anypoststep::Any
AstroNbodySim.SimConfig — Type
struct SimConfig{F, U}name::Stringauthor::Stringdaytime::Dates.DateTimefloattype::Any: Numeric type of float numbersunits::Any: Prefered units in simulation. Default isuAstro. SeePhysicalParticles:uAstro,uSI,uGadget2,uCGS. To run without units, usenothingZeroValues::Any:ZeroValue. Pre-constructed zero values for different types to simplify function argumentsconstants::Any:Constant. Physical constantsloggingmode::Any: Choose how to display status of simulation. Supported:NormalMode,ProgressMode,SilentMode. Default isProgressModedisplaying progress barstime::Any:TimeConfigoutput::Any:OutputConfigsolver::Any:SolverConfiggrav::Any:GravityConfigdevice::Any:DeviceConfig
Examples
SimConfig(; GravitySolver = Tree())
SimConfig(; device = GPU(), TimeStep = 1.0e-5u"Gyr")
SimConfig(; units = uGadget2)
SimConfig(; units = nothing, ForceSofteningTable = [0.01 for i in 1:6])
SimConfig(; TimeEnd = 1.0u"Gyr", OutputDir = "Test/Dir")AstroNbodySim.LogInfo — Type
struct LogInfotimers::Dict{String, Int64}: Timer enum names to access timing (continuously starting from 1)timing::Vector{UInt64}: Timings defined by timer enumsanalysers::Dict{String, Function}: Analyse on the whole simulation
Examples #TODO
Use uppercase letters to avoid
AstroNbodySim.StreamInfo — Type
mutable struct StreamInfologgingio::IO: Stream for general loggingtimerio::IO: Stream for per-step timing CSVanalyserio::IO: Stream for analyser CSV
StreamInfo is a holder of IO streams used by the logger. The default constructor uses in-memory IOBuffers so that no system file is opened until setuploggers runs. The fields are typed as IO (the abstract supertype of IOStream, IOBuffer, and any other I/O handle) which keeps the struct flexible and type-stable.
AstroNbodySim.TimeInfo — Type
mutable struct TimeInfo{T<:Number, I<:Integer}dt::Number: Time interval between neighbor time stepssystem_time_int::Integersystem_time_float::Numberlast_system_time_int::Integerlast_system_time_float::Numbernext_output_time_int::Integernext_output_time_float::Numberredshift::Float64scalefactor::Float64min_endstep::Integerstepcount::Integer
AstroNbodySim.OutputInfo — Type
mutable struct OutputInfosnapshotcount::Int64syncflag::Bool
AstroNbodySim.PhysicsInfo — Type
mutable struct PhysicsInfoNumForceUpdateSinceLast::Int64
AstroNbodySim.VisualizationInfo — Type
mutable struct VisualizationInfoprogress::ProgressMeter.ProgressPlotData::Anysize::Anyfig::AnyRealtime::BoolRenderTime::Float64last_plot_time::Float64xlims::Anyylims::Anyzlims::Anymarkersize::Float64
AstroNbodySim.GravityConfig — Type
struct GravityConfig{Len, GM, OBL, BC}ForceSofteningTable::StaticArraysCore.MVector{6}: Gravitational softening lengths for different type of particlesmodel::Any: Gravity model. Supported:Newton,MOND1983Milgrom,QUMONDMOND_nuIndex::Float64: Index of Mondian interpolation functionoutbound::Any:::OutboundLimiter. Choose how to handle particles out of the non-periodic simulation box. Supported: -Delete: delete outbound particles -DS: use direct summation method to compute forces -CoarseMesh: Construct a coarse mesh to overlap all particles Default isDS.
enlarge::Float64: Enlarge the simulation box byenlargecompared to the extent of system. Default is3.0boundary::Any: Boundary condition. Supported:Vacuum,Periodic,Dirichlet. Default isVacuumsparse::Bool: Use sparse matrix to improve performance
Example
GravityConfig(uAstro)
GravityConfig(nothing)
GravityConfig(;ForceSofteningTable=[0.01u"kpc" for i in 1:6])AstroNbodySim.SolverConfig — Type
struct SolverConfig{SolverG}grav::Any: Gravitational force solver. Supported:DirectSum,Tree,FDM,FFT,ML. Default isDirectSumdata::Any: Data specialized for the solver
AstroNbodySim.OutputConfig — Type
struct OutputConfig{OT}dir::String: Output directory. Default:joinpath(pwd(), "output")func::Function: Output function. Default:AstroNbodySim.outputtype::Any: Output Type: traits ofgadget2,hdf5,jld2defined inAstroIO. Default:gadget2()format2::Bool: Iftrue, write in format2 mode for Gadget2 format. Default:trueacc::Bool: Iftrue, output acceleration in snapshots. Default:falsepot::Bool: Iftrue, output potential in snapshots. Default:falseSaveRestart::Bool: Iftrue, save restart files regularly. Default:trueSaveRestartFreq::Float64: Regularly after every fraction of the whole simulation time, save restart files. Default:1.0
Notes on Keywords
- Keywords are compatible with
SimConfig, and can also be overrided by field names of OutputConfig
Example
OutputConfig(; dir = "test", type = jld2(), format2 = false, acc = true, pot = true, SaveRestart = true, SaveRestartFreq = 0.33)AstroNbodySim.TimeConfig — Type
struct TimeConfig{Time, Step, I, TIA}Begin::Any: Physical time at the beginning of the simulationEnd::Any: Physical time at the end of the simulationBetweenSnapshots::Any: Time interval between snapshotsBetweenSnapshotsInt::Any: Integer time interval between snapshotsstep::Any: Timestep config. Controled by keywordTimeStep. IfTimeStepis zero, useAdaptiveTimestep; otherwise useConstantTimestepalgorithm::Any: Time integration algorithm. Supported:Euler,Leapfrogredshift::Float64: Redshift at startscalefactor::Float64: Scale factor at start
Notes on Keywords
- Keywords are compatible with
SimConfig, and can also be overrided by field names of TimeConfig - If timestep is non-zero, use
ConstantTimestep; otherwiseAdaptiveTimesteps TimeBaseis the length of integer timeline. Default is1<<30ErrTolTimestepcontrols the accuracy of adaptive time integration
Examples
TimeConfig(; TimeEnd = 1.0u"Gyr") # Keyword `End = TimeEnd` by default
TimeConfig(; End = 2.0u"Gyr") # Override keyword from `SimConfig`AstroNbodySim.DeviceConfig — Type
struct DeviceConfig{Device, GA}type::Any: Supported:CPU,GPUGPU_NumThreads::Int64GPU_Algorithm::Any:::GPUAlgorithm. Supported:AllPairs,Tiled. Default:AllPairs
Tree and mesh data
AstroNbodySim.TreeSimConfig — Type
struct TreeSimConfigControls accuracy of tree method
TreeOpenAngle::Float64: If the view angle of tree node that relative to the sink point is too large, open this node. In radian unit. Default is0.1ErrTolAcc::Float64: While opening the tree node, take the last acceleration into account. Improves accuracy at high redshift cosmology. Default is0.025
Trait / marker types
These are singleton types that dispatch the various kernels and integrators at runtime; the traitstring companion returns the short string used for log files and plot titles.
AstroNbodySim.DirectSum — Type
Direct Summation Method
AstroNbodySim.Tree — Type
Peano-Hilbert Space Filling Octree Method
AstroNbodySim.FDM — Type
Finite Differencing Method
AstroNbodySim.FFT — Type
Fast Fourier Transform
AstroNbodySim.ML — Type
Machine Learning
AstroNbodySim.SPH — Type
Smoothed Particle Hydrodynamics
AstroNbodySim.MHD — Type
Magnetohydrodynamics
AstroNbodySim.FEM — Type
Finite Element Method
AstroNbodySim.FVM — Type
Finite Volume Method
AstroNbodySim.OutboundLimiter — Type
`::OutboundLimiter`. Choose how to handle particles out of the non-periodic simulation box.
Supported:
- `Delete`: delete outbound particles
- `DS`: use direct summation method to compute forces
- `CoarseMesh`: Construct a coarse mesh to overlap all particlesAstroNbodySim.Delete — Type
Delete outbound particles if they run out of the non-periodic simulation box
AstroNbodySim.DS — Type
Compute forces using direct summation method if the particles run out of the non-periodic simulation box
AstroNbodySim.CoarseMesh — Type
Construct a coarse mesh to overlap all particles for non-periodic boundary conditions