Skip to content

Commit

Permalink
Remove subcell visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibolm committed Oct 16, 2023
1 parent de23b58 commit 96be070
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 63 deletions.
12 changes: 2 additions & 10 deletions src/callbacks_step/save_solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,28 +222,20 @@ end
end
end

node_variables = Dict{Symbol, Any}()
@trixi_timeit timer() "get node variables" get_node_variables!(node_variables,
semi)

@trixi_timeit timer() "save solution" save_solution_file(u_ode, t, dt, iter, semi,
solution_callback,
element_variables,
node_variables,
system = system)
end

@inline function save_solution_file(u_ode, t, dt, iter,
semi::AbstractSemidiscretization, solution_callback,
element_variables = Dict{Symbol, Any}(),
node_variables = Dict{Symbol, Any}();
element_variables = Dict{Symbol, Any}();
system = "")
mesh, equations, solver, cache = mesh_equations_solver_cache(semi)
u = wrap_array_native(u_ode, mesh, equations, solver, cache)
save_solution_file(u, t, dt, iter, mesh, equations, solver, cache,
solution_callback,
element_variables,
node_variables; system = system)
element_variables; system = system)
end

# TODO: Taal refactor, move save_mesh_file?
Expand Down
18 changes: 2 additions & 16 deletions src/callbacks_step/save_solution_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ function save_solution_file(u, time, dt, timestep,
UnstructuredMesh2D, SerialP4estMesh,
SerialT8codeMesh},
equations, dg::DG, cache,
solution_callback,
element_variables = Dict{Symbol, Any}(),
node_variables = Dict{Symbol, Any}();
solution_callback, element_variables = Dict{Symbol, Any}();
system = "")
@unpack output_directory, solution_variables = solution_callback

Expand Down Expand Up @@ -75,16 +73,6 @@ function save_solution_file(u, time, dt, timestep,
var = file["element_variables_$v"]
attributes(var)["name"] = string(key)
end

# Store node variables
for (v, (key, node_variable)) in enumerate(node_variables)
# Add to file
file["node_variables_$v"] = node_variable

# Add variable name as attribute
var = file["node_variables_$v"]
attributes(var)["name"] = string(key)
end
end

return filename
Expand All @@ -93,9 +81,7 @@ end
function save_solution_file(u, time, dt, timestep,
mesh::Union{ParallelTreeMesh, ParallelP4estMesh}, equations,
dg::DG, cache,
solution_callback,
element_variables = Dict{Symbol, Any}(),
node_variables = Dict{Symbol, Any}();
solution_callback, element_variables = Dict{Symbol, Any}();
system = "")
@unpack output_directory, solution_variables = solution_callback

Expand Down
4 changes: 0 additions & 4 deletions src/semidiscretization/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,6 @@ function get_element_variables!(element_variables, u_ode,
get_element_variables!(element_variables, u, mesh_equations_solver_cache(semi)...)
end

function get_node_variables!(node_variables, semi::AbstractSemidiscretization)
get_node_variables!(node_variables, mesh_equations_solver_cache(semi)...)
end

# To implement AMR and use OrdinaryDiffEq.jl etc., we have to be a bit creative.
# Since the caches of the SciML ecosystem are immutable structs, we cannot simply
# change the underlying arrays therein. Hence, to support changing the number of
Expand Down
15 changes: 0 additions & 15 deletions src/solvers/dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ function get_element_variables!(element_variables, u, mesh, equations,
nothing
end

function get_node_variables!(node_variables, mesh, equations,
volume_integral::AbstractVolumeIntegral, dg, cache)
nothing
end

"""
VolumeIntegralStrongForm()
Expand Down Expand Up @@ -225,12 +220,6 @@ function Base.show(io::IO, mime::MIME"text/plain",
end
end

function get_node_variables!(node_variables, mesh, equations,
volume_integral::VolumeIntegralSubcellLimiting, dg, cache)
get_node_variables!(node_variables, volume_integral.limiter, volume_integral,
equations)
end

# TODO: FD. Should this definition live in a different file because it is
# not strictly a DG method?
"""
Expand Down Expand Up @@ -420,10 +409,6 @@ function get_element_variables!(element_variables, u, mesh, equations, dg::DG, c
dg, cache)
end

function get_node_variables!(node_variables, mesh, equations, dg::DG, cache)
get_node_variables!(node_variables, mesh, equations, dg.volume_integral, dg, cache)
end

const MeshesDGSEM = Union{TreeMesh, StructuredMesh, UnstructuredMesh2D, P4estMesh,
T8codeMesh}

Expand Down
7 changes: 0 additions & 7 deletions src/solvers/dgsem_tree/subcell_limiters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,4 @@ function Base.show(io::IO, ::MIME"text/plain", limiter::SubcellLimiterIDP)
summary_box(io, "SubcellLimiterIDP", setup)
end
end

function get_node_variables!(node_variables, limiter::SubcellLimiterIDP,
::VolumeIntegralSubcellLimiting, equations)
node_variables[:alpha_limiter] = limiter.cache.subcell_limiter_coefficients.alpha
# TODO: alpha is not filled before the first timestep.
return nothing
end
end # @muladd
13 changes: 2 additions & 11 deletions utils/trixi2txt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function trixi2txt(filename::AbstractString...;
center_level_0, length_level_0, leaf_cells, coordinates, levels = read_meshfile(meshfile)

# Read data
labels, data, n_elements, n_nodes, element_variables, node_variables, time = read_datafile(filename)
labels, data, n_elements, n_nodes, element_variables, time = read_datafile(filename)

# Check if dimensions match
if length(leaf_cells) != n_elements
Expand Down Expand Up @@ -263,16 +263,7 @@ function read_datafile(filename::String)
index += 1
end

# Extract node variable arrays
node_variables = Dict{String, Union{Vector{Float64}, Vector{Int}}}()
index = 1
while haskey(file, "node_variables_$index")
varname = read(attributes(file["node_variables_$index"])["name"])
node_variables[varname] = read(file["node_variables_$index"])
index += 1
end

return labels, data, n_elements, n_nodes, element_variables, node_variables, time
return labels, data, n_elements, n_nodes, element_variables, time
end
end

Expand Down

0 comments on commit 96be070

Please sign in to comment.