-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestCircA01.m
34 lines (28 loc) · 869 Bytes
/
testCircA01.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
clc
clear
close all
filename = './circle/circA01curved';
%
% phi = @(x,y) 1-exp(-(sqrt(x^2+y^2)-1)^2);
% gradPhi = @(x,y) [2*exp(-(-1+sqrt(x^2+y^2))^2)*x*(-1+sqrt(x^2+y^2)),...
% 2*exp(-(-1+sqrt(x^2+y^2))^2)*y*(-1+sqrt(x^2+y^2))]/sqrt(x^2+y^2);
% heatGen = @(x,y) exp(-(sqrt(x^2+y^2)-1)^2)*(-4*x^2*(sqrt(x^2+y^2)-2)-4*y^2*(sqrt(x^2+y^2)-2)-2)/sqrt(x^2+y^2);
phi = @(x,y) -(1-sqrt(x^2+y^2));
gradPhi = @(x,y) [x,y]/sqrt(x^2+y^2);
heatGen = @(x,y) -1/sqrt(x^2+y^2);
BC = 0;
D = eye(2);
heat2d(filename,heatGen,BC,D);
% Calculating the residual.
nref = 3;
[L2, H1] = calcNorm(filename,phi,gradPhi);
h = zeros(1,nref+1);
h(1) = 1;
% Refinement
for i = 1:nref
h(i+1) = h(i)/2;
refineMesh(filename);
filename = [filename,'ref']; %#ok<AGROW>
heat2d(filename,heatGen,BC,D);
[L2(i+1), H1(i+1)] = calcNorm(filename,phi,gradPhi);
end