Skip to content

Commit db83c71

Browse files
amruedaranochaJoshuaLampertsloede
authored
Output the mpi rank to element_variables (SaveSolutionCallback) for visualization with trixi2vtk (#2132)
* Output the mpi rank to element_variables for visualization * Added comments * Added functionality for all parallel mesh types * Update src/solvers/dg.jl Co-authored-by: Joshua Lampert <[email protected]> * Use the right array data structure for the mpi rank * Update src/solvers/dgsem_tree/dg_parallel.jl Co-authored-by: Michael Schlottke-Lakemper <[email protected]> --------- Co-authored-by: Hendrik Ranocha <[email protected]> Co-authored-by: Joshua Lampert <[email protected]> Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
1 parent 9c2f326 commit db83c71

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/solvers/dg.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ function get_element_variables!(element_variables, u, mesh, equations,
1212
nothing
1313
end
1414

15+
# Function to define "element variables" for the SaveSolutionCallback. It does
16+
# nothing by default, but can be specialized for certain mesh types. For instance,
17+
# parallel meshes output the mpi rank as an "element variable".
18+
function get_element_variables!(element_variables, mesh, dg, cache)
19+
nothing
20+
end
21+
22+
# Function to define "element variables" for the SaveSolutionCallback. It does
23+
# nothing by default, but can be specialized for certain volume integral types.
24+
# For instance, shock capturing volume integrals output the blending factor
25+
# as an "element variable".
1526
function get_node_variables!(node_variables, mesh, equations,
1627
volume_integral::AbstractVolumeIntegral, dg, cache)
1728
nothing
@@ -427,6 +438,7 @@ Base.summary(io::IO, dg::DG) = print(io, "DG(" * summary(dg.basis) * ")")
427438
function get_element_variables!(element_variables, u, mesh, equations, dg::DG, cache)
428439
get_element_variables!(element_variables, u, mesh, equations, dg.volume_integral,
429440
dg, cache)
441+
get_element_variables!(element_variables, mesh, dg, cache)
430442
end
431443

432444
function get_node_variables!(node_variables, mesh, equations, dg::DG, cache)

src/solvers/dgsem_tree/dg_parallel.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
@muladd begin
66
#! format: noindent
77

8+
# Function to output the mpi rank for visualization
9+
function get_element_variables!(element_variables,
10+
mesh::Union{ParallelTreeMesh, ParallelP4estMesh,
11+
ParallelT8codeMesh},
12+
dg, cache)
13+
element_variables[:mpi_rank] = ones(real(dg), nelements(mesh, dg, cache)) *
14+
mpi_rank()
15+
return nothing
16+
end
17+
818
# Initialize MPI data structures. This works for both the
919
# `TreeMesh` and the `P4estMesh` and is dimension-agnostic.
1020
function init_mpi_data_structures(mpi_neighbor_interfaces, mpi_neighbor_mortars, n_dims,

0 commit comments

Comments
 (0)