From: Todd on
I would like to set up a generic solution to a system of equations that calls a function to return fluid properties for use in the solution. I have included the system below including the function call - refpropm. I had attempted to begin using a symbolic solution method but had been hung up on calling the refprop function during solution.
I believe that a table look up method is required for an element of the solution, but am unsure how to implement. Your assistance is greatly appreciated.


h1=$ENTHALPY(3,fluid,'T,Tin,'P,Pin)
Ac=pi*Ri^2
Ao=pi*Do*L
Ai=pi*Di*L
S=(2*pi*L)/ln(Do/Di)

Q=m_dot*(h2-h1)

Q=Uo*Ao*(To-Ti)
Ti=(Tin+Tout)/2
Uo=1/(Ao/(Ai*hi)+(Ao*ln(Ro/Ri))/(2*pi*L*kw)+(1/ho))
Nui=(hi*Di)/ki
ki=$THERMCOND(3,fluid,'T,Ti,'P,Pi)

Nui=((f/2)*Rei*Pri)/(C+12.7*(f/2)*(Pri^(2/3)-1))
C=1.07+(900/Rei)-(0.63/(1+10*Pri))
f=0.00218+0.1143*Rei^(-4/3.2154)
Rei=(4*m_dot)/(pi*Di*mui)
Pri=$PRANDTL(3,fluid,'T,Ti,'P,Pi)
mui=$VISCOSITY(3,fluid,'T,Ti,'P,Pi)

Pi=(Pin+Pout)/2
Pout=Pin-deltaP
deltaP=((4*f*L)/Di+1.25)*(Gi^2/(2*gc*rhoi))
Gi=m_dot/Ac
rhoi=$DENSITY(3,fluid,'T,Ti,'P,Pi)

Nuo=(h0*Do)/katm
Tf=(T2+To)/2
katm=$THERMCOND(3,fluid2,'T,Tf,'P,Patm)
rhoatm=$DENSITY(3,fluid,'T,Tf,'P,Patm)
muatm=$VISCOSITY(3,fluid2,'T,Tf,'P,Patm)

Q=hi*Ai*(T1-Ti)
Q=S*kw*(T2-T1)

Tout=$TEMPERATURE(3,fluid,'H,h2,'P,Pout)

Reo=(rhoatm*Vinf*Do)/(muatm)
Nuo=Cg*Reo^n

Ro=Do/2
Ri=Di/2