1#!/bin/bash 2# SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors. 3# SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause 4 5declare -A run_flags 6 run_flags[problem]=euler_vortex 7 run_flags[degree]=2 8 run_flags[dm_plex_box_faces]=20,20,1 9 run_flags[lx]=1e3 10 run_flags[ly]=1e3 11 run_flags[lz]=1 12 run_flags[ts_max_time]=.02 13 run_flags[ts_rk_type]=5bs 14 run_flags[ts_rtol]=1e-10 15 run_flags[ts_atol]=1e-10 16 17declare -A test_flags 18 test_flags[degree_start]=1 19 test_flags[degree_stride]=1 20 test_flags[degree_end]=2 21 test_flags[res_start]=6 22 test_flags[res_stride]=2 23 test_flags[res_end]=10 24 25file_name=conv_test_result.csv 26 27echo ",mesh_res,degree,rel_error" > $file_name 28 29i=0 30for ((d=${test_flags[degree_start]}; d<=${test_flags[degree_end]}; d+=${test_flags[degree_stride]})); do 31 run_flags[degree]=$d 32 for ((res=${test_flags[res_start]}; res<=${test_flags[res_end]}; res+=${test_flags[res_stride]})); do 33 run_flags[dm_plex_box_faces]=$res,$res,1 34 args='' 35 for arg in "${!run_flags[@]}"; do 36 if ! [[ -z ${run_flags[$arg]} ]]; then 37 args="$args -$arg ${run_flags[$arg]}" 38 fi 39 done 40 ./navierstokes $args | grep "Relative Error:" | awk -v i="$i" -v res="$res" -v d="$d" '{ printf "%d,%d,%d,%.5f\n", i, res, d, $3}' >> $file_name 41 i=$((i+1)) 42 done 43done 44 45# Compare the output CSV file with the reference file 46count=$(diff conv_test_result.csv tests-output/fluids-navierstokes-conv-euler.csv | grep "^>" | wc -l) 47if [ ${count} != 0 ]; then 48 printf "\n# TEST FAILED!\n\n" 49 diff -q conv_test_result.csv tests-output/fluids-navierstokes-conv-euler.csv 50 printf "\n" 51fi 52