/* Imhf.c Implicit heat flow equation, finite differenced. From Claerbout (1985) p. 98. Usage: imhf >output Compile: cc imhf.c rtris.c -fswitch -o imhf */ /* The usual includes */ #include #include main() { int nx, it, ix; float alpha, a, q[12], d[12], e[12], f[12]; nx = 12; a = 8; printf("a = %4.2f\n", a); alpha = 0.5*a; /* Initial temperature step */ for (ix=0; ix<6; ix++) q[ix] = 0; for (ix=6; ix<12; ix++) q[ix] = 1; /* Iterate in time */ for (it=0; it<4; it++) { /* Print current state of array */ for (ix=0; ix