void Computation::setBoundaryTN(GridFunction& T, RealType (*TO)(RealType), RealType (*TU)(RealType), RealType (*TL)(RealType), RealType (*TR)(RealType)) { MultiIndexType begin, end; // T_i,0 begin[0] = 1; end[0] = T.griddimension[0] - 2; begin[1] = 0; end[1] = 0; MultiIndexType Offset; Offset[0] = 0; Offset[1] = 1; T.SetGridFunction(begin, end, TU, false, SimIO.para.deltaX); T.ScaleGridFunction(begin, end, SimIO.para.deltaY); T.AddToGridFunction(begin, end, 1.0, T, Offset); // T_i,jmax+1 begin[0] = 1; end[0] = T.griddimension[0] - 2; begin[1] = T.griddimension[1] - 1; end[1] = T.griddimension[1] - 1; //MultiIndexType Offset; Offset[0] = 0; Offset[1] = -1; T.SetGridFunction(begin, end, TO, false, SimIO.para.deltaX); T.ScaleGridFunction(begin, end, SimIO.para.deltaY); T.AddToGridFunction(begin, end, 1.0, T, Offset); }
void Computation::computeNewVelocities(GridFunction& u, GridFunction& v, GridFunction& f, GridFunction& g, GridFunction& p, RealType deltaT) { GridFunction branch_1(p.griddimension); MultiIndexType begin, end; begin[0] = 1; end[0] = u.griddimension[0] - 3; begin[1] = 1; end[1] = u.griddimension[1] - 2; // u Update PointType delta; delta[0] = SimIO.para.deltaX; delta[1] = SimIO.para.deltaY; Px(branch_1, p, delta); f.AddToGridFunction(begin, end, -1.0 * deltaT, branch_1); u.SetGridFunction(begin, end, 1.0, f); // v Update begin[0] = 1; end[0] = v.griddimension[0] - 2; begin[1] = 1; end[1] = v.griddimension[1] - 3; GridFunction branch_2(p.griddimension); Py(branch_2, p, delta); g.AddToGridFunction(begin, end, -1.0 * deltaT, branch_2); v.SetGridFunction(begin, end, 1.0, g); }
void VVy(GridFunction& output, GridFunction& v, const RealType alpha, const PointType& h) { MultiIndexType begin, end; begin[0] = 1; end[0] = v.griddimension[0] - 2; begin[1] = 1; end[1] = v.griddimension[1] - 3; Stencil stencil_1(3, h); stencil_1.setVVy_1Stencil(); stencil_1.ApplyStencilOperator(begin, end, begin, end, v, output); output.MultiplyGridFunctions(begin, end, output); GridFunction branch_2(v.griddimension); Stencil stencil_2(3, h); stencil_2.setVVy_2Stencil(); stencil_2.ApplyStencilOperator(begin, end, begin, end, v, branch_2); branch_2.MultiplyGridFunctions(begin, end, branch_2); output.AddToGridFunction(begin, end, -1.0, branch_2); output.ScaleGridFunction(begin, end, 1.0 / h[1]); GridFunction branch_3(v.griddimension); Stencil stencil_3(3, h); stencil_3.setVVy_3Stencil(); stencil_3.ApplyStencilOperator(begin, end, begin, end, v, branch_3); branch_3.MultiplyGridFunctions(begin, end, branch_3); GridFunction branch_4(v.griddimension); Stencil stencil_4(3, h); stencil_4.setVVy_4Stencil(); stencil_4.ApplyStencilOperator(begin, end, begin, end, v, branch_4); branch_4.MultiplyGridFunctions(begin, end, branch_4); branch_3.MultiplyGridFunctions(begin, end, branch_4); GridFunction branch_5(v.griddimension); Stencil stencil_5(3, h); stencil_5.setVVy_5Stencil(); stencil_5.ApplyStencilOperator(begin, end, begin, end, v, branch_5); branch_5.MultiplyGridFunctions(begin, end, branch_5); GridFunction branch_6(v.griddimension); Stencil stencil_6(3, h); stencil_6.setVVy_6Stencil(); stencil_6.ApplyStencilOperator(begin, end, begin, end, v, branch_6); branch_6.MultiplyGridFunctions(begin, end, branch_6); branch_5.MultiplyGridFunctions(begin, end, branch_6); branch_3.AddToGridFunction(begin, end, -1.0, branch_5); branch_3.ScaleGridFunction(begin, end, alpha / h[1]); output.AddToGridFunction(begin, end, 1.0, branch_3); }
void UVx(GridFunction& output, GridFunction& u, GridFunction& v, const RealType alpha, const PointType& h) { MultiIndexType begin, end; begin[0] = 1; end[0] = u.griddimension[0] - 2; begin[1] = 1; end[1] = u.griddimension[1] - 3; Stencil stencil_1(3, h); stencil_1.setUVx_1Stencil(); stencil_1.ApplyStencilOperator(begin, end, begin, end, u, output); GridFunction branch_2(u.griddimension); Stencil stencil_2(3, h); stencil_2.setUVx_2Stencil(); stencil_2.ApplyStencilOperator(begin, end, begin, end, v, branch_2); output.MultiplyGridFunctions(begin, end, branch_2); GridFunction branch_3(u.griddimension); Stencil stencil_3(3, h); stencil_3.setUVx_3Stencil(); stencil_3.ApplyStencilOperator(begin, end, begin, end, u, branch_3); GridFunction branch_4(u.griddimension); Stencil stencil_4(3, h); stencil_4.setUVx_4Stencil(); stencil_4.ApplyStencilOperator(begin, end, begin, end, v, branch_4); branch_3.MultiplyGridFunctions(begin, end, branch_4); output.AddToGridFunction(begin, end, -1.0, branch_3); output.ScaleGridFunction(begin, end, 1.0 / h[0]); //bis hier 1. Zeile GridFunction branch_5(u.griddimension); Stencil stencil_5(3, h); stencil_5.setUVx_5Stencil(); stencil_5.ApplyStencilOperator(begin, end, begin, end, u, branch_5); GridFunction branch_6(u.griddimension); Stencil stencil_6(3, h); stencil_6.setUVx_6Stencil(); stencil_6.ApplyStencilOperator(begin, end, begin, end, v, branch_6); branch_5.MultiplyGridFunctions(begin, end, branch_6); GridFunction branch_7(u.griddimension); Stencil stencil_7(3, h); stencil_7.setUVx_7Stencil(); stencil_7.ApplyStencilOperator(begin, end, begin, end, u, branch_7); GridFunction branch_8(u.griddimension); Stencil stencil_8(3, h); stencil_8.setUVx_8Stencil(); stencil_8.ApplyStencilOperator(begin, end, begin, end, v, branch_8); branch_7.MultiplyGridFunctions(begin, end, branch_8); branch_5.AddToGridFunction(begin, end, -1.0, branch_7); branch_5.ScaleGridFunction(begin, end, alpha * 1.0 / h[0]); //bis hier 2. Zeile output.AddToGridFunction(begin, end, 1.0, branch_5); }
void Computation::ComputeTemperature(GridFunction& T, GridFunction& u, GridFunction& v, RealType deltaT) { GridFunction branch_1(T.griddimension); GridFunction branch_2(T.griddimension); MultiIndexType begin, end; //missing w�rmequelle begin[0] = 1; end[0] = T.griddimension[0] - 2; begin[1] = 1; end[1] = T.griddimension[1] - 2; PointType delta; delta[0] = SimIO.para.deltaX; delta[1] = SimIO.para.deltaY; TXX(branch_1, T, delta); TYY(branch_2, T, delta); branch_1.AddToGridFunction(begin, end, 1.0, branch_2); branch_1.ScaleGridFunction(begin, end, 1.0 / (SimIO.para.Pr * SimIO.para.re)); GridFunction branch_3(T.griddimension); GridFunction branch_4(T.griddimension); UTX(branch_3, u, T, SimIO.para.gamma, delta); VTY(branch_4, v, T, SimIO.para.gamma, delta); branch_3.AddToGridFunction(begin, end, 1.0, branch_4); branch_1.AddToGridFunction(begin, end, -1.0, branch_3); branch_1.ScaleGridFunction(begin, end, deltaT); T.AddToGridFunction(begin, end, 1.0, branch_1); }
void Computation::computeRighthandSide(GridFunction& rhs, GridFunction& f, GridFunction& g, RealType deltaT) { GridFunction branch_1(g.griddimension); MultiIndexType begin, end; begin[0] = 1; end[0] = f.griddimension[0] - 2; begin[1] = 1; end[1] = f.griddimension[1] - 2; PointType delta; delta[0] = SimIO.para.deltaX; delta[1] = SimIO.para.deltaY; Fx(rhs, f, delta); Gy(branch_1, g, delta); rhs.AddToGridFunction(begin, end, 1.0, branch_1); rhs.ScaleGridFunction(begin, end, 1.0 / deltaT); }
void Computation::computeMomentumEquations(GridFunction& f, GridFunction& g, GridFunction& u, GridFunction& v, GridFunction& t, RealType& deltaT) { PointType h; h[0] = SimIO.para.deltaX; h[1] = SimIO.para.deltaY; RealType alpha = SimIO.para.alpha; MultiIndexType begin, end; begin[0] = 1; end[0] = u.griddimension[0] - 3; begin[1] = 1; end[1] = u.griddimension[1] - 2; // Term F Uxx(f, u, h); GridFunction branch_2(u.griddimension); Uyy(branch_2, u, h); f.AddToGridFunction(begin, end, 1.0, branch_2); f.ScaleGridFunction(begin, end, 1.0 / SimIO.para.re); GridFunction branch_3(u.griddimension); UUx(branch_3, u, alpha, h); GridFunction branch_4(u.griddimension); UVy(branch_4, u, v, alpha, h); branch_3.AddToGridFunction(begin, end, 1.0, branch_4); f.AddToGridFunction(begin, end, -1.0, branch_3); // KILL branch 2-4 f.ScaleGridFunction(begin, end, deltaT); f.AddToGridFunction(begin, end, 1.0, u); // - beta deltaT (tx stencil) gx GridFunction branch_5(u.griddimension); Stencil stencil_1(3, h); stencil_1.setTxStencil(); stencil_1.ApplyStencilOperator(begin, end, begin, end, t, branch_5); branch_5.ScaleGridFunction(begin, end, deltaT * SimIO.para.beta * SimIO.para.gx); f.AddToGridFunction(begin, end, -1.0, branch_5); //Term G begin[0] = 1; end[0] = v.griddimension[0] - 2; begin[1] = 1; end[1] = v.griddimension[1] - 3; Vxx(g, v, h); GridFunction branch_6(v.griddimension); Vyy(branch_6, v, h); g.AddToGridFunction(begin, end, 1.0, branch_6); g.ScaleGridFunction(begin, end, 1.0 / SimIO.para.re); GridFunction branch_7(v.griddimension); UVx(branch_7, u, v, alpha, h); GridFunction branch_8(v.griddimension); VVy(branch_8, v, alpha, h); branch_7.AddToGridFunction(begin, end, 1.0, branch_8); g.AddToGridFunction(begin, end, -1.0, branch_7); g.ScaleGridFunction(begin, end, deltaT); g.AddToGridFunction(begin, end, 1.0, v); // - beta deltaT (ty stencil) gy GridFunction branch_9(u.griddimension); Stencil stencil_2(3, h); stencil_2.setTyStencil(); stencil_2.ApplyStencilOperator(begin, end, begin, end, t, branch_9); branch_9.ScaleGridFunction(begin, end, deltaT * SimIO.para.beta * SimIO.para.gy); g.AddToGridFunction(begin, end, -1.0, branch_9); }
void Computation::setBoundaryTD(GridFunction& T, RealType (*TO)(RealType), RealType (*TU)(RealType), RealType (*TL)(RealType), RealType (*TR)(RealType)) { MultiIndexType begin, end; if (SimIO.para.world_rank == 0) { // p_0,j = p_1,j begin[0] = 0; end[0] = 0; begin[1] = 1; end[1] = T.griddimension[1] - 2; T.SetGridFunction(begin, end, TL, true, SimIO.para.deltaY); T.ScaleGridFunction(begin, end, 2.0); MultiIndexType Offset; Offset[0] = 1; Offset[1] = 0; T.AddToGridFunction(begin, end, -1.0, T, Offset); } if (SimIO.para.world_rank == 1) { // T_imax+1,j begin[0] = T.griddimension[0] - 1; end[0] = T.griddimension[0] - 1; begin[1] = 1; end[1] = T.griddimension[1] - 2; MultiIndexType Offset; Offset[0] = -1; Offset[1] = 0; T.SetGridFunction(begin, end, TR, true, SimIO.para.deltaY); T.ScaleGridFunction(begin, end, 2.0); T.AddToGridFunction(begin, end, -1.0, T, Offset); } /* // T_i,0 begin[0] = 1; end[0] = T.griddimension[0] - 2; begin[1] = 0; end[1] = 0; MultiIndexType Offset; Offset[0] = 0; Offset[1] = 1; T.SetGridFunction(begin, end, TU, false, SimIO.para.deltaX); T.ScaleGridFunction(begin, end, 2.0); T.AddToGridFunction(begin, end, -1.0, T, Offset); // T_i,jmax+1 begin[0] = 1; end[0] = T.griddimension[0] - 2; begin[1] = T.griddimension[1] - 1; end[1] = T.griddimension[1] - 1; MultiIndexType Offset; Offset[0] = 0; Offset[1] = -1; T.SetGridFunction(begin, end, TO, false, SimIO.para.deltaX); T.ScaleGridFunction(begin, end, 2.0); T.AddToGridFunction(begin, end, -1.0, T, Offset);*/ }