% % @file pde2d_sym_pardiso.m % % @brief % % @copyright % Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) % SPC (Swiss Plasma Center) % % SPClibs is free software: you can redistribute it and/or modify it under % the terms of the GNU Lesser General Public License as published by the Free % Software Foundation, either version 3 of the License, or (at your option) % any later version. % % SPClibs is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. % % You should have received a copy of the GNU Lesser General Public License % along with this program. If not, see . % % @author % (in alphabetical order) % @author Trach-Minh Tran % file='pde2d_sym_pardiso.h5'; % % Get data from data sets % r=hdf5read(file,'/xgrid'); t=hdf5read(file,'/ygrid'); sol=hdf5read(file,'/sol')'; solexact=hdf5read(file,'/solana')'; err=hdf5read(file,'/errors')'; solr=hdf5read(file,'/derivx')'; solt=hdf5read(file,'/derivy')'; % % Attributes % if verLessThan('matlab', '7.9'); NR=hdf5read(file,'/NX'); NTH=hdf5read(file,'/NY'); NIDBAS1=hdf5read(file,'/NIDBAS1'); NIDBAS2=hdf5read(file,'/NIDBAS2'); MBESS=hdf5read(file,'/MBESS'); EPSI=hdf5read(file,'/EPSI'); attr=hdf5read(file,'/xgrid/title'); x_ann=attr.Data; attr=hdf5read(file,'/ygrid/title'); y_ann=attr.Data; attr=hdf5read(file,'/sol/title'); sol_ann=attr.Data; attr=hdf5read(file,'/solana/title'); solexact_ann=attr.Data; attr=hdf5read(file,'/errors/title');err_ann=attr.Data; else NR=hdf5read(file,'/','NX'); NTH=hdf5read(file,'/','NY'); NIDBAS1=hdf5read(file,'/','NIDBAS1'); NIDBAS2=hdf5read(file,'/','NIDBAS2'); MBESS=hdf5read(file,'/','MBESS'); EPSI=hdf5read(file,'/','EPSI'); attr=hdf5read(file,'/xgrid/','title'); x_ann=attr.Data; attr=hdf5read(file,'/ygrid/','title'); y_ann=attr.Data; attr=hdf5read(file,'/sol/','title'); sol_ann=attr.Data; attr=hdf5read(file,'/solana/','title'); solexact_ann=attr.Data; attr=hdf5read(file,'/errors/','title');err_ann=attr.Data; end LABEL=sprintf('nr = %d, ntheta = %d, nidbas = (%d,%d), mbess = %d, epsi = %3.2f', ... NR, NTH, NIDBAS1, NIDBAS2, MBESS, EPSI); [R,T]=meshgrid(r,t); x = R.*cos(T); y= R.*sin(T); solx = cos(T).*solr - sin(T)./R.*solt; soly = sin(T).*solr + cos(T)./R.*solt; figure subplot(221) pcolor(double(r),double(t),double(sol)); shading interp hold on, quiver(r,t,solr,solt) xlabel(x_ann); ylabel(y_ann) title(LABEL) colorbar subplot(222) pcolor(double(x),double(y),double(sol)) shading interp hold on, quiver(x,y,solx,soly) hold off, axis image xlabel('X'); ylabel('Y') title('X-Y plane') colorbar subplot(223) surfc(double(x),double(y),double(sol)) xlabel('X'); ylabel('Y'); title(sol_ann) subplot(224) surfc(double(x),double(y),double(err)) xlabel('X'); ylabel('Y'); title(err_ann) if verLessThan('matlab', '7.9'); n = hdf5read(file,'/MAT/RANK'); nnz = hdf5read(file,'/MAT/NNZ'); nlsym = hdf5read(file,'/MAT/NLSYM'); else n = hdf5read(file,'/MAT/', 'RANK'); nnz = hdf5read(file,'/MAT/', 'NNZ'); nlsym = hdf5read(file,'/MAT/', 'NLSYM'); end cols=hdf5read(file, '/MAT/cols'); irow=hdf5read(file, '/MAT/irow'); val=hdf5read(file, '/MAT/val'); perm=hdf5read(file, '/MAT/perm'); rows = zeros(nnz,1); cols=double(cols); irow=double(irow); perm=double(perm); for i=1:n s = irow(i); e = irow(i+1)-1; rows(s:e) = i; end mat = sparse(rows,cols,val); figure subplot(121) spy(mat) title('Original Matrix structure') subplot(122) spy(mat(perm,perm)) title('Permuted Matrix structure')