Skip to content

Commit

Permalink
Added (downstream) test to assess if the MPI rank was saved correctly…
Browse files Browse the repository at this point in the history
… in a Trixi parallel simulation
  • Loading branch information
amrueda committed Nov 18, 2024
1 parent 58b6870 commit bf2bb83
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Test3D

using Test
using Trixi2Vtk
using MPI: mpiexec

include("test_trixi2vtk.jl")

Expand Down Expand Up @@ -102,6 +103,32 @@ end
end
end

@testset "Parallel Trixi.jl" begin
# Clean output directory
isdir(outdir) && rm(outdir, recursive=true)

# Run trixi in parallel with 2 ranks
mpiexec() do cmd
run(`$cmd -n 2 $(Base.julia_cmd()) --threads=1 --project=@. -e 'using Trixi; trixi_include(joinpath(examples_dir(), "p4est_3d_dgsem", "elixir_mhd_alfven_wave_nonconforming.jl"), trees_per_dimension=(1, 1, 1), maxiters=4)'`)
end

# Get output file name
filename = joinpath(outdir, "solution_" * LEADING_ZEROS * "000004.h5")

# Read data from file
(labels, data, n_elements, n_nodes, element_variables, node_variables, time) = Trixi2Vtk.read_datafile(filename)

# Create reference for mpi_rank
mpi_rank_ref = zeros(n_elements)
mpi_rank_ref[50:end] .= 1.0

# Compare read-in mpi_rank with reference
@test element_variables["mpi_rank"] == mpi_rank_ref

# Finally, test if we can generate the output file without warnings
@test_nowarn trixi2vtk(filename, output_directory=outdir)
end

if !Sys.iswindows() && get(ENV, "CI", nothing) == "true"
# OBS! Only `TreeMesh` results are tested on Windows runners due to memory limits.
# All remaining mesh types are tested on Ubuntu and Mac
Expand Down

0 comments on commit bf2bb83

Please sign in to comment.