how to pull correct h into h(i)

M=1.4; %mach speed
l=1.68; %length , m
t=0.15 ; %thickness, m
dx=0.168; %delta x, m
dy=0.015; %delta y, m
dz=0.68668; %delta z, m
Ta=216.66; %free stream temperature, K
K=1.401; %specific heat ratio
pr=0.72178; %prandtl number
r=(pr)^(1/3); %recovery factor
Tstag=Ta*(1+((K-1)/2)*((M*(cosd(20)))^(2))); %stagnation temperature
Taw=Ta*(1+r*((K-1)/2)*M^(2)); %adiabatic wall temperaure
Ka=121.0 % Aluminum,Thermal Conductivity, W/m-k
Kt=6.7 %Titanium, Thermal Conductivity, W/m-k
Kc=30.758 %Carbon-carbon,Thermal Conductivity, W/m-k
%matrix 1x4 of each node
N_1=[ 0 21 0 0];
N_2=[ 0 30 21 0];
N_3=[ 0 44 30 0];
N_4=[ 0 54 44 0];
N_5=[ 0 60 54 0];
N_6=[ 0 0 60 0 ];
N_7=[ 0 0 56 60];
N_8=[0 0 48 56 ];
N_9=[0 0 36 48];
N_10=[0 0 29 36];
N_11=[0 0 0 29];
N_12=[21 37 0 0];
N_13=[ 37 49 0 0];
N_14=[49 57 0 0];
N_15=[ 57 61 0 0];
N_16=[61 0 0 0 ];
N_17=[59 0 0 61];
N_18=[53 0 0 59];
N_19=[ 43 0 0 53];
N_20=[29 0 0 43];
N_21=[2 22 12 1];
N_22=[ 30 23 37 21];
N_23=[ 31 24 38 22];
N_24=[32 25 39 23];
N_25=[33 26 40 24];
N_26=[34 27 41 25];
N_27=[35 28 42 26];
N_28=[36 29 43 27];
N_29=[ 10 11 20 28];
N_30=[ 3 31 22 2];
N_31=[44 32 23 30];
N_32=[ 45 33 24 31];
N_33=[ 46 34 25 32];
N_34=[ 47 35 26 33];
N_35=[ 48 36 27 34];
N_36=[ 9 10 28 35];
N_37=[ 22 38 13 12];
N_38=[ 23 39 49 37];
N_39=[ 24 40 50 30];
N_40=[ 25 41 51 39];
N_41=[26 42 52 40];
N_42=[27 43 53 41];
N_43=[28 20 19 42];
N_44=[ 4 45 31 3];
N_45=[54 46 32 44];
N_46=[ 55 47 33 45];
N_47=[ 56 48 34 46];
N_48=[ 8 9 35 47];
N_49=[ 38 50 14 13];
N_50=[ 39 51 57 49];
N_51=[ 40 52 58 50];
N_52=[ 41 53 59 51];
N_53=[ 42 19 18 52];
N_54=[ 5 55 45 4 ];
N_55=[ 60 7 55 5 ];
N_56=[ 7 8 47 55];
N_57=[ 50 58 15 14];
N_58=[51 59 61 57];
N_59=[ 52 18 17 58];
N_60=[ 6 7 55 5];
N_61=[58 17 16 15];
% 61x4 matrix
C=[N_1;N_2;N_3;N_4;N_5;N_6;N_7;N_8;N_9;N_10;N_11;N_12;N_13;N_14;...
N_15;N_16;N_17;N_18;N_19;N_20;N_21;N_22;N_23;N_24;N_25;N_26;N_27;N_28;N_29;...
N_30;N_31;N_32;N_33;N_34;N_35;N_36;N_37;N_38;N_39;N_40;N_41;N_42;N_43;...
N_44;N_45;N_46;N_47;N_48;N_49;N_50;N_51;N_52;N_53;N_54;N_55;N_56;N_57;N_58;...
N_59;N_60;N_61]
k=0.168:0.168:1.68;
for x=1:length(k)
if k(x)>=0.03 && k(x)<=0.06
h(x)=1.437*k(x)^(-0.279)
elseif k(x)>=0.07 && k(x)<=0.83
h(x)=5.313*k(x)^(-0.121)
else k(x)>=0.85 && k(x)<=1.68
h(x)=(-2.0945)*k(x)+7.0609
end
end
h
% for i=2:1:5
alr=Ka*(dy/dx)
alb=Ka*(dx/dy)
A=zeros(61,61);
for i=2:1:5
A(i,i)=((h(i))*(dz)*Ta)/(alb+alr)
A(i,C(i,2))=alr
A(i,C(i,3))=alb
end
for i=6
A(i,i)=2*(h(i)*dz/2)+alb
A(i,C(i,3))=alb
end
for i=7:1:10
A(i,i)=(h(i)*(dz)*Ta)/(alb+alr)
A(i,C(i,3))=alr
A(i,C(i,4))=alb
end
for i=11
A(i,i)=2*(h(i)*dz/2)+alr
A(i,C(i,4))=alr
end
for i=12:1:15
A(i,i)=(h(i)*(dz)*Ta)/(alb+alr)
A(i,C(i,1))=alr
A(i,C(i,2))=alb
end
for i=16
A(i,i)=2*(h(i)*dz/2)+alb
A(i,C(i,1))=alb
end
for i=17:1:20
A(i,i)=(h(i)*(dz)*Ta)/(alb+alr)
A(i,C(i,1))=alr
A(i,C(i,4))=alb
end
I need to put h value that is correctly coorsponse to correct Node, like I want A(2,2)to have h=6.5959, A(3,3)=6.0625,

1 Comment

A(2,2)=A(12,12)
A(3,3)=A(13,13)
A(4,4)=A(14,14)
and so on..

Sign in to comment.

 Accepted Answer

Hi,
You meant A(2,2) to have h=6.5929, A(3,3) to have h = 6.0625, correct?
If so, you can adjust your loop by adjusting index of h as i-1:
for i=2:1:5
A(i,i)=((h(i-1))*(dz)*Ta)/(alb+alr)
A(i,C(i,2))=alr
A(i,C(i,3))=alb
end
Your code does not run beyond h(10). Because the length of k is 10 and the number of compted values of h is also 10.
Moreover, [for .. end] loops for a single value of h are not needed, e.g.:
for i=6
A(i,i)=2*(h(i)*dz/2)+alb
A(i,C(i,3))=alb
end
can be computed with:
A(6,6)=2*(h(6)*dz/2)+alb;
A(6,C(6,3))=alb;

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!