Makefile (7960B)
1 BIN = ../cngf-pf 2 BIN2 = ../max_depth_simple_shear 3 BIN3 = ../shear_flux 4 5 TESTS = cngf_pf_dry \ 6 cngf_pf_dry_norm \ 7 cngf_pf_dry_cohesive \ 8 cngf_pf_dry_vconst \ 9 cngf_pf_wet \ 10 cngf_pf_wet_equilibrium \ 11 cngf_pf_wet_equilibrium_darcy \ 12 cngf_pf_wet_norm \ 13 cngf_pf_wet_vari \ 14 cngf_pf_wet_vari_diff \ 15 cngf_pf_wet_vari_pulse \ 16 cngf_pf_wet_vari_pulse_vlim \ 17 shear_flux_dry \ 18 shear_flux_wet \ 19 test_error_path \ 20 test_reset_column \ 21 #cngf_pf_dry_transient \ 22 23 # Skipped tests: 24 # - cngf_pf_dry_trans_undercons, cngf_pf_dry_trans_overcons: 25 # Transient mode with fixed velocity and non-critical porosity has 26 # coupled solver instability (see walkthrough for details) 27 # - max_depth_misc: test config uses removed -O option 28 29 30 # Self-validating tests carry no .std baseline, so exclude them from the 31 # regenerable standards. 32 STANDARDS := $(filter-out cngf_pf_wet_equilibrium.std \ 33 cngf_pf_wet_equilibrium_darcy.std test_error_path.std \ 34 test_reset_column.std,\ 35 $(TESTS:=.std)) 36 37 CNGF_PF_DRY_OPTS = -o 0.03 -L 0.64 -n 40e3 38 CNGF_PF_DRY_NORM_OPTS = -o 0.03 -L 0.64 -n 40e3 -N 39 CNGF_PF_DRY_COHESIVE_OPTS = -o 0.03 -L 0.64 -n 40e3 -c 1e3 40 CNGF_PF_DRY_VCONST_OPTS = -s 1e-3 41 CNGF_PF_WET_OPTS = -o 0.03 -L 0.64 -n 40e3 -F 42 CNGF_PF_WET_NORM_OPTS = -o 0.03 -L 0.64 -n 40e3 -F -N 43 CNGF_PF_WET_VARI_OPTS = -L 8.0 \ 44 -n 150e3 \ 45 -F -k 2e-17 \ 46 -O 50e3 \ 47 -a 50e3 \ 48 -q $$( echo "1.0/(3600*24)" | bc -l ) \ 49 -I $$( echo "60*1000" | bc -l ) \ 50 -e $$( echo "60*20" | bc -l ) 51 CNGF_PF_WET_VARI_DIFF_OPTS =-L 8.0 \ 52 -n 150e3 \ 53 -F -D $$(awk 'BEGIN{print 2e-17/(1.787e-3*(1e-8 + 0.25*3.9e-10))}') \ 54 -O 50e3 \ 55 -a 50e3 \ 56 -q $$( echo "1.0/(3600*24)" | bc -l ) \ 57 -I $$( echo "60*1000" | bc -l ) \ 58 -e $$( echo "60*20" | bc -l ) 59 CNGF_PF_WET_VARI_PULSE_OPTS = $(CNGF_PF_WET_VARI_OPTS) \ 60 -u 500 61 CNGF_PF_WET_VARI_PULSE_VLIM_OPTS = $(CNGF_PF_WET_VARI_OPTS) \ 62 -u 500 -l 1e-3 63 CNGF_PF_DRY_TRANS_OPTS = -T -e 5.0 64 CNGF_PF_DRY_TRANS_UNDERCONS_OPTS = -T -e 100.0 -I 1.0 -s 0.01 -p 0.25 trans_undercons >/dev/null && \ 65 for f in trans_undercons.output*.txt; do tail -n 1 "$$f"; done 66 CNGF_PF_DRY_TRANS_OVERCONS_OPTS = -T -e 100.0 -I 1.0 -s 0.01 -p 0.15 trans_overcons >/dev/null && \ 67 for f in trans_overcons.output*.txt; do tail -n 1 "$$f"; done 68 69 MAX_DEPTH_MISC = sh -c 'for A_f in 1e3 5e3 10e3 50e3 100e3; \ 70 do ./$(BIN2) -O 101e3 -a $$A_f -q 0.01;\ 71 ./$(BIN2) -O 101e3 -a $$A_f -q 0.001;\ 72 ./$(BIN2) -O 101e3 -a $$A_f -q 0.0001; done' 73 74 test: $(TESTS) 75 76 standards: $(STANDARDS) 77 78 cngf_pf_dry: $(BIN) 79 ./$(BIN) $(CNGF_PF_DRY_OPTS) | diff $@.std - 80 81 cngf_pf_dry_norm: $(BIN) 82 ./$(BIN) $(CNGF_PF_DRY_NORM_OPTS) | diff $@.std - 83 84 cngf_pf_dry_cohesive: $(BIN) 85 ./$(BIN) $(CNGF_PF_DRY_COHESIVE_OPTS) | diff $@.std - 86 87 cngf_pf_dry_vconst: $(BIN) 88 ./$(BIN) $(CNGF_PF_DRY_VCONST_OPTS) | diff $@.std - 89 90 cngf_pf_wet: $(BIN) 91 ./$(BIN) $(CNGF_PF_WET_OPTS) | diff $@.std - 92 93 # Self-validating invariant (no .std baseline): starting from the hydrostatic 94 # initial state with a constant top pressure and no forcing, the profile must 95 # stay hydrostatic, so the top physical node must equal p_f_top (0 Pa here). 96 cngf_pf_wet_equilibrium: $(BIN) 97 ./$(BIN) $(CNGF_PF_WET_OPTS) | tail -n1 | \ 98 awk '{ d = $$4; if (d < 0) d = -d; \ 99 if (d > 1.0) { \ 100 printf "error: top p_f deviates from p_f_top: %s Pa\n", $$4; \ 101 exit 1 } }' 102 103 # Same invariant, but over multiple timesteps so the Darcy solver actually 104 # runs (it is gated on t > 0): with constant p_f_top and uniform porosity the 105 # hydrostatic profile is a steady state of the Darcy system, so the top 106 # physical node must stay at p_f_top (0 Pa here). 107 cngf_pf_wet_equilibrium_darcy: $(BIN) 108 ./$(BIN) $(CNGF_PF_WET_OPTS) -e 60 -I 60 | tail -n1 | \ 109 awk '{ d = $$4; if (d < 0) d = -d; \ 110 if (d > 1.0) { \ 111 printf "error: top p_f deviates from p_f_top: %s Pa\n", $$4; \ 112 exit 1 } }' 113 114 cngf_pf_wet_norm: $(BIN) 115 ./$(BIN) $(CNGF_PF_WET_NORM_OPTS) | diff $@.std - 116 117 cngf_pf_wet_vari: $(BIN) 118 ./$(BIN) $(CNGF_PF_WET_VARI_OPTS) | diff $@.std - 119 120 cngf_pf_wet_vari_diff: $(BIN) 121 ./$(BIN) $(CNGF_PF_WET_VARI_DIFF_OPTS) | diff $@.std - 122 123 cngf_pf_wet_vari_pulse: $(BIN) 124 ./$(BIN) $(CNGF_PF_WET_VARI_PULSE_OPTS) | diff $@.std - 125 126 cngf_pf_wet_vari_pulse_vlim: $(BIN) 127 ./$(BIN) $(CNGF_PF_WET_VARI_PULSE_VLIM_OPTS) | diff $@.std - 128 129 cngf_pf_dry_transient: $(BIN) 130 ./$(BIN) $(CNGF_PF_DRY_TRANS_OPTS) | diff $@.std - 131 132 cngf_pf_dry_trans_undercons: $(BIN) 133 ./$(BIN) $(CNGF_PF_DRY_TRANS_UNDERCONS_OPTS) | diff $@.std - 134 135 cngf_pf_dry_trans_overcons: $(BIN) 136 ./$(BIN) $(CNGF_PF_DRY_TRANS_OVERCONS_OPTS) | diff $@.std - 137 138 max_depth_misc: $(BIN2) 139 $(MAX_DEPTH_MISC) | diff $@.std - 140 141 shear_flux_dry: $(BIN) $(BIN3) 142 ./$(BIN) $(CNGF_PF_DRY_OPTS) | ./$(BIN3) | diff $@.std - 143 144 shear_flux_wet: $(BIN) 145 ./$(BIN) $(CNGF_PF_WET_OPTS) | ./$(BIN3) | diff $@.std - 146 147 # In-process check: a non-converging solver must return a non-zero code 148 # instead of terminating the process. 149 test_error_path: $(BIN) 150 $(CC) -I.. -o $@ $@.c ../simulation.o ../arrays.o ../fluid.o -lm 151 ./$@ 152 rm -f $@ 153 154 # In-process check: rerunning a column after reset_column() must reproduce a 155 # fresh prepare_arrays() run bit for bit. 156 test_reset_column: $(BIN) 157 $(CC) -I.. -o $@ $@.c ../simulation.o ../arrays.o ../fluid.o -lm 158 ./$@ 159 rm -f $@ 160 161 cngf_pf_dry.std: $(BIN) 162 ./$(BIN) $(CNGF_PF_DRY_OPTS) > $@ 163 164 cngf_pf_dry_norm.std: $(BIN) 165 ./$(BIN) $(CNGF_PF_DRY_NORM_OPTS) > $@ 166 167 cngf_pf_dry_cohesive.std: $(BIN) 168 ./$(BIN) $(CNGF_PF_DRY_COHESIVE_OPTS) > $@ 169 170 cngf_pf_dry_vconst.std: $(BIN) 171 ./$(BIN) $(CNGF_PF_DRY_VCONST_OPTS) > $@ 172 173 cngf_pf_wet.std: $(BIN) 174 ./$(BIN) $(CNGF_PF_WET_OPTS) > $@ 175 176 cngf_pf_wet_norm.std: $(BIN) 177 ./$(BIN) $(CNGF_PF_WET_NORM_OPTS) > $@ 178 179 cngf_pf_wet_vari.std: $(BIN) 180 ./$(BIN) $(CNGF_PF_WET_VARI_OPTS) > $@ 181 182 cngf_pf_wet_vari_diff.std: $(BIN) 183 ./$(BIN) $(CNGF_PF_WET_VARI_DIFF_OPTS) > $@ 184 185 cngf_pf_wet_vari_pulse.std: $(BIN) 186 ./$(BIN) $(CNGF_PF_WET_VARI_PULSE_OPTS) > $@ 187 188 cngf_pf_wet_vari_pulse_vlim.std: $(BIN) 189 ./$(BIN) $(CNGF_PF_WET_VARI_PULSE_VLIM_OPTS) > $@ 190 191 cngf_pf_dry_transient.std: $(BIN) 192 ./$(BIN) $(CNGF_PF_DRY_TRANS_OPTS) > $@ 193 194 cngf_pf_dry_trans_undercons.std: $(BIN) 195 ./$(BIN) $(CNGF_PF_DRY_TRANS_UNDERCONS_OPTS) > $@ 196 197 cngf_pf_dry_trans_overcons.std: $(BIN) 198 ./$(BIN) $(CNGF_PF_DRY_TRANS_OVERCONS_OPTS) > $@ 199 200 max_depth_misc.std: $(BIN2) 201 $(MAX_DEPTH_MISC) > $@ 202 203 shear_flux_dry.std: $(BIN) $(BIN3) 204 ./$(BIN) $(CNGF_PF_DRY_OPTS) | ./$(BIN3) > $@ 205 206 shear_flux_wet.std: $(BIN) $(BIN3) 207 ./$(BIN) $(CNGF_PF_WET_OPTS) | ./$(BIN3) > $@ 208 209 $(BIN): 210 make -C .. 211 212 clean: 213 rm -f *.txt test_error_path test_reset_column 214 215 # Benchmark configurations for performance/stability testing 216 # These are more intensive than the regression tests 217 BENCH_DRY_SMALL = -o 0.03 -L 0.64 -n 40e3 218 BENCH_DRY_LARGE = -L 10.0 -n 200e3 -e 10.0 219 BENCH_WET_SMALL = -o 0.03 -L 0.64 -n 40e3 -F 220 BENCH_WET_LARGE = -L 8.0 -n 150e3 -F -k 2e-17 -O 50e3 -a 50e3 -q 0.0000115741 -e 3600 221 222 bench_dry_small: 223 ./$(BIN) -B $(BENCH_DRY_SMALL) 2>&1 224 225 bench_dry_large: 226 ./$(BIN) -B $(BENCH_DRY_LARGE) 2>&1 227 228 bench_wet_small: 229 ./$(BIN) -B $(BENCH_WET_SMALL) 2>&1 230 231 bench_wet_large: 232 ./$(BIN) -B $(BENCH_WET_LARGE) 2>&1 233 234 bench: bench_dry_small bench_dry_large bench_wet_small bench_wet_large 235 236 .PHONY: $(TESTS) cngf_pf_wet_equilibrium cngf_pf_wet_equilibrium_darcy test_error_path test_reset_column test standards clean bench bench_dry_small bench_dry_large bench_wet_small bench_wet_large