Skip to content

Commit

Permalink
Swimming via wave propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
petermnhull committed Feb 11, 2020
1 parent 134a7e4 commit 516b9ff
Show file tree
Hide file tree
Showing 7 changed files with 1,226,847 additions and 8 deletions.
8 changes: 7 additions & 1 deletion all_external_forces.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

cross_links_trig = false;
cross_links_linear = false;
cross_links_linear_osc = true;
cross_links_linear_osc = false;
cross_links_linear_osc_swimming = true;
cross_links_han_peskin = false;

external_pinch = false;
Expand Down Expand Up @@ -44,6 +45,11 @@
[FX, FY] = cl_forces_variable_al_linear_osc(FX, FY, X_S, Y_S, N_w, cl_el, nt, TOTAL_STEPS);
end

% Cross linked forces with variable arc length, linear, swimming
if cross_links_linear_osc_swimming
[FX, FY] = cl_forces_variable_al_linear_swimming(FX, FY, X_S, Y_S, N_w, cl_el, nt, TOTAL_STEPS);
end

if cross_links_han_peskin
[FX, FY, T] = cl_forces_hanpeskin_new(FX, FY, X_S, Y_S, N_w, N_pairs, dt, T_S);
end
Expand Down
5 changes: 2 additions & 3 deletions cl_forces_variable_al_linear_osc.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
% Constants for cross links (linear and trig)
k_a = 1;
k_b = 1;
lambda = 3;
lambda = 5;

% Initialise
t = nt;

for i=1:(N_w - 1)
% Parameters for time component
reps = 6;
scale = 2;
time_component = scale * sin(reps * pi * t / TOTAL_STEPS);
time_component = sin(reps * pi * t / TOTAL_STEPS);

% Equilibrium lengths
el_a = cl_el + lambda * time_component * ((i - 1) / N_w);
Expand Down
53 changes: 53 additions & 0 deletions cl_forces_variable_al_linear_swimming.asv
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
function [FX, FY] = cl_forces_variable_al_linear_swimming(FX_IN, FY_IN, X_IN, Y_IN, N_w, cl_el, nt, TOTAL_STEPS)

% This function returns a complete asymmetric crosslinked set of forces

FX = FX_IN;
FY = FY_IN;

% Constants for cross links (linear and trig)
k_a = 1;
k_b = 1;
lambda = 5;

% Initialise
t = nt;

% Divisions of filament
div = 2;

% Segments per division
spdiv = floor(N_w / div);

for j=1:div
seg_start = 1 + (spdiv * (j - 1));
seg_end = seg_start + spdiv - 1;

if seg_end == N_w
seg_end = seg_end - 1;
end

for i=seg_start:seg_end

% Parameters for time component
omega = 2 * pi / TOTAL_STEPS % undulation freq
k = w % wave number
time_component = sin(k*s - omega*t + phi);

% Equilibrium lengths
el_a = cl_el + lambda * ((i - 1) / (div * N_w));
el_b = cl_el + lambda * (1 - ((i - 1) / (div * N_w)));

if j == 1
scale = 2 * (1 - ((i - 1) / N_w));
else
scale = 1;
end

el_a = cl_el + lambda * time_component * scale;

% Add forces
[FX, FY] = add_spring_force_between_segments(FX, FY, X_IN, Y_IN, i, N_w + i + 1, k_a, el_a);
[FX, FY] = add_spring_force_between_segments(FX, FY, X_IN, Y_IN, i + 1, N_w + i, k_b, el_b);
end
end
54 changes: 54 additions & 0 deletions cl_forces_variable_al_linear_swimming.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
function [FX, FY] = cl_forces_variable_al_linear_swimming(FX_IN, FY_IN, X_IN, Y_IN, N_w, cl_el, nt, TOTAL_STEPS)

% This function returns a complete asymmetric crosslinked set of forces

FX = FX_IN;
FY = FY_IN;

% Constants for cross links (linear and trig)
k_a = 1; % Young's Constant for Active Cross-Link
k_b = 1; % Young's Constant for Passive Cross-Link
lambda = 10; % Amplitude

% Parameters for time component
time_div = 1;
speed = 4;
omega = 2 * pi * speed / (time_div * TOTAL_STEPS); % undulation freq
k = 1; % wave number
phi = 0; % phase

% Initialise
t = nt;

% Divisions of filament
div = 2;

% Segments per division
spdiv = floor(N_w / div);

for j=1:div
seg_start = 1 + (spdiv * (j - 1));
seg_end = seg_start + spdiv - 1;

if seg_end == N_w
seg_end = seg_end - 1;
end

for i=seg_start:seg_end

time_component = sin(k*(i - 1) - omega*t + phi);

if j == 1
scale = 2 * (1 - ((i - 1) / N_w));
else
scale = 1;
end

el_a = cl_el + lambda * time_component * scale;
el_b = cl_el;

% Add forces
[FX, FY] = add_spring_force_between_segments(FX, FY, X_IN, Y_IN, i, N_w + i + 1, k_a, el_a);
[FX, FY] = add_spring_force_between_segments(FX, FY, X_IN, Y_IN, i + 1, N_w + i, k_b, el_b);
end
end
4 changes: 2 additions & 2 deletions data.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
% Filament data
a = 1; % segment 'radius' (half filament width)
N_sw = 2 * N_pairs; % number of filaments
N_w = 15; % number of segments in filament (21)
N_w = 21; % number of segments in filament (21)
Np = N_sw*N_w; % total number of segments
N_lam = N_sw*(N_w - 1); % number of lambdas

B = 1000; % dimensionless elasto-gravitational number B
weight_per_unit_length = 1e0; % weight per unit length W

DL_factor = 2.2;
DL_factor = 2.2; % 2.2
DL = DL_factor*a; % distance between segment centres, Delta L
L = N_w*DL; % filament length L
mu = 10; % fluid viscosity
Expand Down
4 changes: 2 additions & 2 deletions set_up_graphics.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

% Plot centreline and walls of two filaments
plot_centreline = true;
plot_walls = true;
plot_walls = false;

% Line thicknesses
wdth_centreline = 5;
wdth_centreline = 10;
wdth_wall = 5;

% Plot initial conditions
Expand Down
Loading

0 comments on commit 516b9ff

Please sign in to comment.