Skip to content

Commit 3bf9eb3

Browse files
committed
this is important enough to need a regression test
1 parent 4432c5a commit 3bf9eb3

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

c/ch7/solns/bratu2D.c

-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ PetscErrorCode NonlinearGS(SNES snes, Vec u, Vec b, void *ctx) {
264264
// + hxhy * (2 u - au[j-1][i] - au[j+1][i])
265265
// - darea * lambda * e^u - bij
266266
uu = au[j][i];
267-
phi0 = 0.0;
268267
for (k = 0; k < maxits; k++) {
269268
phi = hyhx * (2.0 * uu - au[j][i-1] - au[j][i+1])
270269
+ hxhy * (2.0 * uu - au[j-1][i] - au[j+1][i])

c/ch7/solns/makefile

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ bratu2D: bratu2D.o ../../ch6/poissonfunctions.o
55
-${CLINKER} -o bratu2D bratu2D.o ../../ch6/poissonfunctions.o ${PETSC_LIB}
66
${RM} bratu2D.o ../../ch6/poissonfunctions.o
77

8+
# testing
9+
10+
runbratu2D_1:
11+
-@../../testit.sh bratu2D "-lb_exact -snes_converged_reason -lb_showcounts -snes_type fas -snes_fas_type full -fas_levels_snes_type ngs -fas_levels_snes_ngs_sweeps 2 -fas_levels_snes_max_it 1 -fas_coarse_snes_type ngs -fas_coarse_snes_ngs_sweeps 2 -fas_coarse_snes_max_it 4 -da_refine 2 -snes_monitor_short" 1 1
12+
13+
test_bratu2D: runbratu2D_1
14+
15+
test: test_bratu2D
16+
817
# etc
918

10-
.PHONY: distclean
19+
.PHONY: distclean test test_bratu2D runbratu2D_1
1120

1221
distclean:
13-
@rm -f bratu2D
14-
22+
@rm -f bratu2D *tmp

c/ch7/solns/output/bratu2D.test1

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
0 SNES Function norm 9.04754
2+
1 SNES Function norm 0.000449564
3+
2 SNES Function norm 1.87245e-06
4+
3 SNES Function norm 8.93257e-09
5+
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 3
6+
flops = 8.763e+04, residual calls = 69, NGS calls = 58
7+
done on 9 x 9 grid: error |u-uexact|_inf = 3.169e-04

0 commit comments

Comments
 (0)