Code

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

clc

clear all
format short
disp('Settling Velocity and Concentration Profile Simulations')
disp('Number of elevation for settling column concentration sampling, nele, is:'
)
nele = input('nele = ');
disp('Number of times for concentration sampling, ntime, is:')
ntime = input('ntime = ');
disp('Input file name is: setm2.txt')
% Read file 'setm2.txt'
fid = fopen('setm2.txt','r');
filetemp = fscanf(fid,'%f',[8 9]);
filedata = filetemp.';
fclose(fid);
%*** First estimation for settling velocity formula ***
disp('Estimated coefficient, m, is:')
m = input('m = ');
disp('Estimated coefficient, n, is:')
n = input('n = ');
disp('Estimate suspension concentration for maximum settling velocity, C2 (kg/m^
3), is:')
C2 = input('C2 = ');
disp('Calculate coefficient, b, based on equation (4.18) page 4-28 is:')
b=C2*((2*m/n-1)^0.5);
str = sprintf('b = %f',b);
disp(str)
disp('Estimate maximum settling velocity, Ws2 (m/s), is:')
Ws2 = input('Ws2 = ');
disp('Calculate coefficient, a, based on equation (4.17) page 4-26 is:')
temp_b=(b^(n-m))*((2*m/n-1)^(m-0.5*n))/((2*m/n-1)^0.5);
a=(Ws2*1/temp_b);
str = sprintf('a = %f',a);
disp(str)
%[Replotting option for y-axis range - Insert Yes or No. If Yes]:
reply = input('Do you want to replot for y-axis range? Y/N [Y]: ', 's');
if isempty(reply)||strcmp(reply,'Y')
reply = 'Y';
disp('Minimum settling velocity for velocity-concentration plot:')
ymin = input('y_min = ');
disp('Maximum settling velocity for velocity-concentration plot:')
ymax = input('y_max = ');
for i=2:9
for j=2:8
cc(i,j)=filedata(i,j);
ww(i,j)=(a*(cc(i,j).^n))/(cc(i,j).^2+b.^2).^m;
end
end
loglog(cc,ww,'o')
xlabel('Sediment Concentration (g/l)');
ylabel('Settling Velocity (m/s)');
ylim([ymin ymax])
grid off
end
for i=2:9
for j=2:8
cc(i,j)=filedata(i,j);
ww(i,j)=(a*(cc(i,j).^n))/(cc(i,j).^2+b.^2).^m;
end
end
loglog(cc,ww,'o')
title('Fig.1 Experimental data','fontsize',10,'fontweight','bold');
xlabel('Sediment Concentration (g/l)');
ylabel('Settling Velocity (m/s)');
grid off
%[Option for further estimation of the four parmeters for settling velocity form
ula - Insert Yes or No. If Yes]:
reply = input('Do you want to estimation of the four parameters for settling vel
ocity formula? Y/N [Y]: ', 's');
if isempty(reply)||strcmp(reply,'Y')
reply = 'Y';
clear a b m n;
disp('Estimated coefficient, a, is:')
a = input('a = ');
disp('Estimated coefficient, b, is:')
b = input('b = ');
disp('Estimated coefficient, a, is:')
m = input('m = ');
disp('Estimated coefficient, n, is:')
n = input('n = ');
disp('Limiting free settling concentration, C1 (kg/m^3), is:')
C1 = input('C1 = ');
c0=C1-0.1;
for i=1:1:1000
c(i)=c0+0.1*i;
Ws(i)=(a*(c(i).^n))/((c(i).^2+b^2).^m);
end
loglog(c,Ws)
title('Fig.2 Calculated of settling velocity and experimentaldata','fontsize',10
,'fontweight','bold');
xlabel('Sediment Concentration (g/l)');
ylabel('Settling Velocity (m/s)');
xlim([10^-1 10^2])
ylim([10^-6 10^-2])
grid off
hold on
for i=2:9
for j=2:8
cc(i,j)=filedata(i,j);
ww(i,j)=(a*(cc(i,j).^n))/(cc(i,j).^2+b.^2).^m;
end
end
loglog(cc,ww,'o')
hold off
end
%[Option to simulate concentration profiles - Insert Yes or No. If Yes]:
reply = input('Do you want to simulate concentration profiles? Y/N [Y]: ', 's');
if isempty(reply)||strcmp(reply,'Y')
reply = 'Y';
disp('Time-step for calculation (seconds) is:')
time = input('time = ');
aa = importdata('setm2.txt');
bb = aa(2:9,1);
cx = aa(2:9,2:8);
x = logspace(-2,3);
semilogx(cx,bb,'-');
hold on
semilogx(cx,bb,'o');
hold off
axis([1e-2,1e3,0,2]);
title('Fig.3 Time-evolution of the concentration profile','fontsize',10,'fontwei
ght','bold');
xlabel('Sediment Concentration (g/l)');
ylabel('Elevation (m)');
end

You might also like