double UpwindDiff::calcDy(GridField<double> &g, const int i, const int j, const int k) { if((*_w)(i, j, k).y > 0.0) return (g(i, j, k) - g(i, j-1, k))/g.dx(); else return (g(i, j+1, k) - g(i, j, k))/g.dx(); }
double UpwindDiff::calcDz(GridField<double> &g, const int i, const int j, const int k) { if((*_w)(i, j, k).z > 0.0) return (g(i, j, k) - g(i, j, k-1))/g.dx(); else return (g(i, j, k+1) - g(i, j, k))/g.dx(); }
Vector3 UpwindDiff::calcDx(GridField<Vector3> &g, const int i, const int j, const int k) { if((*_w)(i, j, k).x > 0.0) return (g(i, j, k) - g(i-1, j, k))/g.dx(); else return (g(i+1, j, k) - g(i, j, k))/g.dx(); }
double UpwindDiff::calcDx(GridField<double> &g, const int i, const int j, const int k) { if((*_w)(i, j, k).x > 0.0){ // if(BURNT) return (g(i, j, k) - g(i-1, j, k))/g.dx(); } else {// FUEL return (g(i+1, j, k) - g(i, j, k))/g.dx(); } }
double CentralDiff::calcDxy(GridField<double> &g, const int i, const int j, const int k) { /*CellType c_t = LevelSet::getCellType(g(i,j,k)); return ( g(i+1,j+1,k,c_t) - g(i+1,j-1,k,c_t) + g(i-1,j-1,k,c_t) - g(i-1,j+1,k,c_t) ) / (4.0*g.dx()*g.dx());*/ /*double asd4 = g(i-1,j+1,k); double asd3 = g(i-1,j-1,k); double asd2 = g(i+1,j-1,k); double asd1 = g(i+1,j+1,k); */ return ( g(i+1,j+1,k) - g(i+1,j-1,k) + g(i-1,j-1,k) - g(i-1,j+1,k) ) / (4.0*g.dx()*g.dx()); }
Vector3 CentralDiff::calcDyz(GridField<Vector3> &g, const int i, const int j, const int k) { return ( g(i,j+1,k+1) - g(i,j+1,k-1) + g(i,j-1,k-1) - g(i,j-1,k+1) ) / (4.0*g.dx()*g.dx()); }
double CentralDiff::calcD2z(GridField<double> &g, const int i, const int j, const int k) { return ( g(i,j,k+1) - 2.0*g(i,j,k) + g(i,j,k-1))/( g.dx()*g.dx() /* deltaZ^2 */ ); }
double CentralDiff::calcDxz(GridField<double> &g, const int i, const int j, const int k) { return ( g(i+1,j,k+1) - g(i+1,j,k-1) + g(i-1,j,k-1) - g(i-1,j,k+1) ) / (4.0*g.dx()*g.dx()); }
double CentralDiff::calcDz(GridField<double> &g, const int i, const int j, const int k) { return (double)(g(i, j, k+1) - g(i, j, k-1))/(g.dx()*2.0); }
double CentralDiff::calcD2y(GridField<double> &g, const int i, const int j, const int k) { return ( g(i,j+1,k) - 2.0*g(i,j,k) + g(i,j-1,k))/( g.dx()*g.dx() /* deltaY^2 */ ); }
double CentralDiff::calcDzp(GridField<double> &g, const int i, const int j, const int k) { throw; //EJ DEFINIERAD I CENTRAL return (double)(g(i, j, k + 1) - g(i, j, k))/(g.dx()); }
double CentralDiff::calcDy(GridField<double> &g, const int i, const int j, const int k) { return (double)(g(i, j+1, k) - g(i, j-1, k))/(g.dx()*2.0); }
Vector3 CentralDiff::calcDxy(GridField<Vector3> &g, const int i, const int j, const int k) { return ( g(i+1,j+1,k) - g(i+1,j-1,k) + g(i-1,j-1,k) - g(i-1,j+1,k) ) / (4.0*g.dx()*g.dx()); }
double UpwindDiff::calcDzp(GridField<double> &g, const int i, const int j, const int k) { return (double)(g(i, j, k + 1) - g(i, j, k))/(g.dx()); }
Vector3 CentralDiff::calcD2x(GridField<Vector3> &g, const int i, const int j, const int k) { return ( g(i+1,j,k) - 2.0*g(i,j,k) + g(i-1,j,k))/( g.dx()*g.dx() /*deltaX^2 */ ); }
Vector3 CentralDiff::calcDz(GridField<Vector3> &g, const int i, const int j, const int k) { return (Vector3)(g(i, j, k+1) - g(i, j, k-1))/(g.dx()*2.0); }
Vector3 CentralDiff::calcDy(GridField<Vector3> &g, const int i, const int j, const int k) { return (Vector3)(g(i, j+1, k) - g(i, j-1, k))/(g.dx()*2.0); }