commit 42819a7e94dc64e493361f2a3f7791b8e679d29f
parent c3bbca775feb912ff3d78c40a86a461034dd1340
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 3 Jul 2026 12:54:48 +0200
test: add multi-timestep Darcy equilibrium invariant
Diffstat:
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/test/Makefile b/test/Makefile
@@ -8,6 +8,7 @@ TESTS = cngf_pf_dry \
cngf_pf_dry_vconst \
cngf_pf_wet \
cngf_pf_wet_equilibrium \
+ cngf_pf_wet_equilibrium_darcy \
cngf_pf_wet_norm \
cngf_pf_wet_vari \
cngf_pf_wet_vari_diff \
@@ -28,7 +29,8 @@ TESTS = cngf_pf_dry \
# Self-validating tests carry no .std baseline, so exclude them from the
# regenerable standards.
-STANDARDS := $(filter-out cngf_pf_wet_equilibrium.std test_error_path.std \
+STANDARDS := $(filter-out cngf_pf_wet_equilibrium.std \
+ cngf_pf_wet_equilibrium_darcy.std test_error_path.std \
test_reset_column.std,\
$(TESTS:=.std))
@@ -98,6 +100,17 @@ cngf_pf_wet_equilibrium: $(BIN)
printf "error: top p_f deviates from p_f_top: %s Pa\n", $$4; \
exit 1 } }'
+# Same invariant, but over multiple timesteps so the Darcy solver actually
+# runs (it is gated on t > 0): with constant p_f_top and uniform porosity the
+# hydrostatic profile is a steady state of the Darcy system, so the top
+# physical node must stay at p_f_top (0 Pa here).
+cngf_pf_wet_equilibrium_darcy: $(BIN)
+ ./$(BIN) $(CNGF_PF_WET_OPTS) -e 60 -I 60 | tail -n1 | \
+ awk '{ d = $$4; if (d < 0) d = -d; \
+ if (d > 1.0) { \
+ printf "error: top p_f deviates from p_f_top: %s Pa\n", $$4; \
+ exit 1 } }'
+
cngf_pf_wet_norm: $(BIN)
./$(BIN) $(CNGF_PF_WET_NORM_OPTS) | diff $@.std -
@@ -220,4 +233,4 @@ bench_wet_large:
bench: bench_dry_small bench_dry_large bench_wet_small bench_wet_large
-.PHONY: $(TESTS) cngf_pf_wet_equilibrium test_error_path test_reset_column test standards clean bench bench_dry_small bench_dry_large bench_wet_small bench_wet_large
+.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