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

Cosmetic changes.

parent 24868c99
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,12 @@ function p = int_prob(l, T, x0, direc, ind_t, bp, ind_delta, lb, T_mov) ...@@ -3,8 +3,12 @@ function p = int_prob(l, T, x0, direc, ind_t, bp, ind_delta, lb, T_mov)
% 2: left->left, -2: right->right % 2: left->left, -2: right->right
% ind_t ... time index at which propagators are evaluated % ind_t ... time index at which propagators are evaluated
% bp ... boundary position at t==ind_t % bp ... boundary position at t==ind_t
<<<<<<< Updated upstream
% lb ... distance from boundary not to take into account % lb ... distance from boundary not to take into account
=======
ss = T{1}.system_size;
>>>>>>> Stashed changes
delta_x0 = diff(x0); delta_x0 = diff(x0);
p = 0; p = 0;
for i = 1:length(delta_x0) for i = 1:length(delta_x0)
...@@ -12,6 +16,7 @@ for i = 1:length(delta_x0) ...@@ -12,6 +16,7 @@ for i = 1:length(delta_x0)
% 1. cond.: corr. starting point? 2. cond: jumped outside of domain? % 1. cond.: corr. starting point? 2. cond: jumped outside of domain?
corr_starting_point = direc*x < direc*bp-lb; corr_starting_point = direc*x < direc*bp-lb;
if abs(direc) == 1 % jump across the boundary? if abs(direc) == 1 % jump across the boundary?
<<<<<<< Updated upstream
corr_end_point = direc*(x-l) > direc*(bp-T{i}.v*T{1}.t(ind_delta+1))+lb; corr_end_point = direc*(x-l) > direc*(bp-T{i}.v*T{1}.t(ind_delta+1))+lb;
elseif abs(direc) == 2 % jump within the same phase? elseif abs(direc) == 2 % jump within the same phase?
if lb ~= 0 if lb ~= 0
...@@ -25,8 +30,22 @@ for i = 1:length(delta_x0) ...@@ -25,8 +30,22 @@ for i = 1:length(delta_x0)
else else
if (x + l < T{1}.system_size); right =1; else; right = 0; end if (x + l < T{1}.system_size); right =1; else; right = 0; end
if (x -l > bp); left = 1; else; left = 0; end if (x -l > bp); left = 1; else; left = 0; end
=======
corr_end_point = direc*(x-l) > direc*(bp-T{i}.v*T{1}.t(ind_delta+1));
elseif direc == 2 % jump left -> left
if l < 0 && x-l < bp; corr_end_point = 1; else; corr_end_point=0; end
if l > 0 % jump to left
corr_end_point = 1;
if x-l < 0; x = l-x; end % reflecting boundary if jump out left
end
elseif direc == -2 % jump right -> right
if l > 0 && x-l > bp; corr_end_point = 1; else; corr_end_point=0; end
if l < 0 % jump to right
corr_end_point = 1;
% Reflecting boundary if jumping out on right side of system
if x-l > ss; x = 2*ss+l-x; end
>>>>>>> Stashed changes
end end
corr_end_point = left || right; % consider, if left or right works
end end
if corr_starting_point && corr_end_point if corr_starting_point && corr_end_point
if nargin==8 if nargin==8
...@@ -40,17 +59,13 @@ for i = 1:length(delta_x0) ...@@ -40,17 +59,13 @@ for i = 1:length(delta_x0)
T{1}.phi_tot(x, T{1}.a, T{1}.b, T{1}.e, T{1}.u0, 0)*p2; T{1}.phi_tot(x, T{1}.a, T{1}.b, T{1}.e, T{1}.u0, 0)*p2;
elseif nargin==9 elseif nargin==9
if abs(direc) == 1 if abs(direc) == 1
p_i = @(j) interp1(T{j}.x, T{j}.sol(ind_delta+1, :), x-l); x_ev = x-l;
elseif abs(direc) == 2 elseif direc == 2 % left -> left
x_l = x-l; % left position if l > 0 && x-l < 0; x_ev = l-x; else; x_ev = x-l; end
x_r = x+l; % right position elseif direc == -2 % right -> right
if x-l < 0; x_temp = l-x; end % -> jump reflected if necess. if l < 0 && x+l > ss; x_ev = 2*ss+l-x; else; x_ev = x-l; end
if x+l > T{1}.system_size; x_temp = 2*T{1}.system_size-x-l; end
p_i = @(j) interp1(T{j}.x, T{j}.sol(ind_delta+1, :),...
x_l) * left + ...
interp1(T{j}.x, T{j}.sol(ind_delta+1, :),...
x_r) * right;
end end
p_i = @(j) interp1(T{j}.x, T{j}.sol(ind_delta+1, :), x_ev);
p2 = (p_i(i)+p_i(i+1))/2; p2 = (p_i(i)+p_i(i+1))/2;
p_sol = @(j) interp1(T_mov.x, T_mov.sol(ind_t, :), x); p_sol = @(j) interp1(T_mov.x, T_mov.sol(ind_t, :), x);
% p_sol2 = T{1}.phi_tot(x, T{1}.a, T{1}.b, T{1}.e, T{1}.u0, 0); % p_sol2 = T{1}.phi_tot(x, T{1}.a, T{1}.b, T{1}.e, T{1}.u0, 0);
......
...@@ -6,6 +6,9 @@ e = @(chi) sqrt(3/8*(chi-2)); ...@@ -6,6 +6,9 @@ e = @(chi) sqrt(3/8*(chi-2));
t = linspace(0.0, 0.001, 11); t = linspace(0.0, 0.001, 11);
% t=0.01; % t=0.01;
% t = logspace(-4, -2, 20); % t = logspace(-4, -2, 20);
% Folders
next = '/home/hubatsch/Nextcloud/';
mac_next = '/Users/hubatsch/Nextcloud/';
%% Comparison with Python %% Comparison with Python
T1 = Ternary_model(0, 'FRAP', {-0.1, b(7/3, 10^-12), 0.5, 0.4,... T1 = Ternary_model(0, 'FRAP', {-0.1, b(7/3, 10^-12), 0.5, 0.4,...
0, 1, 300, 7, 0, 'Constituent', 0},... 0, 1, 300, 7, 0, 'Constituent', 0},...
...@@ -65,8 +68,8 @@ for i = 1:length(fac) ...@@ -65,8 +68,8 @@ for i = 1:length(fac)
e, e_g, u_g, 300, 7, 0, 'Constituent'},... e, e_g, u_g, 300, 7, 0, 'Constituent'},...
t, 2); t, 2);
% T_prec(i) = Ternary_model(2, 'FRAP', {-1, b(7.7/3, 10^-5), u0, ... % 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'},... % e(7.7/3), e_g, u_g, 300, 7, 0,...
% t, 0.2); % 'Constituent'}, t, 0.2);
T_prec(i).solve_tern_frap() T_prec(i).solve_tern_frap()
end end
...@@ -86,9 +89,9 @@ Gi = 1;%(1-Tpt1.phi_t(1))/(1-Tpt1.phi_t(1)); ...@@ -86,9 +89,9 @@ Gi = 1;%(1-Tpt1.phi_t(1))/(1-Tpt1.phi_t(1));
Go = Tpt1.phi_t(end)/Tpt1.phi_t(1)*2; Go = Tpt1.phi_t(end)/Tpt1.phi_t(1)*2;
%% %%
for i = 1:1%length(prec) for i = 1:1%length(prec)
Tga1(i) = Ternary_model(2, 'FRAP', {-1, b(7/3, 10^-12), Tpt1(i).phi_t(1),... Tga1(i) = Ternary_model(2, 'FRAP', {-1, b(7/3, 10^-12), ...
0, -0.83, Gi, 300, 7, 0,... Tpt1(i).phi_t(1), 0, -0.83, Gi,...
'Constituent'},... 300, 7, 0,'Constituent'},...
t, prec(i)); t, prec(i));
Tga1(i).x = Tpt1(i).x; Tga1(i).x = Tpt1(i).x;
Tga1(i).solve_tern_frap(); Tga1(i).solve_tern_frap();
...@@ -230,7 +233,7 @@ sum((T{1}.sol(1, 1:end-1)+T{1}.sol(1, 2:end))/2.*diff(T{1}.x)) ...@@ -230,7 +233,7 @@ sum((T{1}.sol(1, 1:end-1)+T{1}.sol(1, 2:end))/2.*diff(T{1}.x))
% figure; hold on; % figure; hold on;
plot(ls, p/N); plot(ls, p/N);
%% Write to file %% Write to file
cd /Users/hubatsch/Nextcloud/Langevin_vs_MeanField/Data_Figs_FokkPla/jump_length/ cd([next_mac, 'Langevin_vs_MeanField/Data_Figs_FokkPla/jump_length/']);
csvwrite('jump_length_7_7_lb01.csv', ls) csvwrite('jump_length_7_7_lb01.csv', ls)
csvwrite('prob_7_7_lb01.csv', p); csvwrite('prob_7_7_lb01.csv', p);
...@@ -422,9 +425,9 @@ for j = 1:n_T ...@@ -422,9 +425,9 @@ for j = 1:n_T
end end
toc toc
end end
next = '/home/hubatsch/Nextcloud/';
% csvwrite('/home/hubatsch/Nextcloud/jump_length_mov_bound_in_out.csv', [-ls', sum(p, 2)]) % csvwrite([next, 'jump_length_mov_bound_in_out.csv'], [-ls', sum(p, 2)])
% csvwrite('/home/hubatsch/Nextcloud/jump_length_mov_bound_out_in.csv', [ls', sum(p, 2)]) % csvwrite([next, 'jump_length_mov_bound_out_in.csv', [ls', sum(p, 2)])
%% %%%%%%%%%%%%%%%%%%%%%% FRAP TIME COURSE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%%%%%%%%%%%%%%%%%% FRAP TIME COURSE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
t = linspace(0, 5, 300); t = linspace(0, 5, 300);
...@@ -592,6 +595,6 @@ dudx = diff(Temp.sol(t_ind, :))./diff(Temp.x); ...@@ -592,6 +595,6 @@ dudx = diff(Temp.sol(t_ind, :))./diff(Temp.x);
x = (Temp.x(1:end-1)+Temp.x(2:end))/2; x = (Temp.x(1:end-1)+Temp.x(2:end))/2;
sol = (Temp.sol(t_ind, 1:end-1)+Temp.sol(t_ind, 2:end))/2; sol = (Temp.sol(t_ind, 1:end-1)+Temp.sol(t_ind, 2:end))/2;
[~, flux ,~, g0, pt] = flory_hugg_pde(x, 0, sol, dudx, Temp.a, Temp.b, Temp.e, ... [~, flux ,~, g0, pt] = flory_hugg_pde(x, 0, sol, dudx, Temp.a, Temp.b, ...
Temp.u0, Temp.e_g0, Temp.u_g0, Temp.v, Temp.mode); Temp.e, Temp.u0, Temp.e_g0, Temp.u_g0, Temp.v, Temp.mode);
end end
\ No newline at end of file
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