++Hello guys,
I wrote this code to solve 2d heat diffusion problem by finite difference method. The code is compiling(generic compiler,ubuntu) and running fine. no problem with that. Although i initialized the top boundary condition to 10 here: f0[0][j] = 10.0, f[0][j] = 10.0 , you can see from the output part the first row all zero. I want it to be 10.
What i want to ask is, am i missing something? I am really new to C++, so i have no idea what is not working. Thank you in advance.
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#define m 10
#define n 10
using namespace std;
int main(){
double f0[n][m],f[n][m],x[n],y[m];
double dx, time, dy, dt, alpha, mstep, termx, termy, dd, w;
dx = 1.0;
dy = 1.0;
dt = 0.20;
alpha = 0.20;
mstep = 3200;
FILE * mFile;
w = (dt/(dx*dy))*alpha;