Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5bf3e86
`const` and immutable `struct`s
DanielDoehring Nov 4, 2025
fcf2a93
fmt
DanielDoehring Nov 4, 2025
82dff78
More immutable
DanielDoehring Nov 6, 2025
696c65d
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 6, 2025
3e38169
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 6, 2025
a2d6332
fixes
DanielDoehring Nov 6, 2025
f5b1062
Merge branch 'Const_Immutable_Structs' of github.com:DanielDoehring/T…
DanielDoehring Nov 6, 2025
d2c32c6
bf
DanielDoehring Nov 6, 2025
9d708e5
revert
DanielDoehring Nov 6, 2025
d7d1bad
bf
DanielDoehring Nov 6, 2025
d2009f7
rev
DanielDoehring Nov 6, 2025
51f760d
rev
DanielDoehring Nov 6, 2025
b206a06
mv
DanielDoehring Nov 6, 2025
b95e26b
reset
DanielDoehring Nov 6, 2025
a85ba03
change
DanielDoehring Nov 6, 2025
0f3511f
dtmax
DanielDoehring Nov 6, 2025
385e151
rev
DanielDoehring Nov 6, 2025
433af07
more const
DanielDoehring Nov 10, 2025
0cfb7b9
order
DanielDoehring Nov 10, 2025
09c9bfc
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 10, 2025
9300dbb
more
DanielDoehring Nov 10, 2025
0a4e92f
more
DanielDoehring Nov 10, 2025
8e03b5a
const
DanielDoehring Nov 10, 2025
5c5c6ac
mention change
DanielDoehring Nov 10, 2025
d344ea5
Update NEWS.md
DanielDoehring Nov 10, 2025
d809ec1
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 12, 2025
c057288
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 14, 2025
933fd07
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 14, 2025
519d8b3
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 20, 2025
004e29e
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 21, 2025
a4775e7
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 23, 2025
32bf1bc
Update src/meshes/p4est_mesh.jl
DanielDoehring Nov 23, 2025
08ff883
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Nov 30, 2025
84780ec
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Dec 1, 2025
ca66e01
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Dec 2, 2025
0297fcb
Merge branch 'main' into Const_Immutable_Structs
DanielDoehring Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/p4est_2d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -26,7 +27,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -26,7 +27,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

# Add AMR callback
amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
Expand Down
3 changes: 2 additions & 1 deletion examples/p4est_3d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -24,7 +25,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/structured_2d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -25,7 +26,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/structured_3d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -24,7 +25,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/t8code_2d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -26,7 +27,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -26,7 +27,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

# Add AMR callback
amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
Expand Down
3 changes: 2 additions & 1 deletion examples/t8code_3d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -24,7 +25,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/tree_2d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# Define time integration algorithm
Expand All @@ -25,7 +26,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, alg;
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/tree_2d_dgsem/elixir_advection_restart_amr.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# Define time integration algorithm
Expand All @@ -24,7 +25,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

# Add AMR callback
amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
Expand Down
3 changes: 2 additions & 1 deletion examples/tree_3d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -22,7 +23,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
3 changes: 2 additions & 1 deletion examples/unstructured_2d_dgsem/elixir_euler_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrdinaryDiffEqLowStorageRK
using Trixi
using Accessors: @reset

###############################################################################
# create a restart file
Expand All @@ -24,7 +25,7 @@ dt = load_dt(restart_filename)
ode = semidiscretize(semi, tspan, restart_filename)

# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
@reset save_solution.condition.save_initial_solution = false

integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_stage/entropy_bounded_limiter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@muladd begin
#! format: noindent

mutable struct EntropyBoundedLimiter{RealT <: Real}
struct EntropyBoundedLimiter{RealT <: Real}
exp_entropy_decrease_max::RealT # < 0
end

Expand Down
4 changes: 2 additions & 2 deletions src/callbacks_step/alive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ time steps. If `analysis_interval ≂̸ 0`, the output is omitted every
"""
mutable struct AliveCallback
start_time::Float64
alive_interval::Int
analysis_interval::Int
const alive_interval::Int
const analysis_interval::Int
end

function AliveCallback(; analysis_interval = 0,
Expand Down
10 changes: 5 additions & 5 deletions src/callbacks_step/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ mutable struct AnalysisCallback{Analyzer, AnalysisIntegrals, InitialStateIntegra
start_time_last_analysis::Float64
ncalls_rhs_last_analysis::Int
start_gc_time::Float64
interval::Int
save_analysis::Bool
output_directory::String
analysis_filename::String
analyzer::Analyzer
const interval::Int
const save_analysis::Bool
const output_directory::String
const analysis_filename::String
const analyzer::Analyzer
analysis_errors::Vector{Symbol}
analysis_integrals::AnalysisIntegrals
initial_state_integrals::InitialStateIntegrals
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_step/save_restart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

Save the current numerical solution in a restart file every `interval` time steps.
"""
mutable struct SaveRestartCallback
struct SaveRestartCallback
interval::Int
save_final_restart::Bool
output_directory::String
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_step/save_solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function get_node_variable(::Val{symbol}, u, mesh, equations, dg, cache,
end
```
"""
mutable struct SaveSolutionCallback{IntervalType, SolutionVariablesType}
struct SaveSolutionCallback{IntervalType, SolutionVariablesType}
interval_or_dt::IntervalType
save_initial_solution::Bool
save_final_solution::Bool
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_step/steady_state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Terminates the integration when the [`residual_steady_state(du, equations)`](@ref)
falls below the threshold specified by `abstol, reltol`.
"""
mutable struct SteadyStateCallback{RealT <: Real}
struct SteadyStateCallback{RealT <: Real}
abstol::RealT
reltol::RealT
end
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_step/stepsize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ diffusive CFL number, or a function of time `t` returning a `Real` number.
By default, the timestep will be adjusted at every step.
For different values of `interval`, the timestep will be adjusted every `interval` steps.
"""
mutable struct StepsizeCallback{CflAdvectiveType, CflDiffusiveType}
struct StepsizeCallback{CflAdvectiveType, CflDiffusiveType}
cfl_advective::CflAdvectiveType
cfl_diffusive::CflDiffusiveType
interval::Int
Expand Down
12 changes: 6 additions & 6 deletions src/callbacks_step/time_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ Currently this callback is only implemented for [`TreeMesh`](@ref) and [`Unstruc
"""
mutable struct TimeSeriesCallback{RealT <: Real, uEltype <: Real, SolutionVariables,
VariableNames, Cache}
interval::Int
solution_variables::SolutionVariables
variable_names::VariableNames
output_directory::String
filename::String
point_coordinates::Array{RealT, 2}
const interval::Int
const solution_variables::SolutionVariables
const variable_names::VariableNames
const output_directory::String
const filename::String
const point_coordinates::Array{RealT, 2}
# Point data is stored as a vector of vectors of the solution data type:
# * the "outer" `Vector` contains one vector for each point at which a time_series is recorded
# * the "inner" `Vector` contains the actual time series for a single point,
Expand Down
4 changes: 2 additions & 2 deletions src/callbacks_step/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
@muladd begin
#! format: noindent

mutable struct VisualizationCallback{PlotDataCreator, SolutionVariables, VariableNames,
PlotCreator}
struct VisualizationCallback{PlotDataCreator, SolutionVariables, VariableNames,
PlotCreator}
plot_data_creator::PlotDataCreator
interval::Int
solution_variables::SolutionVariables
Expand Down
6 changes: 3 additions & 3 deletions src/equations/ideal_glm_mhd_multiion_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ References:
In case of more than one ion species, the multi-ion GLM-MHD equations should ALWAYS be used
with [`source_terms_lorentz`](@ref).
"""
mutable struct IdealGlmMhdMultiIonEquations2D{NVARS, NCOMP, RealT <: Real,
ElectronPressure, ElectronTemperature} <:
AbstractIdealGlmMhdMultiIonEquations{2, NVARS, NCOMP}
struct IdealGlmMhdMultiIonEquations2D{NVARS, NCOMP, RealT <: Real,
ElectronPressure, ElectronTemperature} <:
AbstractIdealGlmMhdMultiIonEquations{2, NVARS, NCOMP}
gammas::SVector{NCOMP, RealT} # Heat capacity ratios
charge_to_mass::SVector{NCOMP, RealT} # Charge to mass ratios
gas_constants::SVector{NCOMP, RealT} # Specific gas constants
Expand Down
6 changes: 3 additions & 3 deletions src/equations/ideal_glm_mhd_multiion_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ References:
In case of more than one ion species, the multi-ion GLM-MHD equations should ALWAYS be used
with [`source_terms_lorentz`](@ref).
"""
mutable struct IdealGlmMhdMultiIonEquations3D{NVARS, NCOMP, RealT <: Real,
ElectronPressure} <:
AbstractIdealGlmMhdMultiIonEquations{3, NVARS, NCOMP}
struct IdealGlmMhdMultiIonEquations3D{NVARS, NCOMP, RealT <: Real,
ElectronPressure} <:
AbstractIdealGlmMhdMultiIonEquations{3, NVARS, NCOMP}
gammas::SVector{NCOMP, RealT} # Heat capacity ratios
charge_to_mass::SVector{NCOMP, RealT} # Charge to mass ratios
electron_pressure::ElectronPressure # Function to compute the electron pressure
Expand Down
4 changes: 2 additions & 2 deletions src/meshes/dgmulti_meshes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ dispatchable type. This is intended to store geometric data and connectivities f
mesh (Cartesian, affine, curved, structured/unstructured).
"""
mutable struct DGMultiMesh{NDIMS, MeshType, MeshDataT <: MeshData{NDIMS}, BoundaryFaceT}
md::MeshDataT
const md::MeshDataT

boundary_faces::BoundaryFaceT
const boundary_faces::BoundaryFaceT

current_filename :: String
unsaved_changes :: Bool
Expand Down
12 changes: 6 additions & 6 deletions src/meshes/p4est_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ mesh for a two-dimensional surface or shell in three-dimensional space.
mutable struct P4estMesh{NDIMS, NDIMS_AMBIENT, RealT <: Real, IsParallel, P, Ghost,
NDIMSP2, NNODES} <:
AbstractMesh{NDIMS}
p4est :: P # Either PointerWrapper{p4est_t} or PointerWrapper{p8est_t}
is_parallel :: IsParallel
ghost :: Ghost # Either PointerWrapper{p4est_ghost_t} or PointerWrapper{p8est_ghost_t}
p4est::P # Either PointerWrapper{p4est_t} or PointerWrapper{p8est_t}
const is_parallel::IsParallel
ghost::Ghost # Either PointerWrapper{p4est_ghost_t} or PointerWrapper{p8est_ghost_t}
# Coordinates at the nodes specified by the tensor product of `nodes` (NDIMS times).
# This specifies the geometry interpolation for each tree.
tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree]
nodes::SVector{NNODES, RealT}
boundary_names::Array{Symbol, 2} # [face direction, tree]
const nodes::SVector{NNODES, RealT}
boundary_names::Array{Symbol, 2} # [face direction, tree]
current_filename::String
unsaved_changes::Bool
p4est_partition_allow_for_coarsening::Bool
const p4est_partition_allow_for_coarsening::Bool

function P4estMesh{NDIMS}(p4est, tree_node_coordinates, nodes, boundary_names,
current_filename, unsaved_changes,
Expand Down
8 changes: 4 additions & 4 deletions src/meshes/structured_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Different numbers of cells per dimension are possible and arbitrary functions
can be used as domain faces.
"""
mutable struct StructuredMesh{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS}
cells_per_dimension::NTuple{NDIMS, Int}
mapping::Any # Not relevant for performance
mapping_as_string::String
periodicity::NTuple{NDIMS, Bool}
const cells_per_dimension::NTuple{NDIMS, Int}
const mapping::Any # Not relevant for performance
const mapping_as_string::String
const periodicity::NTuple{NDIMS, Bool}
current_filename::String
unsaved_changes::Bool
end
Expand Down
12 changes: 6 additions & 6 deletions src/meshes/structured_mesh_view.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
A view on a structured curved mesh.
"""
mutable struct StructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS}
parent::StructuredMesh{NDIMS, RealT}
cells_per_dimension::NTuple{NDIMS, Int}
mapping::Any # Not relevant for performance
mapping_as_string::String
const parent::StructuredMesh{NDIMS, RealT}
const cells_per_dimension::NTuple{NDIMS, Int}
const mapping::Any # Not relevant for performance
const mapping_as_string::String
current_filename::String
indices_min::NTuple{NDIMS, Int}
indices_max::NTuple{NDIMS, Int}
const indices_min::NTuple{NDIMS, Int}
const indices_max::NTuple{NDIMS, Int}
unsaved_changes::Bool
end

Expand Down
Loading
Loading