Accelerating PDE-Solving with Parallel Computing Toolbox
조회 수: 23 (최근 30일)
이전 댓글 표시
Hello
Can I accelerate 2D- or 3D FEM thermal Simulation in the PDE-Toolbox by using Parallel Computing Toolbox?
Can I accelerate meshing or solving with solvepde or parabolic by using Parallel Computing Toolbox?
Provided of course that appropriate Hardware is available.
Thank you in advance.
MJ
댓글 수: 0
채택된 답변
Ravi Kumar
2018년 6월 8일
Hello Marion,
The solvers such as solvepde or parabolic are not parallel solvers, so you won't be able to speedup using Parallel Computing Toolbox. However, you can user Parallel Computing Toolbox and do a parameter sweeps as shown in the examples at these links:
In addition, on multicore computers the linear solver (mldivide or "\n"), so you will be able to speed up the simulation on a multicore machine.
Regards,
Ravi
댓글 수: 1
Alex Degeling
2023년 12월 27일
편집: Alex Degeling
2024년 2월 25일
What about if you use domain decomposition? There used to be an example demo that uses the Schur complement with several sub-domains in an earlier version of the pde toolbox. The idea was that organizing the 2d mesh into several subdomains allows the matrix K (where u = K\F is the discretized pde system to be solved) to be organized as something like K = [K_n,B_n;B_n^T,C] (with n=1:N, where N is the number of sub-domains), where the matrix of K_n's is block diagonal, with each block representing the coupling between interior nodes within each subdomain, the B_n's represent the coupling for nodes lying on a subdomain edge i.e. between 2 sudomains, and C represents the coupling for nodes common to more than 2 subdomains. The same decomposition is applied to u and F: u = [u_n's;u_c] and F = [F_n's;F_c]. The general idea is to use the Schur complement to eliminate the u_n's and solve the resulting equation for u_c, then use this to solve for the u_n's. The solution for u_c involves calculations of B_n^T*(K_n)^-1 *B_n for each subdomain which, being independent from one-another, should be parallizable... You could alternatively parallelize the calculation of the K_n\B_n calculations by running a parfor loop over the columns of each B_n... e.g. something like:
iKBn = zeros(size(B_n));
parfor j = 1:size(B_n,2), iKBn(:,j) = K_n\B_n(:,j);end
a_n = B_n'*iKBn;
For reference on the domain decomposition method, the following code is from pdedemo4 of the Matlab R14 PDE Toolbox (see below), for the usual L-shaped domain, split into 3 subdomains. Surely some of these steps could be run in parallel using the parallel computing toolbox!
[p,e,t]=initmesh('lshapeg');
[p,e,t]=refinemesh('lshapeg',p,e,t);
[p,e,t]=refinemesh('lshapeg',p,e,t);
time=[];
np=size(p,2);
% Find common points
c=pdesdp(p,e,t);
nc=length(c);
C=zeros(nc,nc);
FC=zeros(nc,1);
[i1,c1]=pdesdp(p,e,t,1);ic1=pdesubix(c,c1);
[K,F]=assempde('lshapeb',p,e,t,1,0,1,time,1);
K1=K(i1,i1);d=symamd(K1);i1=i1(d);
K1=chol(K1(d,d));
B1=K(c1,i1);a1=B1/K1;
C(ic1,ic1)=C(ic1,ic1)+K(c1,c1)-a1*a1';
f1=F(i1);e1=K1'\f1;
FC(ic1)=FC(ic1)+F(c1)-a1*e1;
[i2,c2]=pdesdp(p,e,t,2);ic2=pdesubix(c,c2);
[K,F]=assempde('lshapeb',p,e,t,1,0,1,time,2);
K2=K(i2,i2);d=symamd(K2);i2=i2(d);
K2=chol(K2(d,d));B2=K(c2,i2);a2=B2/K2;
C(ic2,ic2)=C(ic2,ic2)+K(c2,c2)-a2*a2';
f2=F(i2);e2=K2'\f2;FC(ic2)=FC(ic2)+F(c2)-a2*e2;
[i3,c3]=pdesdp(p,e,t,3);ic3=pdesubix(c,c3);
[K,F]=assempde('lshapeb',p,e,t,1,0,1,time,3);
K3=K(i3,i3);d=symamd(K3);i3=i3(d);
K3=chol(K3(d,d));B3=K(c3,i3);a3=B3/K3;
C(ic3,ic3)=C(ic3,ic3)+K(c3,c3)-a3*a3';
f3=F(i3);e3=K3'\f3;FC(ic3)=FC(ic3)+F(c3)-a3*e3;
% Solve
u=zeros(np,1);
u(c)=C\ FC;
u(i1)=K1\(e1-a1'*u(c1));
u(i2)=K2\(e2-a2'*u(c2));
u(i3)=K3\(e3-a3'*u(c3));
추가 답변 (1개)
Precise Simulation
2018년 6월 8일
If you are thinking about doing parametric studies (multiple simulation runs with different parameters or geometry/mesh variations) you can also use xargs on Linux systems to run FEM and PDE simulations in parallel even without the Parallel Toolbox.
Alternatively, you could possibly use FEniCS as FEM solver which does support parallel linear solvers such as PetSc.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 General PDEs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!