ex6: I tried with exacmple C
This commit is contained in:
parent
4cd85941b9
commit
7bb12631aa
4 changed files with 15 additions and 2 deletions
|
|
@ -30,9 +30,16 @@ for it = 1:nIter
|
||||||
%Jump in convection-diffusion flux
|
%Jump in convection-diffusion flux
|
||||||
Jl = -ul + p*u(j);
|
Jl = -ul + p*u(j);
|
||||||
Jr = -ur + p*u(j);
|
Jr = -ur + p*u(j);
|
||||||
|
% GH
|
||||||
|
% JL = (u(j)-u(j-1))/(x(j)-x(j-1))*(x(j)-x(j-1));
|
||||||
|
% JR = (u(j+1)-u(j))/(x(j+1)-x(j))*(x(j+1)-x(j));
|
||||||
|
% HG
|
||||||
eta(j) = abs(Jr - Jl);
|
eta(j) = abs(Jr - Jl);
|
||||||
|
%GH eta(j) = abs(Jr - Jl)*sqrt((x(j)-x(j-1))*(x(j+1)-x(j)));
|
||||||
|
%GH eta(j) = abs(Jr - Jl)*sqrt(max((x(j)-x(j-1)),(x(j+1)-x(j))));
|
||||||
end
|
end
|
||||||
x = r_adapt(x, eta);
|
x = r_adapt(x, eta);
|
||||||
|
%
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -41,3 +48,8 @@ plot(x,u,'-o','LineWidth',1.5)
|
||||||
xlabel('x'), ylabel('u')
|
xlabel('x'), ylabel('u')
|
||||||
title(['Ex6C, r-adaptivity, Péclet p = ',num2str(p)])
|
title(['Ex6C, r-adaptivity, Péclet p = ',num2str(p)])
|
||||||
grid on
|
grid on
|
||||||
|
% GH
|
||||||
|
hold on
|
||||||
|
fplot(@(x) (exp(p*x)-1)/(exp(p)-1),[0,1])
|
||||||
|
% Finalize the plot with the exact solution for comparison
|
||||||
|
legend('Numerical Solution', 'Exact Solution', 'Location', 'Best');
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -13,4 +13,4 @@ B:
|
||||||
C:
|
C:
|
||||||
* r-adaptivity
|
* r-adaptivity
|
||||||
looks suspicious, but similar to Mandl
|
looks suspicious, but similar to Mandl
|
||||||
|
cumsum in r_adapt() not correct, but exact cumsum results in wrong solution behavior
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ N = length(x);
|
||||||
w = abs(eta_elem) + 1e-10; %error based monitor function
|
w = abs(eta_elem) + 1e-10; %error based monitor function
|
||||||
s = zeros(N,1);
|
s = zeros(N,1);
|
||||||
for i = 2:N
|
for i = 2:N
|
||||||
s(i) = s(i-1) + w(i-1); %cumulative sum
|
s(i) = s(i-1) + w(i-1); %cumulative sum % LP
|
||||||
|
% s(i) = s(i-1) + w(i); %cumulative sum % GH
|
||||||
end
|
end
|
||||||
s = s / s(end); % normalize to [0,1]
|
s = s / s(end); % normalize to [0,1]
|
||||||
s_new = linspace(0,1,N)';
|
s_new = linspace(0,1,N)';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue