Exemplo n.º 1
0
void Computation::ComputeHeatfunction(GridFunction& h, GridFunction& t, GridFunction& u, RealType deltaT) {
	for (int i = 0; i <= h.griddimension[0]-2; i++){
		for (int j = 1; j <= h.griddimension[1]-2; j++){
			h.getGridFunction()[i][j] = h.getGridFunction()[i][j-1]
			                + deltaT * (SimIO.para.re * SimIO.para.Pr * u.getGridFunction()[i][j]
			                  * (t.getGridFunction()[i+1][j] + t.getGridFunction()[i][j])/2.0
			                  - (t.getGridFunction()[i+1][j] - t.getGridFunction()[i][j])/ SimIO.para.deltaX);
		}
	}

}
Exemplo n.º 2
0
//one cycle of the solver, starts with (1,1)
void Solver::SORCycle_White(GridFunction& p, GridFunction& rhs) {


	for (int i = 1; i<=SimIO.para.iMax;i++){
		for(int j=1+i%2; j<=SimIO.para.jMax;j+=2){

			p.getGridFunction()[i][j] =(1-SimIO.para.omg)*p.getGridFunction()[i][j] +
						(SimIO.para.omg)/(2.0*(1.0/(SimIO.para.deltaX*SimIO.para.deltaX) + 1.0/(SimIO.para.deltaY*SimIO.para.deltaY)))*
						((p.getGridFunction()[i+1][j]+p.getGridFunction()[i-1][j])/(SimIO.para.deltaX*SimIO.para.deltaX) +
						(p.getGridFunction()[i][j+1]+p.getGridFunction()[i][j-1])/(SimIO.para.deltaY*SimIO.para.deltaY)
						- rhs.getGridFunction()[i][j]);

		}
	}
}