O'Reilly logo

Introduction to Computational Fluid Dynamics by M. K. Laha, S. K. Chakrabartty, Pradip Niyogi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required