📄 vmg_cycle.m
字号:
%VMG_CYCLE V-Cycle algorithm.
%
% U_OUT = VMG_CYCLE(LEVEL, B, U_IN) uses the V-cycle to recursively
% solve the linear system AX=B at the given level. If the optional
% starting value U_IN is not passed then U_IN is set to 0's.
%
% zhiyongfinish 2008
% Department of Computer Science
% University of xiangtan in China
function [u_out,u1] = vmg_cycle(level, b1, t1)
if nargin == 2,
t1 = zeros(size(b1));
end
C_level = coarsest;
u1 = smooth(level, b1, t1, 'pre');
r1 = residual(level, b1, u1);
b2 = restrict(level, r1);
t2 = zeros(size(b2));
u2 =smooth(level+1,b2,t2,'pre'); % 残量方程的解:2水平上
r2 = residual(level+1, b2, u2);
b3 = restrict(level+1, r2);
ucc = coarse_grid_solve(level+2, b3);% 残量方程的解:3水平上
uc = interpolate(level+1,ucc,r2); %传递到2水平上
u2 = u2 + uc;
uc = smooth(level+1,b2,u2,'post');
correct = interpolate(level, uc,r1); % 3 + 2 --->1 extrapolate
u1 = u1 + correct;
u_out = smooth(level, b1, u1, 'post');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -