Skip to main content

Module three_dimensions

Module three_dimensions 

Source
Expand description

§Three dimensions

Cartesian, three space dimensions. As in 2D, the kernels are the one-dimensional ones swept along each axis, so what is new is checked here: that the three axes are treated alike, that a closed box conserves, and that blocks and threads change nothing. Problem file: problems/3d/euler/blast.toml. Test paths are relative to crates/merlin-finite-volume/tests/ unless they start with crates/.

§Blast in a closed box

A spherical blast in a closed cube (64 by 64 by 64 cells, 8 blocks, reflecting walls on all six faces, $t=0.25$). There is no exact solution in a box, because the waves reflect, so the checks are invariants.

Schlieren image on the middle plane z = 0.5 at t = 0.25

CheckResult
Mass and energy through reflections off six wallsrelative drift 1.1e-15 and 1.5e-15
The same, 64 blocks (a 4 by 4 by 4 layout) on 8 threads4.4e-16 and 0
Every permutation of the three axesthe solution respects all six permutations (to 1e-11)
Threadsbit-identical on 2, 3, 4 and 8 threads
Tests that enforce this

Enforced by equations/euler2d.rs: a_three_dimensional_blast_respects_every_permutation_of_the_axes; solver/threads.rs: a_three_dimensional_blast_is_identical_on_any_number_of_threads; solver/multidim.rs: three_dimensional_advection_follows_the_diagonal_and_conserves; crates/merlin-cli/tests/run/multidim_problems.rs: three_dimensional_problems_run_from_a_file, a_closed_box_conserves_mass_and_energy_and_reports_each_momentum, the_block_layout_in_the_file_does_not_change_the_answer, the_number_of_threads_in_the_file_does_not_change_the_answer.

§Parallel execution

Because results are combined in block order, the answer is the same on any number of threads: runs on 1, 2, 3, 4, 6 and 8 threads of the 200 by 200 configuration-3 problem have 0 differing values in the final snapshot, and the vortex convergence study has the same errors to the last bit and the same fitted order (2.1104) at every thread count (solver/threads.rs: convergence_studies_give_the_same_errors_and_orders_on_any_number_of_threads).

Speed is a measurement, not a correctness property, and no test asserts it. From pymerlin scaling 2d/euler/vortex --threads=1,2,4,8 --repeats=3 (fastest of three, 8-core Apple M1 with 4 performance and 4 efficiency cores; 100 by 100 vortex, 4 blocks, to $t=10$):

ThreadsTime (s)SpeedupEfficiency
110.251.001.00
26.721.530.76
44.022.550.64
84.302.380.30

Scaling study

The flux sweeps are 73 to 93 % of a step. This vortex has four blocks, so at eight threads four threads have no block to work on; the problem is small and the speedup is limited by memory bandwidth.