forked from yijianzeng/STEMMUS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Air_EQ.m
64 lines (55 loc) · 2.44 KB
/
Air_EQ.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function Air_EQ
global ARG1 ARG2 ARG3 ARG4 ARG5 ARG6
global MN ML ND NL NN Delt_t RHS T TT h hh P_g SAVE
global C1 C2 C3 C4 C5 C6 C7 Thmrlefc C4_a C5_a
if Thmrlefc
RHS(1)=-C7(1)+(C3(1,1)*P_g(1)+C3(1,2)*P_g(2))/Delt_t ...
-(C2(1,1)/Delt_t+C5(1,1))*TT(1)-(C2(1,2)/Delt_t+C5(1,2))*TT(2) ...
-(C1(1,1)/Delt_t+C4(1,1))*hh(1)-(C1(1,2)/Delt_t+C4(1,2))*hh(2) ...
+(C2(1,1)/Delt_t)*T(1)+(C2(1,2)/Delt_t)*T(2) ...
+(C1(1,1)/Delt_t)*h(1)+(C1(1,2)/Delt_t)*h(2);
for ML=2:NL
ARG1=C2(ML-1,2)/Delt_t;
ARG2=C2(ML,1)/Delt_t;
ARG3=C2(ML,2)/Delt_t;
ARG4=C1(ML-1,2)/Delt_t;
ARG5=C1(ML,1)/Delt_t;
ARG6=C1(ML,2)/Delt_t;
RHS(ML)=-C7(ML)+(C3(ML-1,2)*P_g(ML-1)+C3(ML,1)*P_g(ML)+C3(ML,2)*P_g(ML+1))/Delt_t ...
-(ARG1+C5_a(ML-1))*TT(ML-1)-(ARG2+C5(ML,1))*TT(ML)-(ARG3+C5(ML,2))*TT(ML+1) ...
-(ARG4+C4_a(ML-1))*hh(ML-1)-(ARG5+C4(ML,1))*hh(ML)-(ARG6+C4(ML,2))*hh(ML+1) ...
+ARG1*T(ML-1)+ARG2*T(ML)+ARG3*T(ML+1) ...
+ARG4*h(ML-1)+ARG5*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