UDF at the end
Hello,
i'm trying to define fluid density as a function of temperature and salinity (UDS0). Since has 2 parameters i need to define it at the end of the iteration. i wrote this but it's not working. Someone can help me? thanks #include "udf.h" #define a0 999.842594 #define a1 6.793953e-2 #define a2 -9.095290e-3 #define a3 1.001685e-4 #define a4 -1.120083e-6 #define a5 6.536332e-9 #define b0 8.2449e-1 #define b1 -4.0899e-3 #define b2 7.6438e-5 #define b3 -8.2467e-7 #define b4 5.3875e-9 #define c0 -5.7246e-3 #define c1 1.0227e-4 #define c2 -1.6546e-6 #define d0 4.8314e-4 real Temp , S , rho0 , B1 , C1 , rho; DEFINE_EXECUTE_AT_END(Density) { Domain *d; Thread *t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d); { begin_c_loop(c,t); { Temp = C_T(c,t); S = C_UDSI(c,t,0); rho0 = a0 + a1*Temp + a2*pow(Temp,2) + a3*pow(Temp,3) + a4*pow(Temp,4) + a5*pow(Temp,5); B1 = b0 + b1*Temp + b2*pow(Temp,2) + b3*pow(Temp,3) + b4*pow(Temp,4); C1 = c0 + c1*Temp + c2*pow(Temp,2); rho = rho0 + B1*S + C1*pow(S,1.5) + d0*pow(S,2); end_c_loop(c,t); } } } |
All times are GMT -4. The time now is 09:03. |