%
% @file ppde3d.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 .
%
% @authors
% (in alphabetical order)
% @author Trach-Minh Tran
%
file='ppde3d.h5';
%
% Get data from data sets
%
x=hdf5read(file,'/xgrid');
y=hdf5read(file,'/ygrid');
z=hdf5read(file,'/zgrid');
%
nx=size(x);
ny=size(y);
nz=size(z);
%
sol=hdf5read(file,'/sol');
solexact=hdf5read(file,'/solana');
solx=hdf5read(file,'/derivx');
soly=hdf5read(file,'/derivy');
solz=hdf5read(file,'/derivz');
solx_exact=hdf5read(file,'/derivx_exact');
soly_exact=hdf5read(file,'/derivy_exact');
solz_exact=hdf5read(file,'/derivz_exact');
figure
k=ceil(nz(1)/2);
subplot(311);
pcolor(x,y,sol(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Caculated solution')
colorbar
subplot(312);
pcolor(x,y,solexact(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Analytical solution')
colorbar
subplot(313);
err=sol-solexact;
pcolor(x,y,err(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Discretization error')
colorbar
figure
subplot(311);
pcolor(x,y,solx(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Caculated d/dx')
colorbar
subplot(312);
pcolor(x,y,solx_exact(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Analytical d/dx')
colorbar
subplot(313);
err=solx-solx_exact;
pcolor(x,y,err(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Discretization error')
colorbar
figure
k=ceil(nz(1)/2);
subplot(311);
pcolor(x,y,soly(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Caculated d/dy')
colorbar
subplot(312);
pcolor(x,y,soly_exact(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Analytical d/dy')
colorbar
subplot(313);
err=soly-soly_exact;
pcolor(x,y,err(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Discretization error')
colorbar
figure
k=ceil(nz(1)/6);
subplot(311);
pcolor(x,y,solz(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Caculated d/dz')
colorbar
subplot(312);
pcolor(x,y,solz_exact(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Analytical d/dz')
colorbar
subplot(313);
err=solz-solz_exact;
pcolor(x,y,err(:,:,k)');
shading interp
xlabel('x'); ylabel('y')
title('Discretization error')
colorbar
figure
i=ceil(nx(1)/2);
plot(z, squeeze(sol(i,1,:)), 'o', z, squeeze(solexact(i,1,:)),'r')
xlabel('z');