function plot_sim(T, mode, nth)
%PLOT_SIM Show movie of simulation
% mode 'mov' ... show movie
% mode 'plot' ... show plot
if nargin < 3
    nth = 1;
end
if strcmp(mode, 'mov')
    figure(1); hold on;
    for i = 1:nth:length(T.t)
        cla; xlim([-T.a-1, -T.a+3]); ylim([0, 1]);
        ax = gca;
        ax.FontSize = 16;
        xlabel('position'); ylabel('volume fraction');
        plot(T.x, T.phi_tot(T.x, T.a, T.b, T.e, T.u0), 'LineWidth', 2, ...
            'LineStyle', '--');
        plot(T.x, T.sol(i, :), 'LineWidth', 2);
        text(abs(-T.a+2), 0.7, num2str(T.t(i)));
        shg
        pause();
    %     print([num2str(i),'.png'],'-dpng')
    end
elseif strcmp(mode, 'plot')
    figure; hold on;
    xlim([0, 2]); ylim([0, 1]);
    ax = gca;
    ax.FontSize = 26;
    xlabel('x [\mum]'); ylabel('volume fraction'); 
    plot(T.x, T.sol(1:nth:150, :), 'LineWidth', 4, 'Color', [0.5294, 0.8, 0.98]);
    plot(T.x, Ternary_model.phi_tot(T.x, T.a, T.b, T.e, T.u0), 'LineWidth', 6,...
    'LineStyle', '--', 'Color', [0.97, 0.55, 0.03]);
end
end

