Sie sind auf Seite 1von 5

%********************************************

%*Name:Date:02/06/14*
%*Seat:12File:Fluid_Mechanics_Program.m*
%*Instructor:DMG3:00*
%********************************************

%Thisprogramallowstheusertoworkwithafluiddynamicssystemfora
%rectanguarchannel.Thissystemisabuildingblocktowritingascrift
%fileforthelabonachipthatwilllaterbeproduced.

%Tousethisprogram,firstreadwhatiswrittenwhenthe'run'button
is
%pressed.Theuseroftheprogramshouldbeaskedwhichparameteris
%missing.Typethecorrespondingletterandpressenter.Theninputthe
%knownparametersastheprogramasksthem.Thisshouldgivetheuser
the
%solutiontotheunknownvariable.Thiswillalsogivevaluestothe
other
%suppliedequationsandgraphaplotofvelocityversusshearstress.

%Beginbysettingupadisplayscreenfortheuser,askingwhich
parameter
%ismissing.
disp('Ofyourgivenparameters,whichoneismissing?');
disp('Ifthelengthismissing,typeandentera');
disp('Ifthewidthismissing,typeandenterb');
disp('Iftheheightismissing,typeandenterc');
disp('Iftheviscosityismissing,typeandenterd');
disp('Ifthechangeinpressureismissing,typeandentere');
disp('Ifthevolumetricflowrateismissing,typeandenterf');
%Oncetheuserknowswhichparameterismissing,theycaninputthe
letter
%correspondingtothedesiredparameter.
x=input('Pleasetypethemissingparameterhere:','s');
%Startaswitchcaseforallparameters.Inside,inputyourknown
%parameters.
switch(x)
%Caseafollowstofindthelength
case'a'
width=input('Pleasetypeyourwidth:');
height=input('Pleasetypeyourheight:');
viscosity=input('Pleasetypeyourviscosity:');
deltap=input('Pleasetypeyourchangeinpressure:');
vfr=input('Pleasetypeyourvolumterticflowrate:');
x=(((deltap)*(height^3)*(width))/(12*(viscosity)*(vfr)));
fprintf('Thelengthis%fcm\n',x)
%Casebfollowstofindthewidth
case'b'
length=input('Pleasetypeyourlength:');
height=input('Pleasetypeyourheight:');
viscosity=input('Pleasetypeyourviscosity:');
deltap=input('Pleasetypeyourchangeinpressure:');
vfr=input('Pleasetypeyourvolumterticflowrate:');
x=((12*(viscosity)*(vfr)*(length))/((deltap)*(height^3)));
fprintf('Thewidthis%fcm\n',x)
%Casecfollowstofindtheheight
case'c'
length=input('Pleasetypeyourlength:');
width=input('Pleasetypeyourwidth:');
viscosity=input('Pleasetypeyourviscosity:');
deltap=input('Pleasetypeyourchangeinpressure:');
vfr=input('Pleasetypeyourvolumterticflowrate:');
x=((12*(viscosity)*(vfr)*(length))/((deltap)*(width)))^(1/3);
fprintf('Theheightis%fcm\n',x)
%Casedfollowtofindtheviscosity
case'd'
length=input('Pleasetypeyourlength:');
width=input('Pleasetypeyourwidth:');
height=input('Pleasetypeyourheight:');
deltap=input('Pleasetypeyourchangeinpressure:');
vfr=input('Pleasetypeyourvolumterticflowrate:');
x=(((deltap)*(height^3)*(width))/(12*(length)*(vfr)));
fprintf('Theviscosityis%fg/cms\n',x)
%Caseefollowstofindthechangeinpressure
case'e'
length=input('Pleasetypeyourlength:');
width=input('Pleasetypeyourwidth:');
height=input('Pleasetypeyourheight:');
viscosity=input('Pleasetypeyourchangeinviscosity:');
vfr=input('Pleasetypeyourvolumterticflowrate:');
x=((12*(viscosity)*(vfr)*(length))/((width)*(height^3)));
fprintf('Thechangeinpressureis%fdyne/cm^2\n',x)
%Caseffollowstofindthevolumetricflowrate
case'f'
length=input('Pleasetypeyourlength:');
width=input('Pleasetypeyourwidth:');
height=input('Pleasetypeyourheight:');
viscosity=input('Pleasetypeyourviscosity:');
deltap=input('Pleasetypeyourchangeinpressure:');
x=(((deltap)*(height^3)*(width))/(12*(viscosity)*(length)));
fprintf('Thevolumetricflowrateis%fcm^3/s\n',x)
end
%Nowtheprogramwilltakethevaluespreviouslyinputtedand
solve
%forthediameter,shearstress,averagevelocity,reynolds
number,
%andentrancelengthofthegivensystem.
diameter=((4*(width)*(height))/((2*width)+(2*height)));
fprintf('Thediameterofthefluidsystemis%fcm\n',diameter)

shearstress=(deltap*height)/(2*length);
fprintf('Theshearstressofthefluidsystemis%f
dyne/cm^2\n',shearstress)

averagevelocity=(((deltap)*(height^2))/(12*(viscosity)*(length)));
fprintf('Theaveragevelocityinthefluidsystemis%f
cm/s\n',averagevelocity)

reynolds=(((averagevelocity)*(diameter))/(viscosity));
fprintf('Thereynoldsnumberofthefluidsystemis%f\n',reynolds)

entrancelength=(6*(reynolds)*(diameter))/10;
fprintf('Theentrancelengthofthefluidsystemis%f
cm\n',entrancelength)
%Additionally,atablewillbeprintedwithallofthevalues.THEREIS
NO
%UNITFORTHEMISSINGPARAMETERINTHETABLEBECAUSETHEUNITCHANGESAS
%DOESTHEMISSINGPARAMETER.THEUNITWASGIVENINTHESWITCHCASE!!!
disp('')
disp('MISSINGPARAMETERDiameterShearStressAvg
VelocityReynoldsEntr.Length')
disp('')
disp('(cm)(dyne/cm^2)(cm/s)
(cm)')
disp('')
fprintf('%f%f%f%f%f
%f\n\n',x,diameter,shearstress,averagevelocity,reynolds,entrancelength)
%Nowtoplottheaveragevelocityversustheshearstress.Becausethe
%equationsarenotrelatedyoumustparametrizetothechangein
pressure.
%Thenputyequaltoshearstressofthenewequation,intermsof
average
%velocity,viscosity,andheight.Becausetheviscosityandthewidth
have
%alreadybeeninputted,thelineshouldbeaconstantslope.Makingsure
to
%addlabelingstotheplot.
averagevelocity=[100:1:100];
viscosity=(((width)*(deltap)*(height^3))/(12*(length)*(vfr)));
height=((12*(viscosity)*(vfr)*(length))/((deltap)*(width)))^(1/3);
y=6*(viscosity)*(averagevelocity)/(height);
plot(averagevelocity,y)
xlabel('AverageVelocity(cm/s)')
ylabel('ShearStress(dyne/cm^2)')
title('AverageVelocityvs.ShearStressoftheFluidSystem')

>>Fluid_Mechanics_Program
Ofyourgivenparameters,whichoneismissing?
Ifthelengthismissing,typeandentera
Ifthewidthismissing,typeandenterb
Iftheheightismissing,typeandenterc
Iftheviscosityismissing,typeandenterd
Ifthechangeinpressureismissing,typeandentere
Ifthevolumetricflowrateismissing,typeandenterf
Pleasetypethemissingparameterhere:a
Pleasetypeyourwidth:3
Pleasetypeyourheight:.2
Pleasetypeyourviscosity:.01
Pleasetypeyourchangeinpressure:1000
Pleasetypeyourvolumterticflowrate:8
Thelengthis25.000000cm
Thediameterofthefluidsystemis0.375000cm
Theshearstressofthefluidsystemis100.000000dyne/cm^2
Theaveragevelocityinthefluidsystemis333.333333cm/s
Thereynoldsnumberofthefluidsystemis12500.000000
Theentrancelengthofthefluidsystemis2812.500000cm

MISSINGPARAMETERDiameterShearStressAvg
VelocityReynoldsEntr.Length

(cm)(dyne/cm^2)
(cm/s)(cm)

25.0000000.375000100.000000
333.33333312500.0000002812.500000

>>

Das könnte Ihnen auch gefallen