// program written in C by Anthony SERPRY on 03/09/2008
// save the file surge.c
// to compile:
//    gcc surge.c -lm -o surge
// to execute:
//    ./surge


#include 
#include 
#include 


int main(void)
{
        //parameter : 
	double g = 9.8;
	double h = 0.2;
	double alpha; alpha = sqrt(g*h);
	double beta; beta = 3/2*sqrt(g*h)/h;
	double gama; gama = 1/6*h*h*sqrt(g*h);
	double dh0 = 0.05;
	double dx = 0.1;
	double dt = 0.00001;
	int Nx = 1000;
	int Nt = 4000000;
	int Nplot = 9;
	double dh1[Nx];
	double dh2[Nx];
	double dh3[Nx];
	double dh4[Nx];
	double result[9][Nx];
	double x[Nx];
	double time = 0.0;
	double pi = 3.14159;

	//initialisation
	long i;
	long j;
	for(i=0; i(Nx/10)&&i<(4*Nx/10)){
			dh1[i] = dh0*0.5*(1+cos((i-Nx/10)*pi/(3*Nx/10)));
		}			
		dh2[i] = dh1[i];
		dh3[i] = dh1[i]; 
		dh4[i] = dh1[i];

	}

	//simulation
	
	for(i=0; i