2/8/16 4:03 PM C:/Users/dw/Documents/MATLAB... /fluid - PDF 1 of 1

You might also like

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

2/8/16 4:03 PM

C:\Users\dw\Documents\MATLAB...\fluid.pdf

1 of 1

% FLUID.M
% Calculates the free field fluid velocities and accelerations (at each node)
function[uy,uz,uyd,uzd,theta]=fluid(xj,xchg,ychg,zchg,Dship,t,TM,BR,BD,BRD,BDD,BRDD,
BDDD,DEL,L1,T1,btime,bdpth,NDOF,NNODES,Le)
% Non-dimensional bubble parameters
TI=t/T1;
a=interp1(TM,BR,TI);
s=interp1(TM,BRD,TI);
sd=interp1(TM,BRDD,TI);
l=interp1(TM,BDD,TI);
ld=interp1(TM,BDDD,TI);
d=interp1(TM,DEL,TI);
% Source strengths
e1=(L1^3)*(a^2)*s/T1;
e2=-(L1^4/(2*T1))*(a^3*l);
e1d=(L1^3/T1^2)*(a^2*sd+2*a*s^2);
e2d=-(L1^4/(2*T1^2))*(a^3*ld+3*a^2*l*s);
% Vertical bubble velocity
vm=-1*L1/T1;
% Bubble depth
ti=t;
bdepth=interp1(btime,bdpth,ti);
for n=1:NNODES
ny=(n-1)*4+1;
nz=(n-1)*4+2;
xnode=(n-1)*Le(1);
ynode=xj(ny);
znode=xj(nz);
% vr and hr (vertical and horiz relative distance) and angle of flow
vr=bdepth-Dship+ynode;
hr=((xnode-xchg)^2+(znode-zchg)^2)^0.5;
theta(n)=atan((xnode-xchg)/(znode-zchg));
% Free-field fluid velocities/accelerations (vertical and horizontal)
% Horizontal and vertical free-field fluid velocities and accelerations
dis=(vr^2+hr^2)^0.5;
uh=(e1*hr/dis^3)+(3*e2*vr*hr/dis^5);
uv=(e1*vr/dis^3)+(3*e2*vr^2/dis^5)-(e2/dis^3);
uhd=(e1d*hr/dis^3)+(3*e2d*hr*vr/dis^5)+vm*(3*e1*hr*vr/dis^5-(3*e2*hr/dis^5)*(1(5*vr^2/dis^2)));
uvd=(e1d*vr/dis^3+3*e2d*vr^2/dis^5-e2d/dis^3)-vm*(e1/dis^33*e1*vr^2/dis^5+9*e2*vr/dis^5-15*e2*vr^3/dis^7);
% Y and Z directed free-field fluid velocities and accelerations
uy(n)=uv;
uz(n)=uh*cos(theta(n));
uyd(n)=uvd;
uzd(n)=uhd*cos(theta(n));
end

You might also like