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

FRAP plot works.

parent eb8ab15b
No related branches found
No related tags found
No related merge requests found
......@@ -3,33 +3,33 @@ function create_mesh(T)
% Mesh density larger for steeper gradients.
% Start with left side of mesh, at r=0/x=0, with a given step size
% x = [0, 0.01/T.precision/10];%/10
% % x = linspace(0, 0.75, 40);
% % x = [x, x(end)+0.01/T.precision/10];%/10
% % while x(end)<-T.a
% % x_temp = x(end)-x(end-1);
% % phi_nm1 = T.phi_tot(x(end), T.a, T.b, T.e, T.u0, 0);
% % phi_n = T.phi_tot(x(end)+x_temp, T.a, T.b, T.e, T.u0, 0);
% % while phi_nm1-phi_n > 0.002/T.precision
% % x_temp = x_temp/2;
% % phi_n = T.phi_tot(x(end)+x_temp, T.a, T.b, T.e, T.u0, 0);
% % end
% % x = [x, x(end)+x_temp];
% % end
% % x = [x, x(end)+cumsum(fliplr(diff(x)))];
% % x_middle = linspace(-2*T.a+x(end)-x(end-1), -10*T.a, 100*T.precision);
% % x_right = linspace(-10*T.a+0.1, T.system_size, 100*T.precision);
% % T.x = [x, x_middle, x_right];
% % T.x = T.x(1:find(T.x-T.system_size>=0, 1)-1);
% %
% % % Fine mesh close to x0 if ic = 'Gauss'
% % [~, ind] = min(abs(T.x-T.x0));
% % if T.x(ind+20)-T.x(ind) > 0.1
% % T.x = [T.x(1:ind-21), linspace(T.x(ind-20), T.x(ind+20),...
% % ceil((T.x(ind+20)-T.x(ind-20))*200)),...
% % T.x(ind+21:end)];
% % end
x = [0, 0.01/T.precision/10];%/10
x = linspace(0, 0.75, 40);
x = [x, x(end)+0.01/T.precision/10];%/10
while x(end)<-T.a
x_temp = x(end)-x(end-1);
phi_nm1 = T.phi_tot(x(end), T.a, T.b, T.e, T.u0, 0);
phi_n = T.phi_tot(x(end)+x_temp, T.a, T.b, T.e, T.u0, 0);
while phi_nm1-phi_n > 0.002/T.precision
x_temp = x_temp/2;
phi_n = T.phi_tot(x(end)+x_temp, T.a, T.b, T.e, T.u0, 0);
end
x = [x, x(end)+x_temp];
end
x = [x, x(end)+cumsum(fliplr(diff(x)))];
x_middle = linspace(-2*T.a+x(end)-x(end-1), -10*T.a, 100*T.precision);
x_right = linspace(-10*T.a+0.1, T.system_size, 100*T.precision);
T.x = [x, x_middle, x_right];
T.x = T.x(1:find(T.x-T.system_size>=0, 1)-1);
% Fine mesh close to x0 if ic = 'Gauss'
[~, ind] = min(abs(T.x-T.x0));
if T.x(ind+20)-T.x(ind) > 0.1
T.x = [T.x(1:ind-21), linspace(T.x(ind-20), T.x(ind+20),...
ceil((T.x(ind+20)-T.x(ind-20))*200)),...
T.x(ind+21:end)];
end
% T.x = [linspace(3, 5., 500), linspace(5.05, 6.05, 3000),...
% linspace(6.06, 7.1, 500), linspace(7.15, 20, 3000)];
T.x = linspace(0, 20, 8000);
% T.x = linspace(0, 20, 8000);
end
......@@ -11,8 +11,8 @@ if strcmp(mode, 'mov')
figure(20); hold on;
for i = 1:nth:length(T.t)
cla; xlim([-T.a-1, -T.a+3]);
xlim([0, 20]);
ylim([0, 5.2]);
xlim([0, 10]);
ylim([0, 0.4]);
ax = gca;
ax.FontSize = 12;
xlabel('position'); ylabel('probability [not normalized]');
......@@ -21,7 +21,7 @@ if strcmp(mode, 'mov')
plot(T.x, T.sol(i, :), 'LineWidth', 2);
text(abs(-T.a+2), 0.7, num2str(T.t(i)));
shg
% pause();
pause();
% print([num2str(i),'.png'],'-dpng')
end
elseif strcmp(mode, 'plot')
......
......@@ -17,12 +17,12 @@ function [c, f ,s] = flory_hugg_pde(x, t, u, dudx, a, b, e, u0,...
pt = Ternary_model.phi_tot(x, a, b, e, u0, v*t);
gra_a = Ternary_model.gradient_analytical(x, a, b, e, v*t);
% g0 = Ternary_model.gamma0(x, a+t*v, b, e_g0, u_g0, v*t);
g0 = 0.5;
g0 = Ternary_model.gamma0(x, a+t*v, b, e_g0, u_g0, v*t);
% g0 = 0.5;
c = 1;
% f = g0*(1-pt)/pt*(pt*dudx-u*gra_a);
chi_phi = -4.530864768482371;
f = g0*(dudx+chi_phi*u*gra_a);
f = g0*(1-pt)/pt*(pt*dudx-u*gra_a);
% chi_phi = -4.530864768482371;
% f = g0*(dudx+chi_phi*u*gra_a);
s = 0;
end
......
......@@ -46,17 +46,16 @@ t = linspace(0, 10, 300);
tic
T_mov = Ternary_model(0, 'Uniform', [-10, b(7/3, 10^-6), 0.5, e(7/3),...
0, 1, 10, 7, 0.5], t, 0.02);
T_mov.solve_tern_frap()
T_mov.solve_tern_frap();
toc
%%
csvwrite('MovingBound.csv', [T_mov.x', T_mov.sol(1, :)', T_mov.sol(end, :)'])
%% FRAP client
t = linspace(0, 15, 300);
tic
T_mov = Ternary_model(0, 'FRAP', [-10, b(7/3, 10^-6), 0.5, e(7/3),...
0, 1, 10, 7, 0.5], t, 0.02);
T_mov.solve_tern_frap()
toc
%% FRAP jump length
t = linspace(0, 5, 300);
T_mov = Ternary_model(0, 'FRAP', [-5, b(7/3, 10^-6), 0.5, e(7/3),...
0, 1, 10, 7, 0], t, 0.02);
T_mov.solve_tern_frap();
csvwrite('FRAP.csv', [T_mov.x', T_mov.sol(1, :)', T_mov.sol(end, :)'])
%% 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
......
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