#include #include #include #include $input int NXB = 5; // upper bound on nx $input int nx; // global number of points excl. boundary $assume 1<=nx && nx<=NXB; $input double U_INIT[nx+2]; // initial values for temperature incl. boundary $input double k; // the constant D*dt/(dx*dx) $assume k>0 && k<.5; $input int NSTEPS_BOUND=5; // upper bound on nsteps $input int nsteps; // number of time steps $assume 1<=nsteps && nsteps<=NSTEPS_BOUND; $input int wstep = 1; // write frame every this many time steps //$assume 1<=wstep && wstep<=nsteps; //$assume nsteps%wstep == 0 && wstep != 0; $output double output[nsteps][nx+2]; // solution computed sequentially, proc 0 only /* Global variables */ double lbound; /* left fixed boundary value */ double rbound; /* right fixed boundary value */ int main() { //elaborate nx to concrete value... elaborate(nx); elaborate(nsteps); double u[nsteps][nx+2]; int counter = 0; lbound = U_INIT[0]; rbound = U_INIT[nx+1]; for (int i=0; i