Main Content

유한 차분 라플라시안(Finite Difference Laplacian)

이 예제에서는 L 모양 영역에서 유한 차분 라플라시안(Finite Difference Laplacian)을 계산하고 나타내는 방법을 보여줍니다.

영역

numgrid 함수는 L 모양 영역 내에 있는 점에 번호를 매깁니다. spy 함수는 행렬에서 0이 아닌 요소로 구성된 패턴을 시각화하는 데 유용한 툴입니다. 이 두 함수를 사용하여 L 모양 영역을 생성하고 표시해 보겠습니다.

n = 32;
R = 'L';
G = numgrid(R,n);
spy(G)
title('A Finite Difference Grid')

Figure contains an axes object. The axes object with title A Finite Difference Grid, xlabel nz = 675 contains a line object which displays its values using only markers.

이 행렬의 더 작은 버전을 샘플로 표시합니다.

g = numgrid(R,10)
g = 10×10

     0     0     0     0     0     0     0     0     0     0
     0     1     5     9    13    17    25    33    41     0
     0     2     6    10    14    18    26    34    42     0
     0     3     7    11    15    19    27    35    43     0
     0     4     8    12    16    20    28    36    44     0
     0     0     0     0     0    21    29    37    45     0
     0     0     0     0     0    22    30    38    46     0
     0     0     0     0     0    23    31    39    47     0
     0     0     0     0     0    24    32    40    48     0
     0     0     0     0     0     0     0     0     0     0

이산 라플라시안(Discrete Laplacian)

delsq를 사용하여 이산 라플라시안(Discrete Laplacian)을 생성합니다. spy 함수를 다시 사용하여 행렬 요소를 시각화합니다.

D = delsq(G);
spy(D)
title('The 5-Point Laplacian')

Figure contains an axes object. The axes object with title The 5-Point Laplacian, xlabel nz = 3255 contains a line object which displays its values using only markers.

내점 개수를 확인합니다.

N = sum(G(:)>0)
N = 675

디리클레 경계값 문제(Dirichlet Boundary Value Problem)

희소 선형 시스템의 디리클레 경계값 문제(Dirichlet Boundary Value Problem)를 풀어 보겠습니다. 문제 설정은 다음과 같습니다.

내부에서는 delsq(u) = 1, 경계에서는 u = 0.

rhs = ones(N,1);
if (R == 'N') % For nested dissection, turn off minimum degree ordering.
   spparms('autommd',0)
   u = D\rhs;
   spparms('autommd',1)
else
   u = D\rhs; % This is used for R=='L' as in this example
end

해를 L 모양 그리드에 매핑하고 등고선 지도로 플로팅합니다.

U = G;
U(G>0) = full(u(G(G>0)));
clabel(contour(U));
prism
axis square ij

Figure contains an axes object. The axes object contains 15 objects of type contour, line, text.

이제 해를 메시 플롯으로 표시합니다.

mesh(U)
axis([0 n 0 n 0 max(max(U))])
axis square ij

Figure contains an axes object. The axes object contains an object of type surface.

참고 항목