MATLAB Answers

After i generate random numbers of x, how can i use this random x values to the rest of the code one by one. Because after that, I want to plot a friction factor-x number grapt with this different numbers

1 view (last 30 days)
x = 0.05 + (0.1-0.05).*rand(10,1);
Perimeter = (pi*HydraulicDiameter);
NumberOfCoolantChannels = 3;
Npass = 1; ...Number of Passes
% Ac = (pi*(HydraulicDiameter^2)/(4)); ...Single channel flow cross section
Ac = 1.571e-5;
Atotal = NumberOfCoolantChannels*Ac; ... Total Flow Cross Section
BladeMassFlow = (CoolantBleed/100)*(TurbineMassFlow/NumberOfBlades);
ChannelMassFlow = (BladeMassFlow/NumberOfCoolantChannels);
RibHeighHydraulicDiameterRatio = x;
FrictionFactor2 = 1.447*(1.14-2*log10(x))^-2; %transverse ribs

  0 Comments

Sign in to comment.

Accepted Answer

Geoff Hayes
Geoff Hayes on 18 May 2020
isilay - since x is an array then you can use element-wise power to calculate the friction factor. Just change your line of code to
FrictionFactor2 = 1.447*(1.14-2*log10(x)).^-2; %transverse ribs
where a '.' is placed in front of the exponent operator.

  16 Comments

isilay aydin
isilay aydin on 19 May 2020
this is my final version still idk if it is true
x = 0.05 + (0.1-0.05).*rand(10,1);
Perimeter = (pi*HydraulicDiameter);
NumberOfCoolantChannels = 3;
Npass = 1; ...Number of Passes
% Ac = (pi*(HydraulicDiameter^2)/(4)); ...Single channel flow cross section
Ac = 1.571e-5;
Atotal = NumberOfCoolantChannels*Ac; ... Total Flow Cross Section
BladeMassFlow = (CoolantBleed/100)*(TurbineMassFlow/NumberOfBlades);
ChannelMassFlow = (BladeMassFlow/NumberOfCoolantChannels);
RibHeighHydraulicDiameterRatio = x;
FrictionFactor2 = 1.447*(1.14-2*log10(x)).^-2; %transverse ribs
% OverallPressureDrop = FrictionFactor2*((Npass*BladeSpan*10^-3)/HydraulicDiameter)*CoolantDensity*((BulkVelocity^2)/2);
OverallPressureDrop = 8300;
BulkVelocity =sqrt((OverallPressureDrop./FrictionFactor2)*(HydraulicDiameter/(Npass*BladeSpan*10.^-3))*(2/CoolantDensity));
ChannelCoolantMassFlow = CoolantDensity*Ac*BulkVelocity;
BladeCoolantMassFlow = NumberOfCoolantChannels*ChannelCoolantMassFlow;
PercentageCoolantBleed = (BladeCoolantMassFlow*NumberOfBlades/TurbineMassFlow)*100;
Re = (ChannelCoolantMassFlow/Ac)*(HydraulicDiameter/CoolantViscosity);
Nu = 0.15*Re.^0.7; ...based on the Hydraulic Diameter
InternalHeatTransferCoefficient = Nu*(CoolantConductivity/HydraulicDiameter);
TechnologyFactor = (InternalHeatTransferCoefficient*Npass*Perimeter*NumberOfCoolantChannels)/(ExternalHeatTransferCoefficient*BladeExternalPerimeter*45*10^-3);
MassFlowFunction = (BladeCoolantMassFlow*CoolantSpecificHeat)/(BladeExternalPerimeter*BladeChord*10^-3*ExternalHeatTransferCoefficient*BladeSpan*10^-3);
ConvectionCoolingEfficiency = 1 - exp((-TechnologyFactor)/(MassFlowFunction));
OverallEffectinevess = (MassFlowFunction*ConvectionCoolingEfficiency)/(1 + MassFlowFunction*ConvectionCoolingEfficiency);
MetalTemperature = (ExternalGasTemperature) - OverallEffectinevess*(ExternalGasTemperature-CoolantInletTemperature);
Geoff Hayes
Geoff Hayes on 19 May 2020
isilay - I think that you need to step through each line of code (using the MATLAB debugger) and verify that all variables are as you expect and that, given their dimensions, the code is performing the correct operation.
Stephen Cobeldick
Stephen Cobeldick on 19 May 2020
"...i thought that i should put dot every variables which affect the X and Friction factor"
But those are not the only non-scalar variables in your code. These ones are too (or probably should be):
BulkVelocity
ChannelCoolantMassFlow
BladeCoolantMassFlow
PercentageCoolantBleed
Re
Nu
InternalHeatTransferCoefficient
TechnologyFactor
MassFlowFunction
etc. etc.
Why? Lets have a look at the definition of BulkVelocity:
BulkVelocity =sqrt((OverallPressureDrop./FrictionFactor2)*(HydraulicDiameter/(Npass*BladeSpan*10.^-3))*(2/CoolantDensity));
% ^^^^^^^^^^^^^^^ non-scalar
Atleast one of its defining terms is non-scalar. There are no operations to reduce the size of that array, so BulkVelocity will also be non-scalar (with the same size as FrictionFactor2). And exactly the same for all the other variables listed and some more (because I stopped checking at that point).
You need to be much more thorough and actually look at the sizes of all of the variables, and then use the appropriate array operations. Note that if you are not perforning any linear algebra you could simply replace every matrix operation with an array operation (this would likely be much less effort than checking every variable).

Sign in to comment.

More Answers (0)


Translated by