Exemplo n.º 1
0
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);

}
Exemplo n.º 2
0
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);
}