Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
4a12427
CompatHelper: bump compat for RecursiveArrayTools to 4, (keep existin…
Apr 2, 2026
86f227a
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 9, 2026
4400e5b
allow SciMLBase.jl v3
JoshuaLampert Apr 9, 2026
f4f80d4
fix merge conflict
JoshuaLampert Apr 9, 2026
c3c88f5
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 22, 2026
56a1d36
allow DiffEqBase.jl v7
JoshuaLampert Apr 22, 2026
7cc7d89
allow OrdinaryDiffEqCore.jl v4
JoshuaLampert Apr 22, 2026
aa07005
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 27, 2026
0eed249
allow v2 of all OrdinaryDiffEq*.jl packages
JoshuaLampert Apr 27, 2026
39e7934
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 28, 2026
f6d8801
replace u_modified! by derivative_discontinuity!
JoshuaLampert Apr 28, 2026
9d03133
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 28, 2026
c024d02
ignore :derivative_discontinuity! for stale explicit imports
JoshuaLampert Apr 28, 2026
a3eaadc
move import
JoshuaLampert Apr 28, 2026
5cf52b9
import SciMLBase
JoshuaLampert Apr 28, 2026
a2a74df
import instead of using
JoshuaLampert Apr 28, 2026
5e91ab6
adapt to new controller interface
JoshuaLampert Apr 28, 2026
8fc1e81
restrict Static.jl to fix tests
JoshuaLampert Apr 28, 2026
eaad1ac
print controller instead of cache in SummaryCallback
JoshuaLampert Apr 28, 2026
f81faf1
stage limiter as keyword arguments
JoshuaLampert Apr 29, 2026
caf84a3
fix iterating over VectorOfArray
JoshuaLampert Apr 29, 2026
8b66f58
use Threaded() instead of True() for threads
JoshuaLampert Apr 29, 2026
ae96778
fix
JoshuaLampert Apr 29, 2026
e3b77c0
Update examples/tree_1d_dgsem/elixir_euler_density_wave_adaptive_vol_…
JoshuaLampert Apr 29, 2026
834f75f
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 29, 2026
f3d0353
make thread backwards compatible
JoshuaLampert Apr 29, 2026
fc20979
Merge branch 'compathelper/new_version/2026-04-02-00-09-29-812-040179…
JoshuaLampert Apr 29, 2026
bced723
fix stage limiter kwarg in docs
JoshuaLampert Apr 29, 2026
e1c0890
fix destats->stats in docs
JoshuaLampert Apr 29, 2026
1ff757c
fix another stage limiter in the docs
JoshuaLampert Apr 29, 2026
b3a5e10
make controller in SummaryCallback backwards compatible
JoshuaLampert Apr 29, 2026
0e08dd9
Update src/callbacks_step/summary.jl
JoshuaLampert Apr 29, 2026
8f19f85
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 29, 2026
b10d7ae
port #2773
JoshuaLampert Apr 29, 2026
5bcae97
add compat
JoshuaLampert Apr 29, 2026
6d57637
rename extension
JoshuaLampert Apr 29, 2026
4aba93f
fix obtaining controller
JoshuaLampert Apr 29, 2026
f9b4ff7
remove qold
JoshuaLampert Apr 29, 2026
d56c29d
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 29, 2026
8013d04
also save `dt_factor`
JoshuaLampert Apr 29, 2026
7790e6a
allow OrdinaryDiffEqLowStorageRK.jl v3 in docs
JoshuaLampert Apr 30, 2026
3d13e7c
set qsteady_max to 1.0
JoshuaLampert Apr 30, 2026
f99460e
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert Apr 30, 2026
e66834d
get qsteady_max from ode algorithm
JoshuaLampert Apr 30, 2026
b54a42a
use other constructor of PIDController
JoshuaLampert May 1, 2026
c1f5ba5
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
vchuravy May 4, 2026
e55a4d2
Run test_mpi single process first
vchuravy May 4, 2026
4ec3c27
adapt error for now
JoshuaLampert May 4, 2026
8f75dbf
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert May 4, 2026
87025aa
Revert "Run test_mpi single process first"
vchuravy May 4, 2026
b4b16b3
Ensure that extension is ready
vchuravy May 4, 2026
31d6d6c
also allow OrdinaryDiffEqCore.jl v3.32 and v3.33
JoshuaLampert May 4, 2026
7194d6c
refactor loading and saving controller
JoshuaLampert May 4, 2026
8159dd3
format
JoshuaLampert May 4, 2026
211670a
add test for loading and saving controllers in downgrade tests for co…
JoshuaLampert May 4, 2026
bdd97fc
comments
JoshuaLampert May 4, 2026
3be6e8a
Update test/test_threaded.jl
JoshuaLampert May 4, 2026
2a6aed1
fix
JoshuaLampert May 4, 2026
3375a6e
format
JoshuaLampert May 4, 2026
07a2785
add more tests for coverage
JoshuaLampert May 5, 2026
fc1f328
fix
JoshuaLampert May 5, 2026
415debb
remove debug statements
JoshuaLampert May 5, 2026
a284e05
Apply suggestion
vchuravy May 5, 2026
2130f97
Apply suggestion
vchuravy May 5, 2026
2d40d05
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert May 5, 2026
9f72732
fix test for julia v1.12
JoshuaLampert May 5, 2026
60f3264
missing invokelatest
JoshuaLampert May 5, 2026
d624e9e
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert May 5, 2026
81030c5
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert May 15, 2026
d834b40
bump version of OrdinaryDiffEqCore.jl to v4.2 and use old constructor…
JoshuaLampert May 15, 2026
1cf5115
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
JoshuaLampert May 19, 2026
7a7d2d8
try removing explicit precompilation call in tests
JoshuaLampert May 20, 2026
49762b2
Merge branch 'main' into compathelper/new_version/2026-04-02-00-09-29…
ranocha May 21, 2026
0a26d4b
wrap_array_native for VectorOfArray should return parent
JoshuaLampert May 21, 2026
c7f1252
u is already plain array in save solution
JoshuaLampert May 21, 2026
c6d77bb
previous parent not needed anymore
JoshuaLampert May 21, 2026
471984c
revert wrap_array_native and changes and only fix compute_kinetic_ene…
JoshuaLampert May 21, 2026
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
9 changes: 6 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Convex = "f65535da-76fb-5f13-bab9-19810c17039a"
ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"

Expand All @@ -71,6 +72,7 @@ TrixiConvexECOSExt = ["Convex", "ECOS"]
TrixiMakieExt = "Makie"
TrixiNLsolveExt = "NLsolve"
TrixiPlotsExt = "Plots"
TrixiOrdinaryDiffEqCoreExt = "OrdinaryDiffEqCore"
TrixiSparseConnectivityTracerExt = "SparseConnectivityTracer"

[compat]
Expand All @@ -84,7 +86,7 @@ ConstructionBase = "1.5.8"
Convex = "0.16"
DataStructures = "0.18.15, 0.19"
DelimitedFiles = "1"
DiffEqBase = "6.184"
DiffEqBase = "6.184, 7"
DiffEqCallbacks = "2.35, 3, 4"
Downloads = "1.6"
ECOS = "1.1.2"
Expand All @@ -103,16 +105,17 @@ MuladdMacro = "0.2.4"
NLsolve = "4.5.1"
Octavian = "0.3.28"
OffsetArrays = "1.13"
OrdinaryDiffEqCore = "1.26, 2, 3, 4.2"
P4est = "0.4.12"
Plots = "1.38.13"
Polyester = "=0.7.16, 0.7.18"
PrecompileTools = "1.2.1"
Preferences = "1.5"
Printf = "1"
RecipesBase = "1.3.4"
RecursiveArrayTools = "3.37"
RecursiveArrayTools = "3.37, 4"
Reexport = "1.2.2"
SciMLBase = "2.128"
SciMLBase = "2.128, 3"
SimpleUnPack = "1.1"
SparseArrays = "1"
SparseConnectivityTracer = "1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"

[compat]
BenchmarkTools = "0.5, 0.7, 1.0"
OrdinaryDiffEq = "5.65, 6"
OrdinaryDiffEq = "5.65, 6, 7"
PkgBenchmark = "0.2.10"
Trixi = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16"
10 changes: 5 additions & 5 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ LaTeXStrings = "1.2"
Literate = "2.9"
Measurements = "2.5"
NLsolve = "4.5.1"
OrdinaryDiffEqLowOrderRK = "1.2"
OrdinaryDiffEqLowStorageRK = "1.2"
OrdinaryDiffEqSDIRK = "1.1"
OrdinaryDiffEqSSPRK = "1.2"
OrdinaryDiffEqTsit5 = "1.1"
OrdinaryDiffEqLowOrderRK = "1.2, 2"
OrdinaryDiffEqLowStorageRK = "1.2, 2, 3"
OrdinaryDiffEqSDIRK = "1.1, 2"
OrdinaryDiffEqSSPRK = "1.2, 2"
OrdinaryDiffEqTsit5 = "1.1, 2"
Comment thread
vchuravy marked this conversation as resolved.
Plots = "1.9"
SparseConnectivityTracer = "1.0.1"
SparseMatrixColorings = "0.4.21"
Expand Down
2 changes: 1 addition & 1 deletion examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-
###############################################################################
# run the simulation
# use adaptive time stepping based on error estimates, time step roughly dt = 5e-3
sol = solve(ode, SSPRK43(stage_limiter!);
sol = solve(ode, SSPRK43(; stage_limiter!);
ode_default_options()..., callback = callbacks);
113 changes: 113 additions & 0 deletions ext/TrixiOrdinaryDiffEqCoreExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
module TrixiOrdinaryDiffEqCoreExt

import Trixi: load_controller!, store_controller!
import OrdinaryDiffEqCore: OrdinaryDiffEqCore, PIController, PIDController
import HDF5: attributes

@static if Base.pkgversion(OrdinaryDiffEqCore) >= v"4"
import OrdinaryDiffEqCore: PIControllerCache, PIDControllerCache
end

# Support to load controller.
# OrdinaryDiffEqCore < v4: The state of PIController and PIDController lives on the
# integrator (integrator.qold) rather than on the controller struct.
# OrdinaryDiffEqCore >= v4: the legacy controllers are replaced by PIControllerCache and
# PIDControllerCache, and integrator.qold no longer exists.

# OrdinaryDiffEqCore < v4, PI controller:
# Previous error estimate stored as integrator.qold.
function load_controller!(integrator, ::PIController, file)
if !("time_integrator_qold" in keys(attributes(file)))
error("Missing data in restart file: check the consistency of adaptive time controller with initial setup!")
end
integrator.qold = read(attributes(file)["time_integrator_qold"])
end

# OrdinaryDiffEqCore < v4, PID controller:
# Accumulated dt factor stored as integrator.qold.
# Error history field layout changed between v3.31 and v3.32:
# <= v3.31: err::MVector{3} (single array field)
# v3.32–v3.33: err1, err2, err3 (individual scalar fields)
function load_controller!(integrator, controller::PIDController, file)
if !("time_integrator_qold" in keys(attributes(file)) ||
!("time_integrator_controller_err" in keys(attributes(file))))
error("Missing data in restart file: check the consistency of adaptive time controller with initial setup!")
end
integrator.qold = read(attributes(file)["time_integrator_qold"])
if hasproperty(controller, :err)
# OrdinaryDiffEqCore <= v3.31
controller.err[:] = read(attributes(file)["time_integrator_controller_err"])
elseif hasproperty(controller, :err1) && hasproperty(controller, :err2) &&
hasproperty(controller, :err3)
# OrdinaryDiffEqCore v3.32–v3.33
err = read(attributes(file)["time_integrator_controller_err"])
controller.err1 = err[1]
controller.err2 = err[2]
controller.err3 = err[3]
end
end

@static if Base.pkgversion(OrdinaryDiffEqCore) >= v"4"
# OrdinaryDiffEqCore >= v4, PI controller:
# Previous error estimate stored as PIControllerCache.errold (integrator.qold removed).
function load_controller!(integrator, controller::PIControllerCache, file)
if !("time_integrator_qold" in keys(attributes(file)))
error("Missing data in restart file: check the consistency of adaptive time controller with initial setup!")
end
controller.errold = read(attributes(file)["time_integrator_qold"])
end

# OrdinaryDiffEqCore >= v4, PID controller:
# Accumulated dt factor stored as PIDControllerCache.dt_factor (integrator.qold removed).
# Error history stored as PIDControllerCache.err::Vector{3}.
function load_controller!(integrator, controller::PIDControllerCache, file)
if !("time_integrator_qold" in keys(attributes(file)) ||
!("time_integrator_controller_err" in keys(attributes(file))))
error("Missing data in restart file: check the consistency of adaptive time controller with initial setup!")
end
controller.dt_factor = read(attributes(file)["time_integrator_qold"])
controller.err[:] = read(attributes(file)["time_integrator_controller_err"])
end
end

# OrdinaryDiffEqCore < v4, PI controller:
# Previous error estimate stored as integrator.qold.
function store_controller!(file, ::PIController, integrator)
attributes(file)["time_integrator_qold"] = integrator.qold
end

# OrdinaryDiffEqCore < v4, PID controller:
# Accumulated dt factor stored as integrator.qold.
# Error history field layout changed between v3.31 and v3.32:
# <= v3.31: err::MVector{3} (single array field)
# v3.32–v3.33: err1, err2, err3 (individual scalar fields)
function store_controller!(file, controller::PIDController, integrator)
attributes(file)["time_integrator_qold"] = integrator.qold
if hasproperty(controller, :err)
# OrdinaryDiffEqCore <= v3.31
attributes(file)["time_integrator_controller_err"] = controller.err
else
# OrdinaryDiffEqCore v3.32–v3.33
attributes(file)["time_integrator_controller_err"] = [controller.err1,
controller.err2,
controller.err3]
end
end

@static if Base.pkgversion(OrdinaryDiffEqCore) >= v"4"
# OrdinaryDiffEqCore >= v4, PI controller:
# Previous error estimate stored as PIControllerCache.errold (integrator.qold removed).
function store_controller!(file, controller::PIControllerCache, integrator)
attributes(file)["time_integrator_qold"] = controller.errold
end

# OrdinaryDiffEqCore >= v4, PID controller:
# Accumulated dt factor stored as PIDControllerCache.dt_factor (integrator.qold removed).
# Error history stored as PIDControllerCache.err::Vector{3}.
function store_controller!(file, controller::PIDControllerCache, integrator)
attributes(file)["time_integrator_qold"] = controller.dt_factor
attributes(file)["time_integrator_controller_err"] = controller.err
end
end

end
14 changes: 14 additions & 0 deletions src/callbacks_step/callbacks_step.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ end
integrator.iter == integrator.opts.maxiters
end

# OrdinaryDiffEqCore < v4: legacy controller lives in integrator.opts.controller and
# doubles as its own cache (setup_controller_cache returns the controller itself).
# OrdinaryDiffEqCore >= v4: controller cache lives in integrator.controller_cache.
get_controller_cache(integrator) = hasproperty(integrator, :controller_cache) ?
integrator.controller_cache :
integrator.opts.controller

# OrdinaryDiffEq v7+ wraps the pure controller (parameters only) in controller_cache.controller;
# older versions store it directly in controller_cache or opts.controller.
function get_controller(integrator)
cc = get_controller_cache(integrator)
return hasproperty(cc, :controller) ? cc.controller : cc
end

# `include` callback definitions in the order that we currently prefer
# when combining them into a `CallbackSet` which is called *after* a complete step
# The motivation is as follows: The first callbacks belong to the current time step iteration:
Expand Down
33 changes: 20 additions & 13 deletions src/callbacks_step/save_restart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ function (restart_callback::SaveRestartCallback)(integrator)
save_restart_file(u_ode, t, dt, iter, semi, restart_callback)
# If using an adaptive time stepping scheme, store controller values for restart
if integrator.opts.adaptive
save_adaptive_time_integrator(integrator, integrator.opts.controller,
restart_callback)
save_adaptive_time_integrator(integrator, restart_callback)
end
end

Expand Down Expand Up @@ -170,29 +169,37 @@ Load the context information for time integrators with error-based step size con
saved in a `restart_file`.
"""
function load_adaptive_time_integrator!(integrator, restart_file::AbstractString)
controller = integrator.opts.controller
# Read context information for controller
h5open(restart_file, "r") do file
# Ensure that the necessary information was saved
if !("time_integrator_qold" in keys(attributes(file))) ||
!("time_integrator_dtpropose" in keys(attributes(file))) ||
(hasproperty(controller, :err) &&
!("time_integrator_controller_err" in keys(attributes(file))))
if !("time_integrator_dtpropose" in keys(attributes(file)))
error("Missing data in restart file: check the consistency of adaptive time controller with initial setup!")
end
# Load data that is required both for PIController and PIDController
integrator.qold = read(attributes(file)["time_integrator_qold"])
integrator.dtpropose = read(attributes(file)["time_integrator_dtpropose"])
# Accept step to use dtpropose already in the first step
integrator.accept_step = true
# Reevaluate integrator.fsal_first on the first step
integrator.reeval_fsal = true
# Load additional parameters for PIDController
if hasproperty(controller, :err) # Distinguish PIDController from PIController
controller.err[:] = read(attributes(file)["time_integrator_controller_err"])
end

load_controller!(integrator, file)
end
end

function load_controller!(integrator, file)
return load_controller!(integrator, get_controller_cache(integrator), file)
end

function load_controller!(integrator, controller, file)
return error("Loading of controller $(typeof(controller)) not implemented.")
end

function store_controller!(file, integrator)
return store_controller!(file, get_controller_cache(integrator), integrator)
end

function store_controller!(file, controller, integrator)
return error("Storing of controller $(typeof(controller)) not implemented.")
end

include("save_restart_dg.jl")
end # @muladd
10 changes: 2 additions & 8 deletions src/callbacks_step/save_restart_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ function load_restart_file_on_root(mesh::Union{TreeMeshParallel, P4estMeshParall
end

# Store controller values for an adaptive time stepping scheme
function save_adaptive_time_integrator(integrator,
controller, restart_callback)
function save_adaptive_time_integrator(integrator, restart_callback)
# Save only on root
if mpi_isroot()
@unpack output_directory = restart_callback
Expand All @@ -348,13 +347,8 @@ function save_adaptive_time_integrator(integrator,

# Open file (preserve existing content)
h5open(filename, "r+") do file
# Add context information as attributes both for PIController and PIDController
attributes(file)["time_integrator_qold"] = integrator.qold
attributes(file)["time_integrator_dtpropose"] = integrator.dtpropose
# For PIDController is necessary to save additional parameters
if hasproperty(controller, :err) # Distinguish PIDController from PIController
attributes(file)["time_integrator_controller_err"] = controller.err
end
store_controller!(file, integrator)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_step/save_solution_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function save_solution_file(u, time, dt, timestep,
data = u
n_vars = nvariables(equations)
else
data = map(u_node -> solution_variables(u_node, equations), u)
data = map(u_node -> solution_variables(u_node, equations), parent(u))
# Find out variable count by looking at output from `solution_variables` function.
n_vars = length(data[1])
end
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_step/summary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function initialize_summary_callback(cb::DiscreteCallback, u, t, integrator;
push!(setup,
"abstol" => integrator.opts.abstol,
"reltol" => integrator.opts.reltol,
"controller" => integrator.opts.controller)
"controller" => get_controller(integrator))
end
summary_box(io, "Time integration", setup)
println()
Expand Down
18 changes: 9 additions & 9 deletions src/postprocessing/spectral_analysis_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
compute_kinetic_energy_spectrum(v1, v2)

Compute an isotropic 1D kinetic energy spectrum from two 2D Cartesian velocity
components `v1` and `v2`. For compressible Euler kinetic energy spectra,
components `v1` and `v2`. For compressible Euler kinetic energy spectra,
pass density-weighted components `sqrt(rho) * v1` and `sqrt(rho) * v2`.
The modal energy is normalized by `1 / N^2'.
"""
Expand Down Expand Up @@ -98,28 +98,28 @@ function interpolate_lgl_to_uniform_cartesian(u, mesh::TreeMesh{2},
# ↑ | |
# | | |
# | | |
# | | |
# | | |
# j (1,1)--------(2,1)
# ---------> i (ξ)
#
# Each of the 4 tree cells pastes a 2×2 block into the 4×4 array global grid, 'u_uniform'.
# Labels (column, row) are indices into that array: column ↔ x, row ↔ y on the domain.
# The assignment `u_uniform[:, r1, r2] .= interpolated` fills one such rectangle.
# The bottom-right element of the original 2×2 block is labeled as 'E' in the diagram below and fills
# The bottom-right element of the original 2×2 block is labeled as 'E' in the diagram below and fills
# rows 3 to 4 and columns 3 to 4 of the global grid.
#
# column 1 2 3 4
# +---------+---------+---------+---------+
# row 1 | (1,1) | (2,1) | (3,1) | (4,1) |
# +---------+---------+---------+---------+
# row 2 | (1,2) | (2,2) | (3,2) | (4,2) |
# row 1 | (1,1) | (2,1) | (3,1) | (4,1) |
# +---------+---------+---------+---------+
# row 2 | (1,2) | (2,2) | (3,2) | (4,2) |
# +---------+---------+---------+---------+ ↑
# row 3 | (1,3) | (2,3) | (3,3) E | (4,3) E | |
# row 3 | (1,3) | (2,3) | (3,3) E | (4,3) E | |
# +---------+---------+---------+---------+ | r2 = 3:4
# row 4 | (1,4) | (2,4) | (3,4) E | (4,4) E | |
# +---------+---------+---------+---------+ ↓
# |<-----r1 = 3:4---->|
#
#

for element in eachelement(solver, cache)
# Gather conservative nodal values on the reference LGL tensor grid for the element
Expand Down Expand Up @@ -168,7 +168,7 @@ function compute_kinetic_energy_spectrum(u, mesh::DGMultiMesh{2},
equations::AbstractCompressibleEulerEquations,
dg::DGMultiSBP, cache)
# Unpacks the primitive variables from the conservative state for FDSBP DGMulti solutions
u_values = StructArray(u)
u_values = parent(u)
n_points = length(u_values)
n = round(Int, sqrt(n_points))
q = cons2prim.(u_values, Ref(equations)) # q is the vector that contains the primitive variables for density and velocity converted from the conservative variables
Expand Down
4 changes: 2 additions & 2 deletions src/postprocessing/spectral_analysis_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
compute_kinetic_energy_spectrum(v1, v2, v3)

Compute an isotropic 1D kinetic energy spectrum from three 3D Cartesian velocity
components `v1`, `v2`, `v3`. For compressible Euler kinetic energy spectra,
components `v1`, `v2`, `v3`. For compressible Euler kinetic energy spectra,
pass density-weighted components `sqrt(rho) * v1`, `sqrt(rho) * v2`, and `sqrt(rho) * v3`.
The modal energy is normalized by `1 / N^3`.
"""
Expand Down Expand Up @@ -145,7 +145,7 @@ function compute_kinetic_energy_spectrum(u, mesh::DGMultiMesh{3},
equations::AbstractCompressibleEulerEquations,
dg::DGMultiSBP, cache)
# Unpacks the primitive variables from the conservative state for FDSBP DGMulti solutions
u_values = StructArray(u)
u_values = parent(u)
n_points = length(u_values)
n = round(Int, n_points^(1 / 3))
q = cons2prim.(u_values, Ref(equations)) # q is the vector that contains the primitive variables for density and velocity converted from the conservative variables
Expand Down
Loading
Loading