From 5bf3e863197bfe5cf12628b3fc7afe5ba3ca13ab Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 4 Nov 2025 11:02:11 +0100 Subject: [PATCH 01/22] `const` and immutable `struct`s --- src/callbacks_stage/entropy_bounded_limiter.jl | 2 +- src/callbacks_step/alive.jl | 2 +- src/callbacks_step/analysis.jl | 10 +++++----- src/callbacks_step/save_restart.jl | 2 +- src/callbacks_step/save_solution.jl | 2 +- src/callbacks_step/steady_state.jl | 2 +- src/callbacks_step/stepsize.jl | 2 +- src/callbacks_step/time_series.jl | 12 ++++++------ src/callbacks_step/visualization.jl | 8 ++++---- src/meshes/dgmulti_meshes.jl | 2 +- src/meshes/p4est_mesh.jl | 4 ++-- src/meshes/structured_mesh.jl | 2 +- src/meshes/structured_mesh_view.jl | 2 +- src/meshes/t8code_mesh.jl | 2 +- src/meshes/unstructured_mesh.jl | 2 +- .../semidiscretization_hyperbolic.jl | 2 +- src/time_integration/methods_2N.jl | 6 +++--- src/time_integration/methods_SSP.jl | 6 +++--- .../paired_explicit_runge_kutta.jl | 6 +++--- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/callbacks_stage/entropy_bounded_limiter.jl b/src/callbacks_stage/entropy_bounded_limiter.jl index 57bc658cf82..7a75030b36b 100644 --- a/src/callbacks_stage/entropy_bounded_limiter.jl +++ b/src/callbacks_stage/entropy_bounded_limiter.jl @@ -5,7 +5,7 @@ @muladd begin #! format: noindent -mutable struct EntropyBoundedLimiter{RealT <: Real} +struct EntropyBoundedLimiter{RealT <: Real} exp_entropy_decrease_max::RealT # < 0 end diff --git a/src/callbacks_step/alive.jl b/src/callbacks_step/alive.jl index fe2234166cd..db6c3759c62 100644 --- a/src/callbacks_step/alive.jl +++ b/src/callbacks_step/alive.jl @@ -13,7 +13,7 @@ some information such as the current time to the screen every `alive_interval` time steps. If `analysis_interval ≂̸ 0`, the output is omitted every `analysis_interval` time steps. """ -mutable struct AliveCallback +struct AliveCallback start_time::Float64 alive_interval::Int analysis_interval::Int diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 127f077be10..7691bc8f3fa 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -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 diff --git a/src/callbacks_step/save_restart.jl b/src/callbacks_step/save_restart.jl index 9f9ca49bc50..b1c653ef09f 100644 --- a/src/callbacks_step/save_restart.jl +++ b/src/callbacks_step/save_restart.jl @@ -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 diff --git a/src/callbacks_step/save_solution.jl b/src/callbacks_step/save_solution.jl index ac40bc42de0..091fa455150 100644 --- a/src/callbacks_step/save_solution.jl +++ b/src/callbacks_step/save_solution.jl @@ -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 diff --git a/src/callbacks_step/steady_state.jl b/src/callbacks_step/steady_state.jl index 7085d05394f..d7de1dbda01 100644 --- a/src/callbacks_step/steady_state.jl +++ b/src/callbacks_step/steady_state.jl @@ -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 diff --git a/src/callbacks_step/stepsize.jl b/src/callbacks_step/stepsize.jl index de820c40590..da984e0b4b8 100644 --- a/src/callbacks_step/stepsize.jl +++ b/src/callbacks_step/stepsize.jl @@ -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 diff --git a/src/callbacks_step/time_series.jl b/src/callbacks_step/time_series.jl index d3c9861d33d..bb7c74e4742 100644 --- a/src/callbacks_step/time_series.jl +++ b/src/callbacks_step/time_series.jl @@ -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, diff --git a/src/callbacks_step/visualization.jl b/src/callbacks_step/visualization.jl index 367b30bd573..dc4e1e2ec8a 100644 --- a/src/callbacks_step/visualization.jl +++ b/src/callbacks_step/visualization.jl @@ -8,10 +8,10 @@ mutable struct VisualizationCallback{PlotDataCreator, SolutionVariables, VariableNames, PlotCreator} plot_data_creator::PlotDataCreator - interval::Int - solution_variables::SolutionVariables - variable_names::VariableNames - show_mesh::Bool + const interval::Int + const solution_variables::SolutionVariables + const variable_names::VariableNames + const show_mesh::Bool plot_creator::PlotCreator plot_arguments::Dict{Symbol, Any} end diff --git a/src/meshes/dgmulti_meshes.jl b/src/meshes/dgmulti_meshes.jl index 70af85ec415..13cf4fef0e6 100644 --- a/src/meshes/dgmulti_meshes.jl +++ b/src/meshes/dgmulti_meshes.jl @@ -12,7 +12,7 @@ dispatchable type. This is intended to store geometric data and connectivities for any type of mesh (Cartesian, affine, curved, structured/unstructured). """ -mutable struct DGMultiMesh{NDIMS, MeshType, MeshDataT <: MeshData{NDIMS}, BoundaryFaceT} +struct DGMultiMesh{NDIMS, MeshType, MeshDataT <: MeshData{NDIMS}, BoundaryFaceT} md::MeshDataT boundary_faces::BoundaryFaceT diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index b9ed2915ca3..76070a8a9b8 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -30,8 +30,8 @@ mutable struct P4estMesh{NDIMS, NDIMS_AMBIENT, RealT <: Real, IsParallel, P, Gho # 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} + const boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String unsaved_changes::Bool p4est_partition_allow_for_coarsening::Bool diff --git a/src/meshes/structured_mesh.jl b/src/meshes/structured_mesh.jl index 20d3dbeb84b..aaca73fc454 100644 --- a/src/meshes/structured_mesh.jl +++ b/src/meshes/structured_mesh.jl @@ -13,7 +13,7 @@ A structured curved mesh. 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} +struct StructuredMesh{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} cells_per_dimension::NTuple{NDIMS, Int} mapping::Any # Not relevant for performance mapping_as_string::String diff --git a/src/meshes/structured_mesh_view.jl b/src/meshes/structured_mesh_view.jl index d931d25bbe1..1beff71dbcf 100644 --- a/src/meshes/structured_mesh_view.jl +++ b/src/meshes/structured_mesh_view.jl @@ -10,7 +10,7 @@ A view on a structured curved mesh. """ -mutable struct StructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} +struct StructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} parent::StructuredMesh{NDIMS, RealT} cells_per_dimension::NTuple{NDIMS, Int} mapping::Any # Not relevant for performance diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index f2a9b9283c3..0442d30cb79 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -16,7 +16,7 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: # Stores the quadrature nodes. nodes::SVector{NNODES, RealT} - boundary_names :: Array{Symbol, 2} # [face direction, tree] + const boundary_names :: Array{Symbol, 2} # [face direction, tree] current_filename :: String ninterfaces :: Int diff --git a/src/meshes/unstructured_mesh.jl b/src/meshes/unstructured_mesh.jl index fae52f834b3..1d799867fdd 100644 --- a/src/meshes/unstructured_mesh.jl +++ b/src/meshes/unstructured_mesh.jl @@ -15,7 +15,7 @@ An unstructured (possibly curved) quadrilateral mesh. All mesh information, neighbour coupling, and boundary curve information is read in from a mesh file `filename`. """ -mutable struct UnstructuredMesh2D{RealT <: Real, +struct UnstructuredMesh2D{RealT <: Real, CurvedSurfaceT <: CurvedSurface{RealT}} <: AbstractMesh{2} filename :: String diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 2a563c02229..4e08a6400af 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -11,7 +11,7 @@ A struct containing everything needed to describe a spatial semidiscretization of a hyperbolic conservation law. """ -mutable struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, +struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, BoundaryConditions, SourceTerms, Solver, Cache} <: AbstractSemidiscretization diff --git a/src/time_integration/methods_2N.jl b/src/time_integration/methods_2N.jl index d115aa366d1..25804e98137 100644 --- a/src/time_integration/methods_2N.jl +++ b/src/time_integration/methods_2N.jl @@ -77,9 +77,9 @@ end # This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L1 mutable struct SimpleIntegratorOptions{Callback} callback::Callback # callbacks; used in Trixi.jl - adaptive::Bool # whether the algorithm is adaptive; ignored - dtmax::Float64 # ignored - maxiters::Int # maximal number of time steps + const adaptive::Bool # whether the algorithm is adaptive; ignored + const dtmax::Float64 # ignored + const maxiters::Int # maximal number of time steps tstops::Vector{Float64} # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end diff --git a/src/time_integration/methods_SSP.jl b/src/time_integration/methods_SSP.jl index 5603009e121..82a62b36d46 100644 --- a/src/time_integration/methods_SSP.jl +++ b/src/time_integration/methods_SSP.jl @@ -54,9 +54,9 @@ end # This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L1 mutable struct SimpleIntegratorSSPOptions{Callback, TStops} callback::Callback # callbacks; used in Trixi - adaptive::Bool # whether the algorithm is adaptive; ignored - dtmax::Float64 # ignored - maxiters::Int # maximal number of time steps + const adaptive::Bool # whether the algorithm is adaptive; ignored + const dtmax::Float64 # ignored + const maxiters::Int # maximal number of time steps tstops::TStops # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end diff --git a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl index 333ebc14983..2dfc1ac4e9f 100644 --- a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl +++ b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl @@ -17,9 +17,9 @@ abstract type AbstractPairedExplicitRKSingle <: AbstractPairedExplicitRK end # This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L1 mutable struct PairedExplicitRKOptions{Callback, TStops} callback::Callback # callbacks; used in Trixi - adaptive::Bool # whether the algorithm is adaptive (false) - dtmax::Float64 # ignored - maxiters::Int # maximal number of time steps + const adaptive::Bool # whether the algorithm is adaptive (false) + const dtmax::Float64 # ignored + const maxiters::Int # maximal number of time steps tstops::TStops # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end From fcf2a933e3e3a6b36f3dd4f6b922b2c69264cf3f Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 4 Nov 2025 11:04:08 +0100 Subject: [PATCH 02/22] fmt --- src/meshes/t8code_mesh.jl | 4 ++-- src/meshes/unstructured_mesh.jl | 4 ++-- src/semidiscretization/semidiscretization_hyperbolic.jl | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index 0442d30cb79..4d24b8581a7 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -16,8 +16,8 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: # Stores the quadrature nodes. nodes::SVector{NNODES, RealT} - const boundary_names :: Array{Symbol, 2} # [face direction, tree] - current_filename :: String + boundary_names::Array{Symbol, 2} # [face direction, tree] + current_filename::String ninterfaces :: Int nmortars :: Int diff --git a/src/meshes/unstructured_mesh.jl b/src/meshes/unstructured_mesh.jl index 1d799867fdd..79605537b0b 100644 --- a/src/meshes/unstructured_mesh.jl +++ b/src/meshes/unstructured_mesh.jl @@ -16,8 +16,8 @@ All mesh information, neighbour coupling, and boundary curve information is read from a mesh file `filename`. """ struct UnstructuredMesh2D{RealT <: Real, - CurvedSurfaceT <: CurvedSurface{RealT}} <: - AbstractMesh{2} + CurvedSurfaceT <: CurvedSurface{RealT}} <: + AbstractMesh{2} filename :: String n_corners :: Int n_surfaces :: Int # total number of surfaces diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 4e08a6400af..dc0b9ebb491 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -12,9 +12,9 @@ A struct containing everything needed to describe a spatial semidiscretization of a hyperbolic conservation law. """ struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, - BoundaryConditions, - SourceTerms, Solver, Cache} <: - AbstractSemidiscretization + BoundaryConditions, + SourceTerms, Solver, Cache} <: + AbstractSemidiscretization mesh::Mesh equations::Equations From 82dff78dcb0c5ba79de07ba67535cfc08c9dae0d Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 16:16:31 +0100 Subject: [PATCH 03/22] More immutable --- src/callbacks_step/visualization.jl | 12 ++++++------ src/equations/ideal_glm_mhd_multiion_2d.jl | 6 +++--- src/equations/ideal_glm_mhd_multiion_3d.jl | 6 +++--- src/meshes/p4est_mesh.jl | 12 ++++++------ src/meshes/p4est_mesh_view.jl | 4 ++-- src/meshes/t8code_mesh.jl | 8 ++++---- .../dgsem_unstructured/sort_boundary_conditions.jl | 6 +++--- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/callbacks_step/visualization.jl b/src/callbacks_step/visualization.jl index dc4e1e2ec8a..228dabdd23c 100644 --- a/src/callbacks_step/visualization.jl +++ b/src/callbacks_step/visualization.jl @@ -5,13 +5,13 @@ @muladd begin #! format: noindent -mutable struct VisualizationCallback{PlotDataCreator, SolutionVariables, VariableNames, - PlotCreator} +struct VisualizationCallback{PlotDataCreator, SolutionVariables, VariableNames, + PlotCreator} plot_data_creator::PlotDataCreator - const interval::Int - const solution_variables::SolutionVariables - const variable_names::VariableNames - const show_mesh::Bool + interval::Int + solution_variables::SolutionVariables + variable_names::VariableNames + show_mesh::Bool plot_creator::PlotCreator plot_arguments::Dict{Symbol, Any} end diff --git a/src/equations/ideal_glm_mhd_multiion_2d.jl b/src/equations/ideal_glm_mhd_multiion_2d.jl index 38b3e52fa49..2d11d49bb0a 100644 --- a/src/equations/ideal_glm_mhd_multiion_2d.jl +++ b/src/equations/ideal_glm_mhd_multiion_2d.jl @@ -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 diff --git a/src/equations/ideal_glm_mhd_multiion_3d.jl b/src/equations/ideal_glm_mhd_multiion_3d.jl index f5a88ca4192..26157b61927 100644 --- a/src/equations/ideal_glm_mhd_multiion_3d.jl +++ b/src/equations/ideal_glm_mhd_multiion_3d.jl @@ -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 diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index 76070a8a9b8..3da56d8d7eb 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -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] const nodes::SVector{NNODES, RealT} const boundary_names::Array{Symbol, 2} # [face direction, tree] - current_filename::String - unsaved_changes::Bool - p4est_partition_allow_for_coarsening::Bool + const current_filename::String + const unsaved_changes::Bool + const p4est_partition_allow_for_coarsening::Bool function P4estMesh{NDIMS}(p4est, tree_node_coordinates, nodes, boundary_names, current_filename, unsaved_changes, diff --git a/src/meshes/p4est_mesh_view.jl b/src/meshes/p4est_mesh_view.jl index 38493618a69..c085abcbde8 100644 --- a/src/meshes/p4est_mesh_view.jl +++ b/src/meshes/p4est_mesh_view.jl @@ -10,8 +10,8 @@ A view on a [`P4estMesh`](@ref). """ -mutable struct P4estMeshView{NDIMS, NDIMS_AMBIENT, RealT <: Real, Parent} <: - AbstractMesh{NDIMS} +struct P4estMeshView{NDIMS, NDIMS_AMBIENT, RealT <: Real, Parent} <: + AbstractMesh{NDIMS} parent::Parent cell_ids::Vector{Int} unsaved_changes::Bool diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index 4d24b8581a7..9a96e7f25b1 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -7,16 +7,16 @@ to manage trees and mesh refinement. """ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: AbstractMesh{NDIMS} - forest :: T8code.ForestWrapper - is_parallel :: IsParallel + forest::T8code.ForestWrapper + const is_parallel::IsParallel # This specifies the geometry interpolation for each tree. tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] # Stores the quadrature nodes. - nodes::SVector{NNODES, RealT} + const nodes::SVector{NNODES, RealT} - boundary_names::Array{Symbol, 2} # [face direction, tree] + const boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String ninterfaces :: Int diff --git a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl index d6cf6e1ce6d..22619063d02 100644 --- a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl +++ b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl @@ -8,13 +8,13 @@ """ UnstructuredSortedBoundaryTypes -General container to sort the boundary conditions by type and name for some unstructured meshes/solvers. +General struct to sort the boundary conditions by type and name for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type and name to expedite computation during the call to `calc_boundary_flux!`. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing. """ -mutable struct UnstructuredSortedBoundaryTypes{N, BCs <: NTuple{N, Any}, - Vec <: AbstractVector{<:Integer}} +struct UnstructuredSortedBoundaryTypes{N, BCs <: NTuple{N, Any}, + Vec <: AbstractVector{<:Integer}} boundary_condition_types::BCs # specific boundary condition type(s), e.g. BoundaryConditionDirichlet boundary_indices::NTuple{N, Vec} # integer vectors containing global boundary indices boundary_dictionary::Dict{Symbol, Any} # boundary conditions as set by the user in the elixir file From a2d63329e6c3eac761737dd5252ea2ee4de835c4 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 16:41:33 +0100 Subject: [PATCH 04/22] fixes --- src/callbacks_step/alive.jl | 6 +++--- .../dgsem_unstructured/sort_boundary_conditions.jl | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/callbacks_step/alive.jl b/src/callbacks_step/alive.jl index db6c3759c62..84225f7f7d8 100644 --- a/src/callbacks_step/alive.jl +++ b/src/callbacks_step/alive.jl @@ -13,10 +13,10 @@ some information such as the current time to the screen every `alive_interval` time steps. If `analysis_interval ≂̸ 0`, the output is omitted every `analysis_interval` time steps. """ -struct AliveCallback +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, diff --git a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl index 22619063d02..0e5d51a917e 100644 --- a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl +++ b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl @@ -13,11 +13,11 @@ It stores a set of global indices for each boundary condition type and name to e during the call to `calc_boundary_flux!`. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing. """ -struct UnstructuredSortedBoundaryTypes{N, BCs <: NTuple{N, Any}, - Vec <: AbstractVector{<:Integer}} - boundary_condition_types::BCs # specific boundary condition type(s), e.g. BoundaryConditionDirichlet +mutable struct UnstructuredSortedBoundaryTypes{N, BCs <: NTuple{N, Any}, + Vec <: AbstractVector{<:Integer}} + const boundary_condition_types::BCs # specific boundary condition type(s), e.g. BoundaryConditionDirichlet boundary_indices::NTuple{N, Vec} # integer vectors containing global boundary indices - boundary_dictionary::Dict{Symbol, Any} # boundary conditions as set by the user in the elixir file + const boundary_dictionary::Dict{Symbol, Any} # boundary conditions as set by the user in the elixir file boundary_symbol_indices::Dict{Symbol, Vector{Int}} # integer vectors containing global boundary indices per boundary identifier end From d2c32c6ed90571bc2e343286f6bd99152829761d Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 16:46:56 +0100 Subject: [PATCH 05/22] bf --- src/meshes/t8code_mesh.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index 9a96e7f25b1..a53ba6d968f 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -14,7 +14,7 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] # Stores the quadrature nodes. - const nodes::SVector{NNODES, RealT} + nodes::SVector{NNODES, RealT} const boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String From 9d708e5cd56092c7d8c4a327de1b5d676a60ad9a Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 16:51:34 +0100 Subject: [PATCH 06/22] revert --- src/meshes/p4est_mesh.jl | 6 +++--- src/meshes/structured_mesh.jl | 10 ++++----- src/meshes/unstructured_mesh.jl | 38 ++++++++++++++++----------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index 3da56d8d7eb..3a34b9d2af1 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -31,9 +31,9 @@ mutable struct P4estMesh{NDIMS, NDIMS_AMBIENT, RealT <: Real, IsParallel, P, Gho # This specifies the geometry interpolation for each tree. tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] const nodes::SVector{NNODES, RealT} - const boundary_names::Array{Symbol, 2} # [face direction, tree] - const current_filename::String - const unsaved_changes::Bool + boundary_names::Array{Symbol, 2} # [face direction, tree] + current_filename::String + unsaved_changes::Bool const p4est_partition_allow_for_coarsening::Bool function P4estMesh{NDIMS}(p4est, tree_node_coordinates, nodes, boundary_names, diff --git a/src/meshes/structured_mesh.jl b/src/meshes/structured_mesh.jl index aaca73fc454..488f1ee6ef5 100644 --- a/src/meshes/structured_mesh.jl +++ b/src/meshes/structured_mesh.jl @@ -13,11 +13,11 @@ A structured curved mesh. Different numbers of cells per dimension are possible and arbitrary functions can be used as domain faces. """ -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} +mutable struct StructuredMesh{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} + 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 diff --git a/src/meshes/unstructured_mesh.jl b/src/meshes/unstructured_mesh.jl index 79605537b0b..f64dc3aea9f 100644 --- a/src/meshes/unstructured_mesh.jl +++ b/src/meshes/unstructured_mesh.jl @@ -15,25 +15,25 @@ An unstructured (possibly curved) quadrilateral mesh. All mesh information, neighbour coupling, and boundary curve information is read in from a mesh file `filename`. """ -struct UnstructuredMesh2D{RealT <: Real, - CurvedSurfaceT <: CurvedSurface{RealT}} <: - AbstractMesh{2} - filename :: String - n_corners :: Int - n_surfaces :: Int # total number of surfaces - n_interfaces :: Int # number of interior surfaces - n_boundaries :: Int # number of surfaces on the physical boundary - n_elements :: Int - polydeg :: Int - corners :: Array{RealT, 2} # [ndims, n_corners] - neighbour_information :: Array{Int, 2} # [neighbour node/element/edge ids, n_surfaces] - boundary_names :: Array{Symbol, 2} # [local sides, n_elements] - periodicity :: Bool - element_node_ids :: Array{Int, 2} # [node ids, n_elements] - element_is_curved :: Vector{Bool} - surface_curves :: Array{CurvedSurfaceT, 2} # [local sides, n_elements] - current_filename :: String - unsaved_changes :: Bool # if true, the mesh will be saved for plotting +mutable struct UnstructuredMesh2D{RealT <: Real, + CurvedSurfaceT <: CurvedSurface{RealT}} <: + AbstractMesh{2} + const filename :: String + const n_corners :: Int + const n_surfaces :: Int # total number of surfaces + const n_interfaces :: Int # number of interior surfaces + const n_boundaries :: Int # number of surfaces on the physical boundary + const n_elements :: Int + const polydeg :: Int + const corners :: Array{RealT, 2} # [ndims, n_corners] + const neighbour_information :: Array{Int, 2} # [neighbour node/element/edge ids, n_surfaces] + boundary_names :: Array{Symbol, 2} # [local sides, n_elements] + const periodicity :: Bool + element_node_ids :: Array{Int, 2} # [node ids, n_elements] + element_is_curved :: Vector{Bool} + surface_curves :: Array{CurvedSurfaceT, 2} # [local sides, n_elements] + current_filename :: String + unsaved_changes :: Bool # if true, the mesh will be saved for plotting end # constructor for an unstructured mesh read in from a file From d7d1bad0ddd05b378a0e71b96c33ddc93912b7da Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 16:55:42 +0100 Subject: [PATCH 07/22] bf --- src/meshes/t8code_mesh.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index a53ba6d968f..4f21c9ee2d3 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -16,7 +16,7 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: # Stores the quadrature nodes. nodes::SVector{NNODES, RealT} - const boundary_names::Array{Symbol, 2} # [face direction, tree] + boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String ninterfaces :: Int From d2009f71608a6f2969e925594c01bdb761577cc5 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 17:07:47 +0100 Subject: [PATCH 08/22] rev --- src/callbacks_step/save_solution.jl | 12 ++++++------ src/time_integration/methods_2N.jl | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/callbacks_step/save_solution.jl b/src/callbacks_step/save_solution.jl index 091fa455150..ea3a466e9f4 100644 --- a/src/callbacks_step/save_solution.jl +++ b/src/callbacks_step/save_solution.jl @@ -42,13 +42,13 @@ function get_node_variable(::Val{symbol}, u, mesh, equations, dg, cache, end ``` """ -struct SaveSolutionCallback{IntervalType, SolutionVariablesType} - interval_or_dt::IntervalType +mutable struct SaveSolutionCallback{IntervalType, SolutionVariablesType} + const interval_or_dt::IntervalType save_initial_solution::Bool - save_final_solution::Bool - output_directory::String - solution_variables::SolutionVariablesType - node_variables::Dict{Symbol, Any} + const save_final_solution::Bool + const output_directory::String + const solution_variables::SolutionVariablesType + const node_variables::Dict{Symbol, Any} end function Base.show(io::IO, cb::DiscreteCallback{<:Any, <:SaveSolutionCallback}) diff --git a/src/time_integration/methods_2N.jl b/src/time_integration/methods_2N.jl index 25804e98137..ddb7c79bfa5 100644 --- a/src/time_integration/methods_2N.jl +++ b/src/time_integration/methods_2N.jl @@ -78,7 +78,7 @@ end mutable struct SimpleIntegratorOptions{Callback} callback::Callback # callbacks; used in Trixi.jl const adaptive::Bool # whether the algorithm is adaptive; ignored - const dtmax::Float64 # ignored + dtmax::Float64 # ignored const maxiters::Int # maximal number of time steps tstops::Vector{Float64} # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end From 51f760ddacc3ca99fd94e9b16e08b6ee8013be91 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 17:18:28 +0100 Subject: [PATCH 09/22] rev --- .../semidiscretization_hyperbolic.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index dc0b9ebb491..b5745247701 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -11,20 +11,20 @@ A struct containing everything needed to describe a spatial semidiscretization of a hyperbolic conservation law. """ -struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, - BoundaryConditions, - SourceTerms, Solver, Cache} <: - AbstractSemidiscretization +mutable struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, + BoundaryConditions, + SourceTerms, Solver, Cache} <: + AbstractSemidiscretization mesh::Mesh equations::Equations # This guy is a bit messy since we abuse it as some kind of "exact solution" # although this doesn't really exist... - initial_condition::InitialCondition + const initial_condition::InitialCondition - boundary_conditions::BoundaryConditions - source_terms::SourceTerms - solver::Solver + const boundary_conditions::BoundaryConditions + const source_terms::SourceTerms + const solver::Solver cache::Cache performance_counter::PerformanceCounter end From b206a0619145835a10b022ed94a54342f6ca7b81 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 17:22:32 +0100 Subject: [PATCH 10/22] mv --- examples/p4est_2d_dgsem/elixir_advection_restart.jl | 2 +- .../p4est_2d_dgsem/elixir_advection_restart_amr.jl | 2 +- examples/p4est_3d_dgsem/elixir_advection_restart.jl | 2 +- .../structured_2d_dgsem/elixir_advection_restart.jl | 2 +- .../structured_3d_dgsem/elixir_advection_restart.jl | 2 +- examples/t8code_2d_dgsem/elixir_advection_restart.jl | 2 +- .../t8code_2d_dgsem/elixir_advection_restart_amr.jl | 2 +- examples/t8code_3d_dgsem/elixir_advection_restart.jl | 2 +- examples/tree_2d_dgsem/elixir_advection_restart.jl | 2 +- .../tree_2d_dgsem/elixir_advection_restart_amr.jl | 2 +- examples/tree_3d_dgsem/elixir_advection_restart.jl | 2 +- .../unstructured_2d_dgsem/elixir_euler_restart.jl | 2 +- src/callbacks_step/save_solution.jl | 12 ++++++------ 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/p4est_2d_dgsem/elixir_advection_restart.jl b/examples/p4est_2d_dgsem/elixir_advection_restart.jl index 5277a2f7292..6be8e79f99c 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_restart.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_restart.jl @@ -26,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 diff --git a/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl b/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl index b9b79600c2d..a37218da73b 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl @@ -26,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 # Add AMR callback amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first), diff --git a/examples/p4est_3d_dgsem/elixir_advection_restart.jl b/examples/p4est_3d_dgsem/elixir_advection_restart.jl index f428ea5e496..d8d8b63e3ed 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_restart.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_restart.jl @@ -24,7 +24,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 diff --git a/examples/structured_2d_dgsem/elixir_advection_restart.jl b/examples/structured_2d_dgsem/elixir_advection_restart.jl index c6df8f549ef..5397aee2a87 100644 --- a/examples/structured_2d_dgsem/elixir_advection_restart.jl +++ b/examples/structured_2d_dgsem/elixir_advection_restart.jl @@ -25,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 diff --git a/examples/structured_3d_dgsem/elixir_advection_restart.jl b/examples/structured_3d_dgsem/elixir_advection_restart.jl index b72789f876d..13e0a20b037 100644 --- a/examples/structured_3d_dgsem/elixir_advection_restart.jl +++ b/examples/structured_3d_dgsem/elixir_advection_restart.jl @@ -24,7 +24,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 diff --git a/examples/t8code_2d_dgsem/elixir_advection_restart.jl b/examples/t8code_2d_dgsem/elixir_advection_restart.jl index 5277a2f7292..6be8e79f99c 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_restart.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_restart.jl @@ -26,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 diff --git a/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl b/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl index 679639b831d..befe4d21e27 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl @@ -26,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 # Add AMR callback amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first), diff --git a/examples/t8code_3d_dgsem/elixir_advection_restart.jl b/examples/t8code_3d_dgsem/elixir_advection_restart.jl index f428ea5e496..d8d8b63e3ed 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_restart.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_restart.jl @@ -24,7 +24,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 diff --git a/examples/tree_2d_dgsem/elixir_advection_restart.jl b/examples/tree_2d_dgsem/elixir_advection_restart.jl index ba52a7e46aa..6d2f734bf79 100644 --- a/examples/tree_2d_dgsem/elixir_advection_restart.jl +++ b/examples/tree_2d_dgsem/elixir_advection_restart.jl @@ -25,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, alg; dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback diff --git a/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl b/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl index b568fd3c311..c16b311b4c7 100644 --- a/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl @@ -24,7 +24,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), diff --git a/examples/tree_3d_dgsem/elixir_advection_restart.jl b/examples/tree_3d_dgsem/elixir_advection_restart.jl index 626a253ad72..b672f122897 100644 --- a/examples/tree_3d_dgsem/elixir_advection_restart.jl +++ b/examples/tree_3d_dgsem/elixir_advection_restart.jl @@ -22,7 +22,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 diff --git a/examples/unstructured_2d_dgsem/elixir_euler_restart.jl b/examples/unstructured_2d_dgsem/elixir_euler_restart.jl index 95fb9a00aa9..07678584138 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_restart.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_restart.jl @@ -24,7 +24,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 diff --git a/src/callbacks_step/save_solution.jl b/src/callbacks_step/save_solution.jl index ea3a466e9f4..091fa455150 100644 --- a/src/callbacks_step/save_solution.jl +++ b/src/callbacks_step/save_solution.jl @@ -42,13 +42,13 @@ function get_node_variable(::Val{symbol}, u, mesh, equations, dg, cache, end ``` """ -mutable struct SaveSolutionCallback{IntervalType, SolutionVariablesType} - const interval_or_dt::IntervalType +struct SaveSolutionCallback{IntervalType, SolutionVariablesType} + interval_or_dt::IntervalType save_initial_solution::Bool - const save_final_solution::Bool - const output_directory::String - const solution_variables::SolutionVariablesType - const node_variables::Dict{Symbol, Any} + save_final_solution::Bool + output_directory::String + solution_variables::SolutionVariablesType + node_variables::Dict{Symbol, Any} end function Base.show(io::IO, cb::DiscreteCallback{<:Any, <:SaveSolutionCallback}) From b95e26b2c486df8ca0ea541f1578f1184947ad22 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 17:32:52 +0100 Subject: [PATCH 11/22] reset --- examples/p4est_2d_dgsem/elixir_advection_restart.jl | 1 + examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl | 1 + examples/p4est_3d_dgsem/elixir_advection_restart.jl | 1 + examples/structured_2d_dgsem/elixir_advection_restart.jl | 1 + examples/structured_3d_dgsem/elixir_advection_restart.jl | 1 + examples/t8code_2d_dgsem/elixir_advection_restart.jl | 1 + examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl | 1 + examples/t8code_3d_dgsem/elixir_advection_restart.jl | 1 + examples/tree_2d_dgsem/elixir_advection_restart.jl | 1 + examples/tree_2d_dgsem/elixir_advection_restart_amr.jl | 1 + examples/tree_3d_dgsem/elixir_advection_restart.jl | 1 + examples/unstructured_2d_dgsem/elixir_euler_restart.jl | 1 + 12 files changed, 12 insertions(+) diff --git a/examples/p4est_2d_dgsem/elixir_advection_restart.jl b/examples/p4est_2d_dgsem/elixir_advection_restart.jl index 6be8e79f99c..0dbbb6c3d14 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_restart.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl b/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl index a37218da73b..2f110f8f409 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/p4est_3d_dgsem/elixir_advection_restart.jl b/examples/p4est_3d_dgsem/elixir_advection_restart.jl index d8d8b63e3ed..230f7483aeb 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_restart.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/structured_2d_dgsem/elixir_advection_restart.jl b/examples/structured_2d_dgsem/elixir_advection_restart.jl index 5397aee2a87..325df6bc7c6 100644 --- a/examples/structured_2d_dgsem/elixir_advection_restart.jl +++ b/examples/structured_2d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/structured_3d_dgsem/elixir_advection_restart.jl b/examples/structured_3d_dgsem/elixir_advection_restart.jl index 13e0a20b037..42a1f0e2fb1 100644 --- a/examples/structured_3d_dgsem/elixir_advection_restart.jl +++ b/examples/structured_3d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/t8code_2d_dgsem/elixir_advection_restart.jl b/examples/t8code_2d_dgsem/elixir_advection_restart.jl index 6be8e79f99c..0dbbb6c3d14 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_restart.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl b/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl index befe4d21e27..caa25d41595 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/t8code_3d_dgsem/elixir_advection_restart.jl b/examples/t8code_3d_dgsem/elixir_advection_restart.jl index d8d8b63e3ed..230f7483aeb 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_restart.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/tree_2d_dgsem/elixir_advection_restart.jl b/examples/tree_2d_dgsem/elixir_advection_restart.jl index 6d2f734bf79..25de4fbd968 100644 --- a/examples/tree_2d_dgsem/elixir_advection_restart.jl +++ b/examples/tree_2d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # Define time integration algorithm diff --git a/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl b/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl index c16b311b4c7..d42e994bb48 100644 --- a/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # Define time integration algorithm diff --git a/examples/tree_3d_dgsem/elixir_advection_restart.jl b/examples/tree_3d_dgsem/elixir_advection_restart.jl index b672f122897..a2b4355960e 100644 --- a/examples/tree_3d_dgsem/elixir_advection_restart.jl +++ b/examples/tree_3d_dgsem/elixir_advection_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file diff --git a/examples/unstructured_2d_dgsem/elixir_euler_restart.jl b/examples/unstructured_2d_dgsem/elixir_euler_restart.jl index 07678584138..3d2c2de5ce8 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_restart.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_restart.jl @@ -1,5 +1,6 @@ using OrdinaryDiffEqLowStorageRK using Trixi +using Accessors: @reset ############################################################################### # create a restart file From a85ba039c41f31c1b9cca6136d898e710bf75c0d Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 17:46:21 +0100 Subject: [PATCH 12/22] change --- src/meshes/dgmulti_meshes.jl | 6 +++--- test/Project.toml | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/meshes/dgmulti_meshes.jl b/src/meshes/dgmulti_meshes.jl index 13cf4fef0e6..ad747a00f7c 100644 --- a/src/meshes/dgmulti_meshes.jl +++ b/src/meshes/dgmulti_meshes.jl @@ -12,10 +12,10 @@ dispatchable type. This is intended to store geometric data and connectivities for any type of mesh (Cartesian, affine, curved, structured/unstructured). """ -struct DGMultiMesh{NDIMS, MeshType, MeshDataT <: MeshData{NDIMS}, BoundaryFaceT} - md::MeshDataT +mutable struct DGMultiMesh{NDIMS, MeshType, MeshDataT <: MeshData{NDIMS}, BoundaryFaceT} + const md::MeshDataT - boundary_faces::BoundaryFaceT + const boundary_faces::BoundaryFaceT current_filename :: String unsaved_changes :: Bool diff --git a/test/Project.toml b/test/Project.toml index 3adc1c2eeee..b9d581bf3da 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" @@ -37,6 +38,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TrixiTest = "0a316866-cbd0-4425-8bcb-08103b2c1f26" [compat] +Accessors = "0.1.36" ADTypes = "1.11" Adapt = "4" Aqua = "0.8" From 0f3511fe546c9daa43cda983b516a1a331274e39 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 18:13:31 +0100 Subject: [PATCH 13/22] dtmax --- src/time_integration/methods_SSP.jl | 2 +- .../paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/time_integration/methods_SSP.jl b/src/time_integration/methods_SSP.jl index 82a62b36d46..09acaf5db07 100644 --- a/src/time_integration/methods_SSP.jl +++ b/src/time_integration/methods_SSP.jl @@ -55,7 +55,7 @@ end mutable struct SimpleIntegratorSSPOptions{Callback, TStops} callback::Callback # callbacks; used in Trixi const adaptive::Bool # whether the algorithm is adaptive; ignored - const dtmax::Float64 # ignored + dtmax::Float64 # ignored const maxiters::Int # maximal number of time steps tstops::TStops # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end diff --git a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl index 2dfc1ac4e9f..40a6c4d6be5 100644 --- a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl +++ b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl @@ -18,7 +18,7 @@ abstract type AbstractPairedExplicitRKSingle <: AbstractPairedExplicitRK end mutable struct PairedExplicitRKOptions{Callback, TStops} callback::Callback # callbacks; used in Trixi const adaptive::Bool # whether the algorithm is adaptive (false) - const dtmax::Float64 # ignored + dtmax::Float64 # ignored const maxiters::Int # maximal number of time steps tstops::TStops # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end From 385e151f41ac47cda7854d5f5e43f9b28e2e6f34 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 6 Nov 2025 18:40:42 +0100 Subject: [PATCH 14/22] rev --- src/meshes/p4est_mesh_view.jl | 4 ++-- src/meshes/structured_mesh_view.jl | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/meshes/p4est_mesh_view.jl b/src/meshes/p4est_mesh_view.jl index c085abcbde8..38493618a69 100644 --- a/src/meshes/p4est_mesh_view.jl +++ b/src/meshes/p4est_mesh_view.jl @@ -10,8 +10,8 @@ A view on a [`P4estMesh`](@ref). """ -struct P4estMeshView{NDIMS, NDIMS_AMBIENT, RealT <: Real, Parent} <: - AbstractMesh{NDIMS} +mutable struct P4estMeshView{NDIMS, NDIMS_AMBIENT, RealT <: Real, Parent} <: + AbstractMesh{NDIMS} parent::Parent cell_ids::Vector{Int} unsaved_changes::Bool diff --git a/src/meshes/structured_mesh_view.jl b/src/meshes/structured_mesh_view.jl index 1beff71dbcf..bea6ad7755e 100644 --- a/src/meshes/structured_mesh_view.jl +++ b/src/meshes/structured_mesh_view.jl @@ -10,14 +10,14 @@ A view on a structured curved mesh. """ -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 +mutable struct StructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} + 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 From 433af07e6791046a85290b022f11eb8ea5b95888 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 10 Nov 2025 10:07:19 +0100 Subject: [PATCH 15/22] more const --- src/callbacks_step/analysis.jl | 6 +++--- src/callbacks_step/time_series.jl | 2 +- src/meshes/p4est_mesh.jl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 7691bc8f3fa..db07ad1cba3 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -54,10 +54,10 @@ mutable struct AnalysisCallback{Analyzer, AnalysisIntegrals, InitialStateIntegra const output_directory::String const analysis_filename::String const analyzer::Analyzer - analysis_errors::Vector{Symbol} - analysis_integrals::AnalysisIntegrals + const analysis_errors::Vector{Symbol} + const analysis_integrals::AnalysisIntegrals initial_state_integrals::InitialStateIntegrals - cache::Cache + const cache::Cache end # TODO: Taal bikeshedding, implement a method with less information and the signature diff --git a/src/callbacks_step/time_series.jl b/src/callbacks_step/time_series.jl index bb7c74e4742..aca656490f8 100644 --- a/src/callbacks_step/time_series.jl +++ b/src/callbacks_step/time_series.jl @@ -42,7 +42,7 @@ mutable struct TimeSeriesCallback{RealT <: Real, uEltype <: Real, SolutionVariab point_data::Vector{Vector{uEltype}} time::Vector{RealT} step::Vector{Int} - time_series_cache::Cache + const time_series_cache::Cache end function Base.show(io::IO, cb::DiscreteCallback{<:Any, <:TimeSeriesCallback}) diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index 3a34b9d2af1..0ca70429218 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -24,12 +24,12 @@ 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} + const 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] + const tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] const nodes::SVector{NNODES, RealT} boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String From 0cfb7b9fc2df5903e7a68776b3d33c04afbbcf05 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 10 Nov 2025 10:11:11 +0100 Subject: [PATCH 16/22] order --- src/meshes/t8code_mesh.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index 4f21c9ee2d3..3e66891eef7 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -37,10 +37,10 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: mesh = new{NDIMS, RealT, typeof(is_parallel), NDIMS + 2, length(nodes)}(T8code.ForestWrapper(forest), is_parallel) + mesh.tree_node_coordinates = tree_node_coordinates mesh.nodes = nodes mesh.boundary_names = boundary_names mesh.current_filename = current_filename - mesh.tree_node_coordinates = tree_node_coordinates mesh.unsaved_changes = true finalizer(mesh) do mesh From 9300dbb7591f532aa4c72d498ec464496e3ca013 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 10 Nov 2025 10:49:02 +0100 Subject: [PATCH 17/22] more --- src/semidiscretization/semidiscretization_coupled.jl | 8 ++++---- src/time_integration/methods_2N.jl | 4 ++-- src/time_integration/methods_3Sstar.jl | 4 ++-- src/time_integration/methods_SSP.jl | 4 ++-- .../paired_explicit_runge_kutta/methods_PERK2.jl | 4 ++-- .../paired_explicit_runge_kutta/methods_PERK3.jl | 4 ++-- .../paired_explicit_runge_kutta/methods_PERK4.jl | 4 ++-- .../relaxation_methods/methods_subdiagonal.jl | 6 +++--- .../relaxation_methods/methods_vanderHouwen.jl | 6 +++--- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/semidiscretization/semidiscretization_coupled.jl b/src/semidiscretization/semidiscretization_coupled.jl index 80ac6f236e0..05f14749df2 100644 --- a/src/semidiscretization/semidiscretization_coupled.jl +++ b/src/semidiscretization/semidiscretization_coupled.jl @@ -443,10 +443,10 @@ mutable struct BoundaryConditionCoupled{NDIMS, uEltype <: Real, Indices, CouplingConverter} # NDIMST2M1 == NDIMS * 2 - 1 # Buffer for boundary values: [variable, nodes_i, nodes_j, cell_i, cell_j] - u_boundary :: Array{uEltype, NDIMST2M1} # NDIMS * 2 - 1 - other_orientation :: Int - indices :: Indices - coupling_converter :: CouplingConverter + u_boundary :: Array{uEltype, NDIMST2M1} # NDIMS * 2 - 1 + const other_orientation :: Int + const indices :: Indices + const coupling_converter :: CouplingConverter function BoundaryConditionCoupled(other_semi_index, indices, uEltype, coupling_converter) diff --git a/src/time_integration/methods_2N.jl b/src/time_integration/methods_2N.jl index ddb7c79bfa5..5e791f6bcc1 100644 --- a/src/time_integration/methods_2N.jl +++ b/src/time_integration/methods_2N.jl @@ -104,8 +104,8 @@ mutable struct SimpleIntegrator2N{RealT <: Real, uType <: AbstractVector, iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::Alg # SimpleAlgorithm2N + const f::F # `rhs!` of the semidiscretization + const alg::Alg # SimpleAlgorithm2N opts::SimpleIntegratorOptions finalstep::Bool # added for convenience end diff --git a/src/time_integration/methods_3Sstar.jl b/src/time_integration/methods_3Sstar.jl index 31d5e622f1e..f54a599c92b 100644 --- a/src/time_integration/methods_3Sstar.jl +++ b/src/time_integration/methods_3Sstar.jl @@ -143,8 +143,8 @@ mutable struct SimpleIntegrator3Sstar{RealT <: Real, uType <: AbstractVector, iter::Int # current number of time step (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::Alg # SimpleAlgorithm3Sstar + const f::F # `rhs!` of the semidiscretization + const alg::Alg # SimpleAlgorithm3Sstar opts::SimpleIntegratorOptions finalstep::Bool # added for convenience end diff --git a/src/time_integration/methods_SSP.jl b/src/time_integration/methods_SSP.jl index 09acaf5db07..7bd3a486103 100644 --- a/src/time_integration/methods_SSP.jl +++ b/src/time_integration/methods_SSP.jl @@ -90,8 +90,8 @@ mutable struct SimpleIntegratorSSP{RealT <: Real, uType, iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::Alg # SimpleSSPRK33 + const f::F # `rhs!` of the semidiscretization + const alg::Alg # SimpleSSPRK33 opts::SimpleIntegratorSSPOptions finalstep::Bool # added for convenience dtchangeable::Bool diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl index ad443a7ad47..84592bbbe7a 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl @@ -204,8 +204,8 @@ mutable struct PairedExplicitRK2Integrator{RealT <: Real, uType <: AbstractVecto iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::PairedExplicitRK2 + const f::F # `rhs!` of the semidiscretization + const alg::PairedExplicitRK2 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience dtchangeable::Bool diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl index 81169287996..dc16b92a7c3 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl @@ -197,8 +197,8 @@ mutable struct PairedExplicitRK3Integrator{RealT <: Real, uType <: AbstractVecto iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::PairedExplicitRK3 + const f::F # `rhs!` of the semidiscretization + const alg::PairedExplicitRK3 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience dtchangeable::Bool diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl index d7951651640..7e3993b1617 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl @@ -198,8 +198,8 @@ mutable struct PairedExplicitRK4Integrator{RealT <: Real, uType <: AbstractVecto iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::PairedExplicitRK4 + const f::F # `rhs!` of the semidiscretization + const alg::PairedExplicitRK4 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience dtchangeable::Bool diff --git a/src/time_integration/relaxation_methods/methods_subdiagonal.jl b/src/time_integration/relaxation_methods/methods_subdiagonal.jl index 009a8cc5d61..7488c899ecc 100644 --- a/src/time_integration/relaxation_methods/methods_subdiagonal.jl +++ b/src/time_integration/relaxation_methods/methods_subdiagonal.jl @@ -143,15 +143,15 @@ mutable struct SubDiagonalRelaxationIntegrator{RealT <: Real, uType <: AbstractV iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs` of the semidiscretization - alg::Alg # `SubDiagonalRelaxationAlgorithm` + const f::F # `rhs` of the semidiscretization + const alg::Alg # `SubDiagonalRelaxationAlgorithm` opts::SimpleIntegratorOptions finalstep::Bool # added for convenience # Addition for Relaxation methodology direction::uType # RK update, i.e., sum of stages K_i times weights b_i gamma::RealT # Relaxation parameter S_old::RealT # Entropy of previous iterate - relaxation_solver::AbstractRelaxationSolver + const relaxation_solver::AbstractRelaxationSolver # Note: Could add another register which would store the summed-up # dot products ∑ₖ (wₖ ⋅ kₖ) and then integrate only once and not per stage k # Could also add option `recompute_entropy` for entropy-conservative problems diff --git a/src/time_integration/relaxation_methods/methods_vanderHouwen.jl b/src/time_integration/relaxation_methods/methods_vanderHouwen.jl index 852ad27a5a2..099c162612c 100644 --- a/src/time_integration/relaxation_methods/methods_vanderHouwen.jl +++ b/src/time_integration/relaxation_methods/methods_vanderHouwen.jl @@ -177,8 +177,8 @@ mutable struct vanderHouwenRelaxationIntegrator{RealT <: Real, uType <: Abstract iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs` of the semidiscretization - alg::Alg # `vanderHouwenRelaxationAlgorithm` + const f::F # `rhs` of the semidiscretization + const alg::Alg # `vanderHouwenRelaxationAlgorithm` opts::SimpleIntegratorOptions finalstep::Bool # added for convenience # Addition for efficient implementation @@ -187,7 +187,7 @@ mutable struct vanderHouwenRelaxationIntegrator{RealT <: Real, uType <: Abstract direction::uType # RK update, i.e., sum of stages K_i times weights b_i gamma::RealT # Relaxation parameter S_old::RealT # Entropy of previous iterate - relaxation_solver::AbstractRelaxationSolver + const relaxation_solver::AbstractRelaxationSolver # Note: Could add another register which would store the summed-up # dot products ∑ₖ (wₖ ⋅ kₖ) and then integrate only once and not per stage k # Could also add option `recompute_entropy` for entropy-conservative problems From 0a4e92fe825409ca74b26a08385b9586e36d8c49 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 10 Nov 2025 12:20:44 +0100 Subject: [PATCH 18/22] more --- src/time_integration/methods_SSP.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/time_integration/methods_SSP.jl b/src/time_integration/methods_SSP.jl index 7bd3a486103..fe6c8fa767f 100644 --- a/src/time_integration/methods_SSP.jl +++ b/src/time_integration/methods_SSP.jl @@ -94,8 +94,8 @@ mutable struct SimpleIntegratorSSP{RealT <: Real, uType, const alg::Alg # SimpleSSPRK33 opts::SimpleIntegratorSSPOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool end """ From 8e03b5ac03488a68569921a4903d960a62b7f6d0 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 10 Nov 2025 15:40:41 +0100 Subject: [PATCH 19/22] const --- .../paired_explicit_runge_kutta/methods_PERK2.jl | 4 ++-- .../paired_explicit_runge_kutta/methods_PERK3.jl | 4 ++-- .../paired_explicit_runge_kutta/methods_PERK4.jl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl index 84592bbbe7a..cc41cf37f65 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl @@ -208,8 +208,8 @@ mutable struct PairedExplicitRK2Integrator{RealT <: Real, uType <: AbstractVecto const alg::PairedExplicitRK2 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool # Additional PERK register k1::uType end diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl index dc16b92a7c3..5abaed11056 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl @@ -201,8 +201,8 @@ mutable struct PairedExplicitRK3Integrator{RealT <: Real, uType <: AbstractVecto const alg::PairedExplicitRK3 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool # Additional PERK3 registers k1::uType kS1::uType diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl index 7e3993b1617..4bbebd47c78 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl @@ -202,8 +202,8 @@ mutable struct PairedExplicitRK4Integrator{RealT <: Real, uType <: AbstractVecto const alg::PairedExplicitRK4 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool # Additional PERK register k1::uType end From 5c5c6ac3ece89f11c8241814c0defbbfc21c2c0c Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 10 Nov 2025 22:02:56 +0000 Subject: [PATCH 20/22] mention change --- NEWS.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS.md b/NEWS.md index 0290b08acd5..5bfabac0ecf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,14 @@ used in the Julia ecosystem. Notable changes will be documented in this file for human readability. +## Changes when updating to v0.14 from v0.13.x + +#### Changed + +- A couple `struct`s have been made completely immutable, or only a couple fields thereof. +Most notably, `save_solution.condition.save_initial_solution` where `save_solution isa SavesolutionCallback` can now longer be directly changed. +Instead, the `@reset` macro from [Accessors.jl](https://github.com/JuliaObjects/Accessors.jl) is used in the elixirs instead. + ## Changes when updating to v0.13 from v0.12.x #### Changed From d344ea54c46fad61ba92f96df16315ce94f075dd Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 10 Nov 2025 23:06:40 +0100 Subject: [PATCH 21/22] Update NEWS.md --- NEWS.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5bfabac0ecf..df5d16fc4f8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,9 +10,7 @@ for human readability. #### Changed -- A couple `struct`s have been made completely immutable, or only a couple fields thereof. -Most notably, `save_solution.condition.save_initial_solution` where `save_solution isa SavesolutionCallback` can now longer be directly changed. -Instead, the `@reset` macro from [Accessors.jl](https://github.com/JuliaObjects/Accessors.jl) is used in the elixirs instead. +- A couple `struct`s have been made completely immutable, or only a couple fields thereof. Most notably, `save_solution.condition.save_initial_solution` where `save_solution isa SavesolutionCallback` can now longer be directly changed. Instead, the `@reset` macro from [Accessors.jl](https://github.com/JuliaObjects/Accessors.jl) is used in the elixirs instead. ## Changes when updating to v0.13 from v0.12.x From 32bf1bc9e6d2d5e09973bc335b5ab012205d81c0 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sun, 23 Nov 2025 19:36:51 +0100 Subject: [PATCH 22/22] Update src/meshes/p4est_mesh.jl --- src/meshes/p4est_mesh.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index 8b04cdf6d69..1500f36659b 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -29,7 +29,6 @@ mutable struct P4estMesh{NDIMS, NDIMS_AMBIENT, RealT <: Real, IsParallel, P, Gho # Either `PointerWrapper{p4est_ghost_t}` or `PointerWrapper{p8est_ghost_t}`. # Required for ghost/halo layers in parallel runs, thus mutable. ghost::Ghost - # Coordinates at the nodes specified by the tensor product of `nodes` (NDIMS times). # This specifies the geometry interpolation for each tree. const tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree]