From 4bd894a284dedd00daa79707cc58df1c2bbfac3d Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Thu, 9 Feb 2023 16:25:54 +0100 Subject: [PATCH 01/15] Added clamp AMR indicator. --- src/solvers/dgsem_tree/indicators.jl | 46 +++++++++++++++++++++++++ src/solvers/dgsem_tree/indicators_1d.jl | 42 +++++++++++++++++++++- src/solvers/dgsem_tree/indicators_2d.jl | 40 +++++++++++++++++++++ src/solvers/dgsem_tree/indicators_3d.jl | 39 +++++++++++++++++++++ 4 files changed, 166 insertions(+), 1 deletion(-) diff --git a/src/solvers/dgsem_tree/indicators.jl b/src/solvers/dgsem_tree/indicators.jl index 0cf099d95f2..abb27181900 100644 --- a/src/solvers/dgsem_tree/indicators.jl +++ b/src/solvers/dgsem_tree/indicators.jl @@ -226,6 +226,52 @@ function Base.show(io::IO, ::MIME"text/plain", indicator::IndicatorMax) end end +""" + IndicatorClamp(equations::AbstractEquations, basis; a=0.0, b=1.0, variable) + IndicatorClamp(semi::AbstractSemidiscretization; a=0.0, b=1.0, variable) + +A simple indicator returning 1.0 when the element average of `variable` lies within [a,b]. +Returns -1.0 otherwise. +""" +struct IndicatorClamp{RealT<:Real, Variable, Cache<:NamedTuple} <: AbstractIndicator + a::RealT + b::RealT + variable::Variable + cache::Cache +end + +function IndicatorClamp(equations::AbstractEquations, basis; a = 0.0, b = 1.0, variable) + cache = create_cache(IndicatorClamp, equations, basis) + IndicatorClamp{typeof(a), typeof(variable), typeof(cache)}(a, b, variable, cache) +end + +function IndicatorClamp(semi::AbstractSemidiscretization; a = 0.0, b = 1.0, variable) + cache = create_cache(IndicatorClamp, semi) + return IndicatorClamp{typeof(a), typeof(variable), typeof(cache)}(a, b, variable, cache) +end + +function Base.show(io::IO, indicator::IndicatorClamp) + @nospecialize indicator # reduce precompilation time + + print(io, "IndicatorClamp(") + print(io, "a=", indicator.a, "b=", indicator.b, "variable=", indicator.variable, ")") +end + +function Base.show(io::IO, ::MIME"text/plain", indicator::IndicatorClamp) + @nospecialize indicator # reduce precompilation time + + if get(io, :compact, false) + show(io, indicator) + else + setup = [ + "indicator variable" => indicator.variable, + "a" => indicator.a, + "b" => indicator.b, + ] + summary_box(io, "IndicatorClamp", setup) + end +end + """ IndicatorNeuralNetwork diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index f501c44fcbe..ca6a56462a8 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -201,6 +201,46 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any,3}, return alpha end +function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{1}, basis::LobattoLegendreBasis) + + alpha = Vector{real(basis)}() + + A = Array{real(basis), ndims(equations)} + indicator_threaded = [A(undef, nnodes(basis), nnodes(basis)) for _ in 1:Threads.nthreads()] + + return (; alpha, indicator_threaded, basis.weights) +end + +function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{1}, dg::DGSEM, cache) + cache = create_cache(typ, equations, dg.basis) +end + +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, + mesh, equations, dg::DGSEM, cache; + kwargs...) + @unpack alpha, indicator_threaded, weights = indicator_clamp.cache + resize!(alpha, nelements(dg, cache)) + + @threaded for element in eachelement(dg, cache) + indicator = indicator_threaded[Threads.threadid()] + + # Calculate indicator variables at Gauss-Lobatto nodes. + mean = 0.0 + for i in eachnode(dg) + u_local = get_node_vars(u, equations, dg, i, element) + mean += indicator_clamp.variable(u_local, equations) * weights[i]*0.5 + end + + if indicator_clamp.a <= mean <= indicator_clamp.b + alpha[element] = 1.0 + else + alpha[element] = -1.0 + end + end + + return alpha +end + # this method is used when the indicator is constructed as for shock-capturing volume integrals # empty cache is default function create_cache(::Type{<:IndicatorNeuralNetwork}, @@ -402,4 +442,4 @@ function (indicator_ann::IndicatorNeuralNetwork{NeuralNetworkRayHesthaven})( return alpha end -end # @muladd \ No newline at end of file +end # @muladd diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index 60230948c42..0f0e5bda1bb 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -229,6 +229,46 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any,4}, return alpha end +function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{2}, basis::LobattoLegendreBasis) + + alpha = Vector{real(basis)}() + + A = Array{real(basis), ndims(equations)} + indicator_threaded = [A(undef, nnodes(basis), nnodes(basis)) for _ in 1:Threads.nthreads()] + + return (; alpha, indicator_threaded, basis.weights) +end + +function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{2}, dg::DGSEM, cache) + cache = create_cache(typ, equations, dg.basis) +end + +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, + mesh, equations, dg::DGSEM, cache; + kwargs...) + @unpack alpha, indicator_threaded, weights = indicator_clamp.cache + resize!(alpha, nelements(dg, cache)) + + @threaded for element in eachelement(dg, cache) + indicator = indicator_threaded[Threads.threadid()] + + # Calculate indicator variables at Gauss-Lobatto nodes. + mean = 0.0 + for j in eachnode(dg), i in eachnode(dg) + u_local = get_node_vars(u, equations, dg, i, j, element) + mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*0.25 + end + + if indicator_clamp.a <= mean <= indicator_clamp.b + alpha[element] = 1.0 + else + alpha[element] = -1.0 + end + end + + return alpha +end + # this method is used when the indicator is constructed as for shock-capturing volume integrals # empty cache is default function create_cache(::Type{IndicatorNeuralNetwork}, diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index 3c3cc01a20a..0c80a277e38 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -246,5 +246,44 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any,5}, return alpha end +function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{3}, basis::LobattoLegendreBasis) + + alpha = Vector{real(basis)}() + + A = Array{real(basis), ndims(equations)} + indicator_threaded = [A(undef, nnodes(basis), nnodes(basis)) for _ in 1:Threads.nthreads()] + + return (; alpha, indicator_threaded, basis.weights) +end + +function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{3}, dg::DGSEM, cache) + cache = create_cache(typ, equations, dg.basis) +end + +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, + mesh, equations, dg::DGSEM, cache; + kwargs...) + @unpack alpha, indicator_threaded, weights = indicator_clamp.cache + resize!(alpha, nelements(dg, cache)) + + @threaded for element in eachelement(dg, cache) + indicator = indicator_threaded[Threads.threadid()] + + # Calculate indicator variables at Gauss-Lobatto nodes. + mean = 0.0 + for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg) + u_local = get_node_vars(u, equations, dg, i, j, k, element) + mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*weights[k]*0.125 + end + + if indicator_clamp.a <= mean <= indicator_clamp.b + alpha[element] = 1.0 + else + alpha[element] = -1.0 + end + end + + return alpha +end end # @muladd From 8f250ec3b06ad622afa6e0b09ea74a9ee111819d Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Fri, 10 Feb 2023 14:47:43 +0100 Subject: [PATCH 02/15] Incorporate review suggestions. --- src/solvers/dgsem_tree/indicators.jl | 20 ++++++++++---------- src/solvers/dgsem_tree/indicators_1d.jl | 16 +++++----------- src/solvers/dgsem_tree/indicators_2d.jl | 15 ++++----------- src/solvers/dgsem_tree/indicators_3d.jl | 14 ++++---------- test/test_unit.jl | 3 +++ 5 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators.jl b/src/solvers/dgsem_tree/indicators.jl index abb27181900..712dfe6ea25 100644 --- a/src/solvers/dgsem_tree/indicators.jl +++ b/src/solvers/dgsem_tree/indicators.jl @@ -227,34 +227,34 @@ function Base.show(io::IO, ::MIME"text/plain", indicator::IndicatorMax) end """ - IndicatorClamp(equations::AbstractEquations, basis; a=0.0, b=1.0, variable) - IndicatorClamp(semi::AbstractSemidiscretization; a=0.0, b=1.0, variable) + IndicatorClamp(equations::AbstractEquations, basis; min=0.0, max=1.0, variable) + IndicatorClamp(semi::AbstractSemidiscretization; min=0.0, max=1.0, variable) -A simple indicator returning 1.0 when the element average of `variable` lies within [a,b]. +A simple indicator returning 1.0 when the element average of `variable` lies within [min,max]. Returns -1.0 otherwise. """ struct IndicatorClamp{RealT<:Real, Variable, Cache<:NamedTuple} <: AbstractIndicator - a::RealT - b::RealT + min::RealT + max::RealT variable::Variable cache::Cache end -function IndicatorClamp(equations::AbstractEquations, basis; a = 0.0, b = 1.0, variable) +function IndicatorClamp(equations::AbstractEquations, basis; min = 0.0, max = 1.0, variable) cache = create_cache(IndicatorClamp, equations, basis) - IndicatorClamp{typeof(a), typeof(variable), typeof(cache)}(a, b, variable, cache) + IndicatorClamp{typeof(a), typeof(variable), typeof(cache)}(min, max, variable, cache) end -function IndicatorClamp(semi::AbstractSemidiscretization; a = 0.0, b = 1.0, variable) +function IndicatorClamp(semi::AbstractSemidiscretization; min = 0.0, max = 1.0, variable) cache = create_cache(IndicatorClamp, semi) - return IndicatorClamp{typeof(a), typeof(variable), typeof(cache)}(a, b, variable, cache) + return IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(a, b, variable, cache) end function Base.show(io::IO, indicator::IndicatorClamp) @nospecialize indicator # reduce precompilation time print(io, "IndicatorClamp(") - print(io, "a=", indicator.a, "b=", indicator.b, "variable=", indicator.variable, ")") + print(io, "min=", indicator.min, ", max=", indicator.max, ", variable=", indicator.variable, ")") end function Base.show(io::IO, ::MIME"text/plain", indicator::IndicatorClamp) diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index ca6a56462a8..2f9a77e247b 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -205,9 +205,6 @@ function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{1}, b alpha = Vector{real(basis)}() - A = Array{real(basis), ndims(equations)} - indicator_threaded = [A(undef, nnodes(basis), nnodes(basis)) for _ in 1:Threads.nthreads()] - return (; alpha, indicator_threaded, basis.weights) end @@ -216,22 +213,19 @@ function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquati end function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, - mesh, equations, dg::DGSEM, cache; - kwargs...) - @unpack alpha, indicator_threaded, weights = indicator_clamp.cache + mesh, equations, dg::DGSEM, cache; + kwargs...) + @unpack alpha, weights = indicator_clamp.cache resize!(alpha, nelements(dg, cache)) @threaded for element in eachelement(dg, cache) - indicator = indicator_threaded[Threads.threadid()] - - # Calculate indicator variables at Gauss-Lobatto nodes. - mean = 0.0 + mean::Variable = 0.0 for i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, element) mean += indicator_clamp.variable(u_local, equations) * weights[i]*0.5 end - if indicator_clamp.a <= mean <= indicator_clamp.b + if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 else alpha[element] = -1.0 diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index 0f0e5bda1bb..79d3052bd01 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -230,12 +230,8 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any,4}, end function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{2}, basis::LobattoLegendreBasis) - alpha = Vector{real(basis)}() - A = Array{real(basis), ndims(equations)} - indicator_threaded = [A(undef, nnodes(basis), nnodes(basis)) for _ in 1:Threads.nthreads()] - return (; alpha, indicator_threaded, basis.weights) end @@ -244,16 +240,13 @@ function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquati end function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, - mesh, equations, dg::DGSEM, cache; - kwargs...) - @unpack alpha, indicator_threaded, weights = indicator_clamp.cache + mesh, equations, dg::DGSEM, cache; + kwargs...) + @unpack alpha, weights = indicator_clamp.cache resize!(alpha, nelements(dg, cache)) @threaded for element in eachelement(dg, cache) - indicator = indicator_threaded[Threads.threadid()] - - # Calculate indicator variables at Gauss-Lobatto nodes. - mean = 0.0 + mean::Variable = 0.0 for j in eachnode(dg), i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, j, element) mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*0.25 diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index 0c80a277e38..7bb3b38aa42 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -250,9 +250,6 @@ function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{3}, b alpha = Vector{real(basis)}() - A = Array{real(basis), ndims(equations)} - indicator_threaded = [A(undef, nnodes(basis), nnodes(basis)) for _ in 1:Threads.nthreads()] - return (; alpha, indicator_threaded, basis.weights) end @@ -261,16 +258,13 @@ function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquati end function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, - mesh, equations, dg::DGSEM, cache; - kwargs...) - @unpack alpha, indicator_threaded, weights = indicator_clamp.cache + mesh, equations, dg::DGSEM, cache; + kwargs...) + @unpack alpha, weights = indicator_clamp.cache resize!(alpha, nelements(dg, cache)) @threaded for element in eachelement(dg, cache) - indicator = indicator_threaded[Threads.threadid()] - - # Calculate indicator variables at Gauss-Lobatto nodes. - mean = 0.0 + mean::Variable = 0.0 for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, j, k, element) mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*weights[k]*0.125 diff --git a/test/test_unit.jl b/test/test_unit.jl index 43920e96c6e..946358089a3 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -408,6 +408,9 @@ isdir(outdir) && rm(outdir, recursive=true) indicator_max = IndicatorMax("variable", (; cache=nothing)) @test_nowarn show(stdout, indicator_max) + indicator_clamp = IndicatorClamp(0.0, 1.0, "variable", (; cache=nothing)) + @test_nowarn show(stdout, indicator_clamp) + equations = CompressibleEulerEquations2D(1.4) basis = LobattoLegendreBasis(3) indicator_neuralnetwork = IndicatorNeuralNetwork( From 06da6daffdcd32ffce505b78997e4590edf6d6f9 Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Fri, 10 Feb 2023 14:51:13 +0100 Subject: [PATCH 03/15] Fixed little typo. --- src/solvers/dgsem_tree/indicators_2d.jl | 2 +- src/solvers/dgsem_tree/indicators_3d.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index 79d3052bd01..a3a9e5de420 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -252,7 +252,7 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*0.25 end - if indicator_clamp.a <= mean <= indicator_clamp.b + if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 else alpha[element] = -1.0 diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index 7bb3b38aa42..dd0e334ca42 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -270,7 +270,7 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*weights[k]*0.125 end - if indicator_clamp.a <= mean <= indicator_clamp.b + if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 else alpha[element] = -1.0 From a978811c8f56ef1eb1ca8c2daf1dda0eaea82096 Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Fri, 10 Feb 2023 16:33:45 +0100 Subject: [PATCH 04/15] Fixed minor issues. --- src/Trixi.jl | 2 +- src/solvers/dgsem_tree/indicators.jl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Trixi.jl b/src/Trixi.jl index e3c4638ea5c..7a3c8f627fd 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -222,7 +222,7 @@ export SummaryCallback, SteadyStateCallback, AnalysisCallback, AliveCallback, export load_mesh, load_time export ControllerThreeLevel, ControllerThreeLevelCombined, - IndicatorLöhner, IndicatorLoehner, IndicatorMax, + IndicatorLöhner, IndicatorLoehner, IndicatorMax, IndicatorClamp IndicatorNeuralNetwork, NeuralNetworkPerssonPeraire, NeuralNetworkRayHesthaven, NeuralNetworkCNN export PositivityPreservingLimiterZhangShu diff --git a/src/solvers/dgsem_tree/indicators.jl b/src/solvers/dgsem_tree/indicators.jl index 712dfe6ea25..7fd1a1d2b31 100644 --- a/src/solvers/dgsem_tree/indicators.jl +++ b/src/solvers/dgsem_tree/indicators.jl @@ -242,12 +242,12 @@ end function IndicatorClamp(equations::AbstractEquations, basis; min = 0.0, max = 1.0, variable) cache = create_cache(IndicatorClamp, equations, basis) - IndicatorClamp{typeof(a), typeof(variable), typeof(cache)}(min, max, variable, cache) + IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(min, max, variable, cache) end function IndicatorClamp(semi::AbstractSemidiscretization; min = 0.0, max = 1.0, variable) cache = create_cache(IndicatorClamp, semi) - return IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(a, b, variable, cache) + return IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(min, max, variable, cache) end function Base.show(io::IO, indicator::IndicatorClamp) @@ -265,8 +265,8 @@ function Base.show(io::IO, ::MIME"text/plain", indicator::IndicatorClamp) else setup = [ "indicator variable" => indicator.variable, - "a" => indicator.a, - "b" => indicator.b, + "min" => indicator.min, + "max" => indicator.max, ] summary_box(io, "IndicatorClamp", setup) end From ac6826d46acb4ac0d3f85b7f2b8c0848155a92e3 Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Mon, 13 Feb 2023 10:29:55 +0100 Subject: [PATCH 05/15] Fixed some issues. --- src/solvers/dgsem_tree/indicators_1d.jl | 7 +++++-- src/solvers/dgsem_tree/indicators_2d.jl | 5 +++-- src/solvers/dgsem_tree/indicators_3d.jl | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index 2f9a77e247b..8f5e20df749 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -205,7 +205,7 @@ function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{1}, b alpha = Vector{real(basis)}() - return (; alpha, indicator_threaded, basis.weights) + return (; alpha, basis.weights) end function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{1}, dg::DGSEM, cache) @@ -220,11 +220,14 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, @threaded for element in eachelement(dg, cache) mean::Variable = 0.0 + for i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, element) - mean += indicator_clamp.variable(u_local, equations) * weights[i]*0.5 + mean += indicator_clamp.variable(u_local, equations) * weights[i] end + mean *= 0.5 + if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 else diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index a3a9e5de420..6376f702d3a 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -232,7 +232,7 @@ end function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{2}, basis::LobattoLegendreBasis) alpha = Vector{real(basis)}() - return (; alpha, indicator_threaded, basis.weights) + return (; alpha, basis.weights) end function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{2}, dg::DGSEM, cache) @@ -249,8 +249,9 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, mean::Variable = 0.0 for j in eachnode(dg), i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, j, element) - mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*0.25 + mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j] end + mean *= 0.25 if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index dd0e334ca42..f2a7032e452 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -250,7 +250,7 @@ function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{3}, b alpha = Vector{real(basis)}() - return (; alpha, indicator_threaded, basis.weights) + return (; alpha, basis.weights) end function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{3}, dg::DGSEM, cache) @@ -267,9 +267,11 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, mean::Variable = 0.0 for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, j, k, element) - mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*weights[k]*0.125 + mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*weights[k] end + mean *= 0.125 + if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 else From 6d8d2bd1242fff43714830b7dda28a8c8f2c65c7 Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Tue, 14 Feb 2023 13:44:24 +0100 Subject: [PATCH 06/15] Fixed more issues. --- src/solvers/dgsem_tree/indicators_1d.jl | 5 ++--- src/solvers/dgsem_tree/indicators_2d.jl | 3 ++- src/solvers/dgsem_tree/indicators_3d.jl | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index 8f5e20df749..4e9fdb730fb 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -212,20 +212,19 @@ function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquati cache = create_cache(typ, equations, dg.basis) end -function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,3}, mesh, equations, dg::DGSEM, cache; kwargs...) @unpack alpha, weights = indicator_clamp.cache resize!(alpha, nelements(dg, cache)) @threaded for element in eachelement(dg, cache) - mean::Variable = 0.0 + mean = zero(real(dg.basis)) for i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, element) mean += indicator_clamp.variable(u_local, equations) * weights[i] end - mean *= 0.5 if indicator_clamp.min <= mean <= indicator_clamp.max diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index 6376f702d3a..08ef4aa28cf 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -246,7 +246,8 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, resize!(alpha, nelements(dg, cache)) @threaded for element in eachelement(dg, cache) - mean::Variable = 0.0 + mean = zero(real(dg.basis)) + for j in eachnode(dg), i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, j, element) mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j] diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index f2a7032e452..52220bb37b7 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -257,19 +257,19 @@ function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquati cache = create_cache(typ, equations, dg.basis) end -function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,5}, mesh, equations, dg::DGSEM, cache; kwargs...) @unpack alpha, weights = indicator_clamp.cache resize!(alpha, nelements(dg, cache)) @threaded for element in eachelement(dg, cache) - mean::Variable = 0.0 + mean = zero(real(dg.basis)) + for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg) u_local = get_node_vars(u, equations, dg, i, j, k, element) mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*weights[k] end - mean *= 0.125 if indicator_clamp.min <= mean <= indicator_clamp.max From d96691b8bcf2195db712aaf3bbcf179dc871582e Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Wed, 22 Feb 2023 16:51:11 +0100 Subject: [PATCH 07/15] Added missing comma. --- src/Trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Trixi.jl b/src/Trixi.jl index 7a3c8f627fd..9827d7c4973 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -222,7 +222,7 @@ export SummaryCallback, SteadyStateCallback, AnalysisCallback, AliveCallback, export load_mesh, load_time export ControllerThreeLevel, ControllerThreeLevelCombined, - IndicatorLöhner, IndicatorLoehner, IndicatorMax, IndicatorClamp + IndicatorLöhner, IndicatorLoehner, IndicatorMax, IndicatorClamp, IndicatorNeuralNetwork, NeuralNetworkPerssonPeraire, NeuralNetworkRayHesthaven, NeuralNetworkCNN export PositivityPreservingLimiterZhangShu From 800713841ce659468b34d7a708c0c5ddf09e077d Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Fri, 10 May 2024 13:24:37 +0200 Subject: [PATCH 08/15] Applied formatter. --- src/solvers/dgsem_tree/indicators.jl | 55 ++++++++++++++----------- src/solvers/dgsem_tree/indicators_1d.jl | 45 ++++++++++---------- src/solvers/dgsem_tree/indicators_2d.jl | 46 +++++++++++---------- src/solvers/dgsem_tree/indicators_3d.jl | 46 +++++++++++---------- test/test_unit.jl | 2 +- 5 files changed, 102 insertions(+), 92 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators.jl b/src/solvers/dgsem_tree/indicators.jl index f554a8e321c..fbdf9ff543a 100644 --- a/src/solvers/dgsem_tree/indicators.jl +++ b/src/solvers/dgsem_tree/indicators.jl @@ -264,42 +264,47 @@ end A simple indicator returning 1.0 when the element average of `variable` lies within [min,max]. Returns -1.0 otherwise. """ -struct IndicatorClamp{RealT<:Real, Variable, Cache<:NamedTuple} <: AbstractIndicator - min::RealT - max::RealT - variable::Variable - cache::Cache +struct IndicatorClamp{RealT <: Real, Variable, Cache <: NamedTuple} <: AbstractIndicator + min::RealT + max::RealT + variable::Variable + cache::Cache end -function IndicatorClamp(equations::AbstractEquations, basis; min = 0.0, max = 1.0, variable) - cache = create_cache(IndicatorClamp, equations, basis) - IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(min, max, variable, cache) +function IndicatorClamp(equations::AbstractEquations, basis; min = 0.0, max = 1.0, + variable) + cache = create_cache(IndicatorClamp, equations, basis) + IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(min, max, variable, + cache) end -function IndicatorClamp(semi::AbstractSemidiscretization; min = 0.0, max = 1.0, variable) - cache = create_cache(IndicatorClamp, semi) - return IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(min, max, variable, cache) +function IndicatorClamp(semi::AbstractSemidiscretization; min = 0.0, max = 1.0, + variable) + cache = create_cache(IndicatorClamp, semi) + return IndicatorClamp{typeof(min), typeof(variable), typeof(cache)}(min, max, + variable, cache) end function Base.show(io::IO, indicator::IndicatorClamp) - @nospecialize indicator # reduce precompilation time + @nospecialize indicator # reduce precompilation time - print(io, "IndicatorClamp(") - print(io, "min=", indicator.min, ", max=", indicator.max, ", variable=", indicator.variable, ")") + print(io, "IndicatorClamp(") + print(io, "min=", indicator.min, ", max=", indicator.max, ", variable=", + indicator.variable, ")") end function Base.show(io::IO, ::MIME"text/plain", indicator::IndicatorClamp) - @nospecialize indicator # reduce precompilation time + @nospecialize indicator # reduce precompilation time - if get(io, :compact, false) - show(io, indicator) - else - setup = [ - "indicator variable" => indicator.variable, - "min" => indicator.min, - "max" => indicator.max, - ] - summary_box(io, "IndicatorClamp", setup) - end + if get(io, :compact, false) + show(io, indicator) + else + setup = [ + "indicator variable" => indicator.variable, + "min" => indicator.min, + "max" => indicator.max, + ] + summary_box(io, "IndicatorClamp", setup) + end end end # @muladd diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index 1567a0fb65f..d91868302a7 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -197,38 +197,39 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 3}, return alpha end -function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{1}, basis::LobattoLegendreBasis) - alpha = Vector{real(basis)}() - return (; alpha, basis.weights) +function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{1}, + basis::LobattoLegendreBasis) + alpha = Vector{real(basis)}() + return (; alpha, basis.weights) end -function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{1}, dg::DGSEM, cache) - cache = create_cache(typ, equations, dg.basis) +function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{1}, + dg::DGSEM, cache) + cache = create_cache(typ, equations, dg.basis) end -function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,3}, +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 3}, mesh, equations, dg::DGSEM, cache; kwargs...) - @unpack alpha, weights = indicator_clamp.cache - resize!(alpha, nelements(dg, cache)) + @unpack alpha, weights = indicator_clamp.cache + resize!(alpha, nelements(dg, cache)) - @threaded for element in eachelement(dg, cache) - mean = zero(real(dg.basis)) + @threaded for element in eachelement(dg, cache) + mean = zero(real(dg.basis)) - for i in eachnode(dg) - u_local = get_node_vars(u, equations, dg, i, element) - mean += indicator_clamp.variable(u_local, equations) * weights[i] - end - mean *= 0.5 + for i in eachnode(dg) + u_local = get_node_vars(u, equations, dg, i, element) + mean += indicator_clamp.variable(u_local, equations) * weights[i] + end + mean *= 0.5 - if indicator_clamp.min <= mean <= indicator_clamp.max - alpha[element] = 1.0 - else - alpha[element] = -1.0 + if indicator_clamp.min <= mean <= indicator_clamp.max + alpha[element] = 1.0 + else + alpha[element] = -1.0 + end end - end - return alpha + return alpha end - end # @muladd diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index 69e227e4096..0ab70d4823a 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -230,38 +230,40 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 4}, return alpha end -function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{2}, basis::LobattoLegendreBasis) - alpha = Vector{real(basis)}() - return (; alpha, basis.weights) +function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{2}, + basis::LobattoLegendreBasis) + alpha = Vector{real(basis)}() + return (; alpha, basis.weights) end -function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{2}, dg::DGSEM, cache) - cache = create_cache(typ, equations, dg.basis) +function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{2}, + dg::DGSEM, cache) + cache = create_cache(typ, equations, dg.basis) end -function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,4}, +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 4}, mesh, equations, dg::DGSEM, cache; kwargs...) - @unpack alpha, weights = indicator_clamp.cache - resize!(alpha, nelements(dg, cache)) + @unpack alpha, weights = indicator_clamp.cache + resize!(alpha, nelements(dg, cache)) - @threaded for element in eachelement(dg, cache) - mean = zero(real(dg.basis)) + @threaded for element in eachelement(dg, cache) + mean = zero(real(dg.basis)) - for j in eachnode(dg), i in eachnode(dg) - u_local = get_node_vars(u, equations, dg, i, j, element) - mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j] - end - mean *= 0.25 + for j in eachnode(dg), i in eachnode(dg) + u_local = get_node_vars(u, equations, dg, i, j, element) + mean += indicator_clamp.variable(u_local, equations) * weights[i] * + weights[j] + end + mean *= 0.25 - if indicator_clamp.min <= mean <= indicator_clamp.max - alpha[element] = 1.0 - else - alpha[element] = -1.0 + if indicator_clamp.min <= mean <= indicator_clamp.max + alpha[element] = 1.0 + else + alpha[element] = -1.0 + end end - end - return alpha + return alpha end - end # @muladd diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index efeab262243..e271f4774f8 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -252,38 +252,40 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 5}, return alpha end -function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{3}, basis::LobattoLegendreBasis) - alpha = Vector{real(basis)}() - return (; alpha, basis.weights) +function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{3}, + basis::LobattoLegendreBasis) + alpha = Vector{real(basis)}() + return (; alpha, basis.weights) end -function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{3}, dg::DGSEM, cache) - cache = create_cache(typ, equations, dg.basis) +function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{3}, + dg::DGSEM, cache) + cache = create_cache(typ, equations, dg.basis) end -function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any,5}, +function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 5}, mesh, equations, dg::DGSEM, cache; kwargs...) - @unpack alpha, weights = indicator_clamp.cache - resize!(alpha, nelements(dg, cache)) + @unpack alpha, weights = indicator_clamp.cache + resize!(alpha, nelements(dg, cache)) - @threaded for element in eachelement(dg, cache) - mean = zero(real(dg.basis)) + @threaded for element in eachelement(dg, cache) + mean = zero(real(dg.basis)) - for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg) - u_local = get_node_vars(u, equations, dg, i, j, k, element) - mean += indicator_clamp.variable(u_local, equations) * weights[i]*weights[j]*weights[k] - end - mean *= 0.125 + for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg) + u_local = get_node_vars(u, equations, dg, i, j, k, element) + mean += indicator_clamp.variable(u_local, equations) * weights[i] * + weights[j] * weights[k] + end + mean *= 0.125 - if indicator_clamp.min <= mean <= indicator_clamp.max - alpha[element] = 1.0 - else - alpha[element] = -1.0 + if indicator_clamp.min <= mean <= indicator_clamp.max + alpha[element] = 1.0 + else + alpha[element] = -1.0 + end end - end - return alpha + return alpha end - end # @muladd diff --git a/test/test_unit.jl b/test/test_unit.jl index d2db0b13761..0ce7e1df81e 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -427,7 +427,7 @@ end indicator_max = IndicatorMax("variable", (; cache = nothing)) @test_nowarn show(stdout, indicator_max) - indicator_clamp = IndicatorClamp(0.0, 1.0, "variable", (; cache=nothing)) + indicator_clamp = IndicatorClamp(0.0, 1.0, "variable", (; cache = nothing)) @test_nowarn show(stdout, indicator_clamp) end From 6dc79a75f74e93d876727ab93f0a0d7631569827 Mon Sep 17 00:00:00 2001 From: Johannes Markert <10619309+jmark@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:30:23 +0200 Subject: [PATCH 09/15] Update src/solvers/dgsem_tree/indicators_1d.jl Co-authored-by: Daniel Doehring --- src/solvers/dgsem_tree/indicators_1d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index 9eff9c1906c..e1500ee068a 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -221,7 +221,7 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 3}, u_local = get_node_vars(u, equations, dg, i, element) mean += indicator_clamp.variable(u_local, equations) * weights[i] end - mean *= 0.5 + mean *= 0.5 # Divide by reference element length if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 From 3bb57ae99b0ce81d6ebe3326ccdddaeb8e613fbc Mon Sep 17 00:00:00 2001 From: Johannes Markert <10619309+jmark@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:30:31 +0200 Subject: [PATCH 10/15] Update src/solvers/dgsem_tree/indicators_2d.jl Co-authored-by: Daniel Doehring --- src/solvers/dgsem_tree/indicators_2d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index ab1e3d69c57..a868cd83b8c 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -255,7 +255,7 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 4}, mean += indicator_clamp.variable(u_local, equations) * weights[i] * weights[j] end - mean *= 0.25 + mean *= 0.25 # Divide by reference element area if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 From 9f9746c537b41cc035d8dad60ee18ac511afc26d Mon Sep 17 00:00:00 2001 From: Johannes Markert <10619309+jmark@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:30:41 +0200 Subject: [PATCH 11/15] Update src/solvers/dgsem_tree/indicators_3d.jl Co-authored-by: Daniel Doehring --- src/solvers/dgsem_tree/indicators_3d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index 429e210d091..d39acf9bf30 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -281,7 +281,7 @@ function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 5}, mean += indicator_clamp.variable(u_local, equations) * weights[i] * weights[j] * weights[k] end - mean *= 0.125 + mean *= 0.125 # Divide by reference element volume if indicator_clamp.min <= mean <= indicator_clamp.max alpha[element] = 1.0 From 848511b2246d3f6f584af11adca2e5e0d33deb59 Mon Sep 17 00:00:00 2001 From: Johannes Markert <10619309+jmark@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:11:07 +0200 Subject: [PATCH 12/15] Update src/solvers/dgsem_tree/indicators_2d.jl Co-authored-by: Daniel Doehring --- src/solvers/dgsem_tree/indicators_2d.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index a868cd83b8c..4f9cfd5633f 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -236,9 +236,9 @@ function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{2}, return (; alpha, basis.weights) end -function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{2}, +function create_cache(type::Type{IndicatorClamp}, mesh, equations::AbstractEquations{2}, dg::DGSEM, cache) - cache = create_cache(typ, equations, dg.basis) + cache = create_cache(type, equations, dg.basis) end function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 4}, From 7db971f701c8777a5a777a3ca6f67ee21a1fc723 Mon Sep 17 00:00:00 2001 From: Johannes Markert <10619309+jmark@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:11:18 +0200 Subject: [PATCH 13/15] Update src/solvers/dgsem_tree/indicators_3d.jl Co-authored-by: Daniel Doehring --- src/solvers/dgsem_tree/indicators_3d.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index d39acf9bf30..49123345714 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -262,9 +262,9 @@ function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{3}, return (; alpha, basis.weights) end -function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{3}, +function create_cache(type::Type{IndicatorClamp}, mesh, equations::AbstractEquations{3}, dg::DGSEM, cache) - cache = create_cache(typ, equations, dg.basis) + cache = create_cache(type, equations, dg.basis) end function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 5}, From 9cb06f7020fcec12ddf93669842ac357785740f0 Mon Sep 17 00:00:00 2001 From: Johannes Markert <10619309+jmark@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:12:46 +0200 Subject: [PATCH 14/15] Update src/solvers/dgsem_tree/indicators_1d.jl Co-authored-by: Daniel Doehring --- src/solvers/dgsem_tree/indicators_1d.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index e1500ee068a..a3d0ed3a5d1 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -203,9 +203,9 @@ function create_cache(::Type{IndicatorClamp}, equations::AbstractEquations{1}, return (; alpha, basis.weights) end -function create_cache(typ::Type{IndicatorClamp}, mesh, equations::AbstractEquations{1}, +function create_cache(type::Type{IndicatorClamp}, mesh, equations::AbstractEquations{1}, dg::DGSEM, cache) - cache = create_cache(typ, equations, dg.basis) + cache = create_cache(type, equations, dg.basis) end function (indicator_clamp::IndicatorClamp)(u::AbstractArray{<:Any, 3}, From 5f58a099be74ad362d086c356a3fa67e86d37efd Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Thu, 10 Oct 2024 14:19:15 +0200 Subject: [PATCH 15/15] Applied formatter. --- src/solvers/dgsem_tree/indicators.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solvers/dgsem_tree/indicators.jl b/src/solvers/dgsem_tree/indicators.jl index 85732385b45..5d11e3484a4 100644 --- a/src/solvers/dgsem_tree/indicators.jl +++ b/src/solvers/dgsem_tree/indicators.jl @@ -305,7 +305,7 @@ function Base.show(io::IO, ::MIME"text/plain", indicator::IndicatorClamp) setup = [ "indicator variable" => indicator.variable, "min" => indicator.min, - "max" => indicator.max, + "max" => indicator.max ] summary_box(io, "IndicatorClamp", setup) end