ファイル:Finite_element_triangulation.svg
[Wikipedia|▼Menu]

ファイル

ファイルの履歴

ファイルの使用状況

グローバルなファイル使用状況
この SVG ファイルのこの PNG プレビューのサイズ: 600 × 600 ピクセル. その他の解像度: 240 × 240 ピクセル 。480 × 480 ピクセル 。768 × 768 ピクセル 。1,024 × 1,024 ピクセル 。2,048 × 2,048 ピクセル 。815 × 815 ピクセル。

元のファイル ‎(SVG ファイル、815 × 815 ピクセル、ファイルサイズ: 207キロバイト)



このファイルは、ウィキメディア・コモンズから呼び出されています。

このファイルは、他のプロジェクトで使用されている可能性があります。

このファイルの解説やノートへの記入、履歴などの詳細の確認は、ウィキメディア・コモンズのファイルページ(ノート/履歴/ログ)を使用してください。
ウィキメディア・コモンズのファイルページにある説明を、以下に表示します。

解説Finite element triangulation.svgIllustration of the en:Finite element method, the triangulation of the domain.
日付2007年6月15日, 02:18 (UTC)
原典self-made, with en:Matlab
作者Oleg Alexandrov

Public domainPublic domainfalsefalse

この著作物の著作権者である私は、この著作物における権利を放棄しパブリックドメインとします。これは全世界で適用されます。
一部の国では、これが法的に可能ではない場合があります。その場合は、次のように宣言します。
私は、あらゆる人に対して、法により必要とされている条件を除き、如何なる条件も課すことなく、あらゆる目的のためにこの著作物を使用する権利を与えます。
Source code (MATLAB)

The triangulation used in this code and shown above is created with the ⇒Triangle mesh generator. % Solve the problem -\Delta u + c*u = f with Dirichlet boundary conditions.% The domain is the disk centered at the origin of radius 1.% Its triangulation is read from the end of this file.function main() c=0; % a parameter in the equation, see above white=0.99*[1, 1, 1]; blue = [0, 129, 205]/256; green = [0, 200, 70]/256; % load the triangulation from the end of the file. dummy_arg=0; P=get_points(dummy_arg); T=get_triangles(dummy_arg);% find the number of points and the number of triangles [Np, k]=size(P); [Nt, k]=size(T); Nb = 30; % first Nb points in P are on the boundary% plot the triangulation lw = 1.4; figure(1); clf; hold on; axis equal; axis off; for l=1:Nt i=T(l, 1); j=T(l, 2); k=T(l, 3); % plot the three edges in each triangle plot([P(i, 1), P(j, 1)], [P(i, 2), P(j, 2)], 'linewidth', lw, 'color', blue) plot([P(i, 1), P(k, 1)], [P(i, 2), P(k, 2)], 'linewidth', lw, 'color', blue) plot([P(j, 1), P(k, 1)], [P(j, 2), P(k, 2)], 'linewidth', lw, 'color', blue) end% a hack to deal with bounding box issues s=1.05; plot(-s, -s, '*', 'color', white); plot(s, s, '*', 'color', white); % save as eps and svg (needs the plot2svg function) saveas(gcf, 'triangulation.eps', 'psc2') % plot2svg('Finite_element_triangulation.svg'); % right-hand side% f=inline ('5-x.^2-y.^2', 'x', 'y'); f=inline ('4+0*x.^2+0*y.^2', 'x', 'y');% the values of f at the nodes in the triangulation F = f(P(:, 1), P(:, 2)); RHS = 0*F; RHS = RHS((Nb+1):Np); % will solve A*U=RHS% an empty sparse matrix of size Np by Np A = sparse(Np-Nb, Np-Nb); % iterate through triangles for l=1:Nt% fill in the matrix i=T(l, 1); j=T(l, 2); k=T(l, 3); [pii, pij, pik, pjj, pjk, pkk, gii, gij, gik, gjj, gjk, gkk] = calc_elems (i, j, k, P(i, :), P(j, :), P(k, :));% One has to consider the cases when a given vertex is on the boundary, or not.% If yes, it can't be included in the matrix if i > Nb A(i-Nb, i-Nb) = A(i-Nb, i-Nb) + gii + c*pii; end if i > Nb & j > Nb A(i-Nb, j-Nb) = A(i-Nb, j-Nb) + gij + c*pij; A(j-Nb, i-Nb) = A(i-Nb, j-Nb); end if i > Nb & k > Nb A(i-Nb, k-Nb) = A(i-Nb, k-Nb) + gik + c*pik; A(k-Nb, i-Nb) = A(i-Nb, k-Nb); end if j > Nb A(j-Nb, j-Nb) = A(j-Nb, j-Nb) + gjj + c*pjj; end if j > Nb & k > Nb A(j-Nb, k-Nb) = A(j-Nb, k-Nb) + gjk + c*pjk; A(k-Nb, j-Nb) = A(j-Nb, k-Nb); end if k > Nb A(k-Nb, k-Nb) = A(k-Nb, k-Nb) + gkk + c*pkk; end% add the appropriate contributions to the right-hand terms if i > Nb RHS(i-Nb) = RHS(i-Nb) + F(i)*pii + F(j)*pij + F(k)*pik; end if j > Nb RHS(j-Nb) = RHS(j-Nb) + F(i)*pij + F(j)*pjj + F(k)*pjk; end if k > Nb RHS(k-Nb) = RHS(k-Nb) + F(i)*pik + F(j)*pjk + F(k)*pkk; end end% plot the sparse matrix (more exactly, its sign, then it is easier to see the pattern) figure(6); imagesc(sign(abs(A))); colormap (1-gray); axis ij; axis equal; axis off;% save as eps and svg (needs the plot2svg function) saveas(gcf, 'sparse_dirichlet.eps', 'psc2')% plot2svg('Finite_element_sparse_matrix.svg');% calculate U, then add zeros for the points on the boundary U_calc = A\RHS; U_calc = [0*(1:Nb) U_calc']';% exact solution u = inline('1-x.^2-y.^2', 'x', 'y'); U_exact = u(P(:, 1), P(:, 2));% plot the computed solution figure(2); clf; plot_solution(T, P, U_calc, lw, green)% save as eps and svg (needs the plot2svg function) saveas(gcf, 'computed_dirichlet.eps', 'psc2')% plot2svg('Finite_element_solution.svg'); % plot the exact solution% figure(3); clf; % plot_solution(T, P, U_exact)% title('Exact Dirichlet solution')% saveas(gcf, 'exact_dirichlet.eps', 'psc2') disp(sprintf('Error between exact solution and computed solution is %0.9g', max(abs(U_exact-U_calc)))) % given the l-th triangle, calculate the integrals% pij = int_K(lambda_i*lambda_j) and gij = int_K(grad lambda_i dot grad lambda_j)function [pii, pij, pik, pjj, pjk, pkk, gii, gij, gik, gjj, gjk, gkk] = calc_elems (i, j, k, P1, P2, P3)% extract the x and y coordinates of the points x1 = P1(1); y1 = P1(2); x2 = P2(1); y2 = P2(2); x3 = P3(1); y3 = P3(2);% triangle area AT = abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2;% the integrals of lambda_i*lambda_j pii = AT/6; pij = AT/12; pik = AT/12; pjj = AT/6; pjk = AT/12; pkk = AT/6; % the integrals of grad lambda_i dot grad lambda_j gii = ((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))/(4*AT); gjj = ((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3))/(4*AT); gkk = ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/(4*AT); gij = -((x3-x1)*(x3-x2)+(y3-y1)*(y3-y2))/(4*AT); gik = -((x2-x1)*(x2-x3)+(y2-y1)*(y2-y3))/(4*AT); gjk = -((x1-x2)*(x1-x3)+(y1-y2)*(y1-y3))/(4*AT);function plot_solution (T, P, U, lw, color, fs) [Np, k]=size(P); [Nt, k]=size(T);% create a path in 3D that will trace the outline of the solution X=zeros(5*Nt, 1); Y=zeros(5*Nt, 1); Z=zeros(5*Nt, 1); for l=1:Nt i=T(l, 1); j=T(l, 2); k=T(l, 3); m = 5*l-4; X(m) = P(i, 1); Y(m) = P(i, 2); Z(m) = U(i); X(m+1) = P(j, 1); Y(m+1) = P(j, 2); Z(m+1) = U(j); X(m+2) = P(k, 1); Y(m+2) = P(k, 2); Z(m+2) = U(k); X(m+3) = P(i, 1); Y(m+3) = P(i, 2); Z(m+3) = U(i); X(m+4) = NaN; Y(m+4) = NaN; Z(m+4) = NaN; end% plot the solution plot3(X, Y, Z, 'linewidth', lw, 'color', color) set(gca, 'fontsize', 15) function P=get_points(dummy_arg) P=[1 00.97799999999999998 0.207999999999999990.91400000000000003 0.406999999999999970.80900000000000005 0.587999999999999970.66900000000000004 0.742999999999999990.5 0.865999999999999990.309 0.950999999999999960.105 0.995-0.105 0.995-0.309 0.95099999999999996-0.5 0.86599999999999999-0.66900000000000004 0.74299999999999999-0.80900000000000005 0.58799999999999997-0.91400000000000003 0.40699999999999997-0.97799999999999998 0.20799999999999999-1 5.6700000000000004e-16-0.97799999999999998 -0.20799999999999999-0.91400000000000003 -0.40699999999999997-0.80900000000000005 -0.58799999999999997-0.66900000000000004 -0.74299999999999999-0.5 -0.86599999999999999-0.309 -0.95099999999999996-0.105 -0.9950.105 -0.9950.309 -0.950999999999999960.5 -0.865999999999999990.66900000000000004 -0.742999999999999990.80900000000000005 -0.587999999999999970.91400000000000003 -0.406999999999999970.97799999999999998 -0.207999999999999992.6291902682773483e-17 -0.00065384615384583118-0.29530436727611131 -0.407149903005388670.20468717553848803 -0.459508829739425810.5000339709144086 -0.0522824392313316210.2044416534667938 0.45895712720185405-0.37389783786652392 0.33573030516976354-0.56520453690073769 -0.0591754798645009040.55140920581395014 0.3176130751959379-0.13138695201728712 0.62243041389833154-0.1444609125190702 -0.683046048952053010.51896266786078527 -0.46675660322909635-0.67677962425194449 0.22091656257348974-0.61723328415727241 -0.355798314013887280.15396059620050356 -0.72709003692960750.73917109220890242 0.077575788599018480.70634528325694623 -0.230425116223339530.15390386456341718 0.726827008430388940.43656290869075642 0.60123684202225869-0.43638925515227728 0.60099824488402309-0.44644144213994863 -0.6148097863548887-0.78986314125549695 -0.0829374476327926770.48306021940714738 -0.66512339089274719-0.71711649590963977 0.41374161364923850.7196608156574994 0.41521760024330068-0.17239398182683685 0.812553915742607380.83205471084583948 -0.0874000174933099450.3403176445451454 0.76427847186026787-0.55164668399041139 0.34772453168234385-0.58119856273351911 0.5140347159468972-4.3977950621443274e-18 -0.837382469604903370.72531999275454517 -0.41850054828302335-0.34213203269662834 -0.76835550876536474-0.62483523734501689 -0.562383440182595780.56491731978950166 0.488146785922156210.38917253432269977 0.41806537561109980.23717545979432902 0.16912185462803336-0.02596228168575496 0.286169353657331540.3938288333314971 0.244348311961457930.5426706476687696 0.130311242657956930.38005096874664096 0.072009078853487340.24522905811277632 -0.178196962665235210.22329825233727255 -0.0049527105560499022-0.018125285606249857 -0.28382039345137922-0.25412870038086932 -0.1265506189486573-0.22001244253386174 0.124017969188261430.70594582936521699 0.24504049798687536-0.28923932941907254 0.68786790036032985-0.27673116940573905 0.49861546727758305-0.19580411520445754 0.33991543187901008-0.06480669781759768 0.458647757989873510.039811209497243899 0.59660089503236968-0.012452577623367307 0.75748185020432790.36004239628137363 -0.54042597822871430.3198317338457855 -0.703124164916731240.2617529370159869 0.318663722485640730.11364902800796572 0.34001459209079515-0.80612573707151369 -0.26251531242500947-0.84358781498716018 0.088619865046719065-0.44904385214632619 0.458022307876681520.35347968445219013 -0.0764834061563727660.43529169673866364 -0.272014120989298390.33966312039894614 -0.38995864108359496-0.44160050993872146 0.124737089769562650.22042251667383625 -0.601090686607012480.01773990267719644 -0.551951399569512670.57741967278428696 0.631721212662533450.83616296331029605 0.18384745602550973-0.42194773652236522 0.74460017792571787-0.15191200145175998 -0.50793571011947636-0.28468886832575607 -0.60129916940148143-0.15211412155416426 -0.355825083579045190.091328532274082594 0.853961344045157440.25268219760086502 -0.82436443072803334-0.56522176794370282 0.65147861937265739-0.17960003622540516 -0.845963804317787620.64262958611925292 -0.57845575520448644-0.82977670051153962 0.27012165242582176-0.75613161550480157 -0.436374694077371010.84682787874323973 -0.275605448440036930.66460522715024917 -0.0702268963894364250.27135187110185849 0.61028308052190072-0.5291687129171514 -0.72847571124389077-0.46589500975993081 -0.44182174455360729-0.44717423342713147 -0.23275286852251509-0.91658877313709719 -0.0963411202356542350.071238170548373975 0.15038100559175938-0.07537518167909911 0.148115108318487010.14411045609387388 -0.307201356571660030.046251548820153726 -0.411673517544628780.080240926729569728 -0.1479533766093776-0.090696855217268765 -0.13701177299039563-0.14601986575596898 -0.0018723983808613188-0.65587042533541751 -0.19614678101972682-0.68222829844326438 0.0564770016520156070.5820334614227094 -0.324312452746667420.56939947784766054 -0.17974699975143729-0.33054333836607347 0.20546019299713006-0.54252415463210835 0.21357850028719924-0.397822414790862 -0.038177513011169929-0.0015128273166917471 -0.69402163173758880.12814058587287039 -0.86580177941165415-0.30513569295646459 -0.26238649633237193];function T = get_triangles (dummy_arg) T=[51 87 1233 54 7624 60 2320 63 1921 112 2036 89 58105 22 2337 123 114108 18 1920 112 6344 94 9525 103 13130 109 29115 88 1662 50 11288 15 1614 15 10753 13 1427 106 5247 81 11197 1 217 115 1613 53 59118 73 119104 98 1175 93 12952 84 2669 110 4527 52 2634 90 9129 109 6128 106 2756 30 124 131 6033 94 83104 11 1279 80 7838 68 6995 40 1301 45 5614 107 5348 6 577 8 10282 102 968 65 859 10 556 96 596 6 4887 51 11565 48 111101 74 1324 54 376 97 3117 116 6738 65 68100 50 62124 93 12890 70 72126 91 12529 61 2882 9 5547 82 816 7 5748 65 6477 49 7849 89 7821 22 6250 100 11317 18 8737 93 12483 52 4152 83 8458 53 4253 58 595 96 476 54 3811 98 1039 81 82110 56 45109 56 467 47 57111 57 47128 58 4236 78 8949 104 5959 104 13130 44 95105 60 40125 61 46106 61 41105 62 22100 62 40113 63 50108 63 4338 54 6464 54 485 86 6638 64 6592 33 8368 66 7080 39 7874 121 12285 65 3568 70 69110 69 3476 69 4572 71 9034 69 7072 70 66118 120 73116 72 66120 72 31101 121 74100 32 113117 31 116114 43 11375 117 7993 75 12769 76 3897 76 4539 55 7777 55 1079 78 3639 77 7879 36 12779 67 8086 80 6735 111 8139 80 8181 80 86102 82 4739 82 5592 41 9183 94 8444 103 8484 103 2686 85 3566 68 8586 35 8186 67 116108 87 18123 87 43124 51 37107 88 4249 59 8958 89 5991 90 7170 90 3471 118 9291 41 12541 92 8371 92 9136 58 128129 93 3794 33 9544 84 94119 33 118119 99 9548 64 964 96 641 97 453 97 249 77 9810 98 7740 95 99119 101 9940 99 10032 100 99101 73 12132 99 1017 102 479 102 844 60 13126 103 2598 104 4913 104 1260 105 2362 105 4061 106 2852 106 4188 107 1553 107 4263 108 1987 108 4356 109 3061 109 46126 110 3456 110 4665 111 3557 111 4862 112 2163 112 50114 32 13263 113 4332 114 113129 114 7487 115 1788 115 5172 116 3186 116 6679 117 67117 75 12292 118 33120 118 71101 119 7333 119 9572 120 71121 120 31120 121 73122 121 31117 122 31122 75 129114 123 4351 123 3742 88 12451 124 8861 125 4146 110 12691 126 3446 126 12579 127 75128 127 36124 128 42128 93 127114 129 37129 74 12240 60 13044 130 6025 131 2444 131 103101 132 3274 114 132];


次ページ
記事の検索
おまかせリスト
▼オプションを表示
ブックマーク登録
mixiチェック!
Twitterに投稿
オプション/リンク一覧
話題のニュース
列車運行情報
暇つぶしWikipedia

Size:22 KB
出典: フリー百科事典『ウィキペディア(Wikipedia)
担当:undef