Skip to content
Snippets Groups Projects
Commit 6176e3d6 authored by Lars Hubatsch's avatar Lars Hubatsch
Browse files

Adding plot for PKS retreat.

parent d091f4b5
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ x = [linspace(-a-1, g_inv(2), 30), g_inv(3:end-2), ...
linspace(g_inv(end-1), -a+1, 30), linspace(-a+1.1, 300, 300)];
%% Solve pde
tic
t = linspace(0.001, 0.5, 250);
t = linspace(0, 50, 250);
fh_ic = @(x) flory_ic(x, a, u0);
fh_bc = @(xl, ul, xr, ur, t) flory_bc(xl, ul, xr, ur, t, u0);
fh_pde = @(x, t, u, dudx) flory_hugg_pde(x, t, u, dudx, a, b, e, c, u0,...
......@@ -38,8 +38,9 @@ for i = 1:length(t)
ax.FontSize = 16;
xlabel('position'); ylabel('volume fraction');
plot(x, phi_tot(x, a, b, e, u0), 'LineWidth', 2, 'LineStyle', '--');
plot(x, sol(i, :), 'LineWidth', 2); pause();
% % print([num2str(i),'.png'],'-dpng')
plot(x, sol(i, :), 'LineWidth', 2);
% pause();
print([num2str(i),'.png'],'-dpng')
end
%% Figures
% Time course
......@@ -59,8 +60,24 @@ plot(x, phi_tot(x, a, b, e, u0));
plot(x, gradient_analytical(x, a, b, e));
plot(x(1:end-1)+mean(diff(x))/2, ...
diff(phi_tot(x, a, b, e, u0)/mean(diff(x))));
plot(x, gamma0(x, a, b, e));
figure; plot(gamma0(x, a, b, e), spacing(gamma0(x, a, b, e), a, b, e));
plot(x, gamma0(x, a, b, e_g0, o_g0));
figure;
plot(gamma0(x, a, b, e_g0, o_g0),...
spacing(gamma0(x, a, b, e_g0, o_g0), a, b, e_g0, o_g0));
%% Fit with experimental BCs
s = sol(1:end, 1:30)./max(sol(1:end, 1:30))/1.022;
ts = t(1:end)';
f_min = @(x) to_minimize(s, ts, x, 'simple_drop', s(:, end));
opt = optimset('MaxFunEvals', 2000, 'PlotFcns',@optimplotfval);
x_seed = fminsearch(f_min, x_seed, opt);
%%
[cost, v_fit, r_n, v_fit_end] = to_minimize(s, ts, x_seed, 'simple_drop', s(:, end));
%% Plot for
figure; hold on;
plot(s(1:2:100, :)', 'Color', [0.12156 0.4666666 0.7058823], 'LineWidth', 1.5);
% plot(v_fit(1:2:100, :)', '--', 'Color', [1. 0.49803 0.0549], 'LineWidth', 1.5);
make_graph_pretty('$x [\mu m]$', 'intensity [a.u.]', '');
print('Timecourse_model_only.png','-dpng')
%% Function definitions for pde solver
function [c, f ,s] = flory_hugg_pde(x, t, u, dudx, a, b, e, c_p, u0,...
e_g0, o_g0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment