Appendix C: Programs in the ‘C’ Language
C.1 PROGRAM 3.1:ADI.C
/* ......Program 3.1: adi.c. */
/* ......It solves by the ADI-scheme the 2-D heat-conduction eq.
* ...... u_t = K(u_xx + u_yy), */
/* ......initial condition:
* ...... u(x,y,o) = sin(pi x)sin(pi y), 0<= x,y <= 1, */
/* ......boundary conditions:
* ...... u=0, on all the boundaries. */
/* ......Known exact solution:
* ...... u(x,y,t) = e^(−pi^2 t)*sin(pi x) sin(pi y). */
/* ......Take delta x=delta y=0.2, r_1=r_2=1, KK=1. */
/* ......dth is the half time-step. nm=nmax, jm=jmax, km=kmax */
/*........................................................... */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
static int
strid(double *, double *, double *, double *, int); ...
Get Introduction to Computational Fluid Dynamics now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.