Content deleted Content added
→Multigrid preconditioning: added url doi to references |
Sagdestein (talk | contribs) m →Algorithm: Correct whitespace |
||
Line 26:
<syntaxhighlight lang="matlab">
function phi = V_Cycle(phi,f,h)
% Compute Residual Errors
r = residual(phi,f,h);
% Restriction
rhs = restriction(r);
eps = zeros(size(rhs));
% stop recursion at smallest grid size, otherwise continue recursion
if smallest_grid_size_is_achieved
eps = smoothing(eps,rhs,2*h);
else
eps = V_Cycle(eps,rhs,2*h);
end
% Prolongation and Correction
phi = phi + prolongation(eps);
% Post-Smoothing
phi = smoothing(phi,f,h);
end
</syntaxhighlight>
||
Line 59 ⟶ 58:
<syntaxhighlight lang="matlab">
function phi = F_Cycle(phi,f,h)
% Compute Residual Errors
r = residual(phi,f,h);
% Restriction
rhs = restriction(r);
eps = zeros(size(rhs));
% Prolongation and Correction
phi = phi + prolongation(eps);
% Re-smoothing
% Compute residual errors
r = residual(phi,f,h);
% Restriction
rhs = restriction(r);
% stop recursion at smallest grid size, otherwise continue recursion
if smallest_grid_size_is_achieved
eps = smoothing(eps,rhs,2*h);
else
eps = V_Cycle(eps,rhs,2*h);
end
% Prolongation and Correction
phi = phi + prolongation(eps);
% Post-smoothing
phi = smoothing(phi,f,h);
end
</syntaxhighlight>
Line 110 ⟶ 109:
<syntaxhighlight lang="matlab">
function phi = W_cycle(phi,f,h)
% Pre-smoothing
phi = smoothing(phi,f,h);
% Compute Residual Errors
r = residual(phi,f,h);
% Restriction
rhs = restriction(r);
eps = zeros(size(rhs));
% stop recursion at smallest grid size, otherwise continue recursion
if smallest_grid_size_is_achieved
eps = smoothing(eps,rhs,2*h);
else
eps = W_cycle(eps,rhs,2*h);
end
% Prolongation and correction
phi = phi + prolongation(eps);
% Re-smoothing
phi = smoothing(phi,f,h);
% Compute residual errors
% Restriction
rhs = restriction(r);
% Prolongation and correction
phi = phi + prolongation(eps);
% Post-smoothing
phi = smoothing(phi,f,h);
end
</syntaxhighlight>
|