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

Revert "Changing plots order."

This reverts commit 9e00834c.
parent 9e00834c
No related branches found
No related tags found
No related merge requests found
......@@ -2,59 +2,17 @@
% Define parameters for tanh, according to Weber, Zwicker, Julicher, Lee.
b = @(chi, nu) nu^(1/3)*sqrt(chi/(chi-2));
e = @(chi) sqrt(3/8*(chi-2));
t = [0, 0.01, 0.05, 50];
t = [0, 0.1, 1, 9.9];
%% Try out different precisions
% prec = [0.5, 0.5, 1, 2, 3.5, 5];
fac = [1, 5, 10];%, 10, 100];
for i = 1:length(fac)
prec = [0.25, 0.5, 1, 2, 3.5, 5];
parfor i = 1:length(prec)
tic
b = 2e-4;
u0 = 0.5;
P=1;
D_i = 2;
D_o = 20;
a = -1;
[b, u0, e, e_g, u_g] = calc_tanh_params(fac(i)*P, D_i, fac(i)*D_o, a, b, u0);
T_prec(i) = Ternary_model(2, 'FRAP', {-1, b, u0, ...
e, e_g, u_g, 300, 7, 0, 'Constituent'},...
t, 2000);
% T_prec(i) = Ternary_model(2, 'FRAP', {-1, b(7.7/3, 10^-5), u0, ...
% e(7.7/3), e_g, u_g, 300, 7, 0, 'Constituent'},...
% t, 0.2);
T_prec(i) = Ternary_model(0, 'Gauss', [-6, b(7.7/3, 10^-6), 0.5, ...
e(7.7/3), 0, 1, 300, 7], t, prec(i));
T_prec(i).solve_tern_frap()
toc
end
%% Test partitioning == 1 compared to natural no mobility case.
% Tg1: g0 = 1 everywhere.
Tpt1 = Ternary_model(0, 'FRAP', {-1, b(7/3, 10^-18), 0.5, e(7/3),...
0, 1, 300, 7, 0, 'Constituent'},...
t, 1);
Tpt1.solve_tern_frap();
%%
% Rescale mobility, such that phi_tot=1 everywhere achieves same flux
Gi = (1-Tpt1.phi_t(1))/(1-Tpt1.phi_t(1));
Go = Tpt1.phi_t(1)/Tpt1.phi_t(end)*(1-Tpt1.phi_t(end));
%%
Tga1 = Ternary_model(0, 'FRAP', {-1, b(7/3, 10^-18), Tpt1.phi_t(1), 0,...
(Go-Gi), Gi, 300, 7, 0, 'Constituent'},...
t, 1);
Tga1.solve_tern_frap();
%%
Tpt1.plot_sim('plot', 1, 'g')
%%
Tga1.plot_sim('plot', 1, 'k')
%%
figure(3); hold on;
% fact = [0.9965, 0.94, 1.01, 1.98];fact(i)*
c = {'g', 'm', 'k', 'r'};
for i = 1:3%length(T_prec)
% T_prec(i).plot_sim('plot', 1, c{i})
% Is this the right normalization? %/T_prec(i).phi_t(1)
plot(T_prec(i).x, T_prec(i).sol'/T_prec(i).phi_t(1), c{i}); axis([0, 20, -inf, 1]);
end
axis([0, 2, 0, 1])
%% Same precisions, different starting positions
x0 = [-0.05, -0.03, -0.01, 0.01, 0.03, 0.05];
parfor i = 1:length(x0)
......@@ -71,8 +29,8 @@ end
%% Frank's/Stefano via Laplace transform vs Fokker Planck
t = linspace(0, 10, 1000);
tic
T_mov = Ternary_model(0, 'Gauss', {-6, b(7/3, 10^-15), 0.5, e(7/3),...
19, 1, 300, 7, 0, 'Constituent'}, t, 0.2);
T_mov = Ternary_model(0, 'Gauss', [-6, b(7/3, 10^-15), 0.5, e(7/3),...
0, 1, 300, 7, 0], t, 0.2);
T_mov.solve_tern_frap()
toc
%%
......@@ -83,28 +41,6 @@ p_in = @(D_p, D_m, ga, x0, x, t) 1./(sqrt(pi*t)*(sqrt(D_m)+...
ga*sqrt(D_p)))*exp(-(x-x0*sqrt(D_m/D_p)).^2/(4*D_m*t));
x_left = linspace(-4, 0, 1000);
x_right = linspace(0, 4, 1000);
%% Plot with full ternary model
T_temp = T_mov;
D_m = 1*(1-T_temp.u0-T_temp.e); % to make equal to ternary FRAP
D_p = 20*(1-T_temp.u0+T_temp.e);
ga = (T_temp.u0-T_temp.e)/(T_temp.u0+T_temp.e);
for i = 1:100%length(T_mov.t)
cla;
figure(1); hold on;
xlim([-2, 2]);
ylim([0, 1]);
plot(T_temp.x+T_temp.a, T_temp.sol(i, :), 'r.');%, 'LineWidth', 2);
plot(x_left, p_in(D_p, D_m, ga, T_temp.x0+T_temp.a, x_left,...
t(i)+0.01/1000), 'k-.', 'LineWidth', 2);
plot(x_right, p_out(D_p, D_m, ga, T_mov.x0+T_temp.a, x_right,...
t(i)+0.01/1000), 'k-.', 'LineWidth', 2);
plot(x_left, p_in(10*D_p, D_m, ga/1, T_temp.x0+T_temp.a, x_left,...
t(i)+0.01/1000), 'b-.', 'LineWidth', 2);
make_graph_pretty(['x [' char(956) 'm]'], 'c [a.u.]', '',...
[T_temp.a, 10, 0, inf])
% print([num2str(i),'.png'],'-dpng')
shg; pause();
end
%% Moving boundary
t = linspace(0, 10, 9000);
tic
......@@ -171,6 +107,25 @@ s_dot(i) = sum(diff(T_mov.x).*f.^2./(g0.*(1-pt).*u_interp));
end
csvwrite([s, 'FRAP_Flux.csv'], [x_interp; f])
csvwrite([s, 'FRAP_entropy.csv'], [T_mov.t; s_dot]);
%% Plot with full ternary model
T_temp = T_mov;
D_m = 1*(1-T_temp.u0-T_temp.e); % to make equal to ternary FRAP
D_p = 1*(1-T_temp.u0+T_temp.e);
ga = (T_temp.u0-T_temp.e)/ (T_temp.u0+T_temp.e);
for i = 1:100%length(T_mov.t)
cla;
figure(1); hold on;
xlim([-2, 2]);
ylim([0, 1]);
plot(T_temp.x+T_temp.a, T_temp.sol(i, :), 'r.');%, 'LineWidth', 2);
plot(x_left, p_in(D_p, D_m, ga, T_temp.x0+T_temp.a, x_left,...
t(i)+0.01/1000), 'k-.', 'LineWidth', 2);
plot(x_right, p_out(D_p, D_m, ga, T_mov.x0+T_temp.a, x_right,...
t(i)+0.01/1000), 'k-.', 'LineWidth', 2)
make_graph_pretty(['x [' char(956) 'm]'], 'c [a.u.]', '')
% print([num2str(i),'.png'],'-dpng')
shg; pause();
end
%% Check integral of solution, should be mass conserving and sum to 1.
% integrate to 50, to avoid right boundary
[~, ind] = min(abs(T_prec(4).x-50));
......
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