Esempio n. 1
0
int main(int argc, char *argv[]) {

  int iteration = 0;
  int max = 10000;
  if(argc > 1) {
    max = atoi(argv[1]);
  }

  while (iteration < max) {
    if(iteration %2 == 0) {
      heat_flow(heat_data, heat_copy, heat_stencil, C0, C1);
    } else {
      heat_flow(heat_copy, heat_data, heat_stencil, C0, C1);
    }
    iteration = iteration + 1;
  }
}
Esempio n. 2
0
double compute_boundary_heat(double Gamma_k[MAXSIZE][MAXSIZE],
			     double Gamma_l[MAXSIZE][MAXSIZE],
			     double new_theta[MAXSIZE][MAXSIZE], double deltat)
{
  int i,j,k,l;
  double boundary_heat;
  double h1=0.0;
  double h2=0.0;
  double h3=0.0;
  double h4=0.0;

  /* heat flow on north */
  for (k=2;k<problem_size;k++){
    l=2;
    i=k;
    j=1;
    h1+=heat_flow(Gamma_k,new_theta,i,j,k,l,deltat);
  }
  /* heat flow on south */
  for (k=3;k<problem_size-1;k++){
    l=problem_size-1;
    i=k;
    j=problem_size;
    h2+=heat_flow(Gamma_k,new_theta,i,j,k,l,deltat);
  }
  /* heat flow on east */
  for (l=3;l<problem_size;l++){
    k=problem_size-1;
    i=problem_size;
    j=l;
    h3+=heat_flow(Gamma_l,new_theta,i,j,k,l,deltat);
  }
  /* heat flow on west */
  for (l=3;l<problem_size;l++){
    k=2;
    i=1;
    j=l;
    h4+=heat_flow(Gamma_l,new_theta,i,j,k,l,deltat);
  }
  boundary_heat= h1 + h2 + h3 + h4;
  return boundary_heat;
}