好像乱码了。我直接copy上来。
#include "udf.h"
#include "metric.h"
#include "math.h"
#include "mem.h"
#include "sg_mem.h"
/关键参数设定*/
/模型参数/
#define TD 2288 /换热管数量/
#define IDUDF 57 /udf壁面编号/
#define N 887 /单根换热管轴向面网格单元数,个/
#define dy_min 0.008 /换热管轴向网格最小间距,m/
#define f_inc 1.005 /耦合迭代收敛性控制增益因子(备用)/
#define f_dec 0.995 /耦合迭代收敛性控制衰减因子(备用)/
#define nb_factor 0.32 /核态沸腾起始因子,用于初始化核态沸腾换热区起点/
#define fb_factor 0.61 /膜态沸腾起始因子,用于初始化膜态沸腾换热区起点/
#define spv_factor 0.71 /单相汽起始因子,用于初始化单相汽对流换热区起点/
#define p_start 0. /换热段起始坐标,用于壁温分段线性初始化,K/
#define p_end 26. /换热段终点坐标,用于壁温分段线性初始化,K/
#define Tw_in 533.15 /初始化入口处壁面温度,如比入口流体温度高50K,应同时保证低于饱和温度/
#define Tw_nb 640.4 /初始化沸腾起始点壁面温度,如比饱和温度高15K/
#define Tw_fb 665.4 /初始化膜态沸腾起始点壁面温度,如比饱和温度高40K/
#define Tw_spv 685.4 /初始化单相汽对流起始点壁面温度,如比饱和温度高60K/
#define Tw_out 725.4 /初始化出口处壁面温度,如比饱和温度高100K,应同时保证低于钠侧入口温度/
/工况参数/
#define Tl_in 483.15
#define dh_na 0.0396
#define di_water 0.01
#define Psat 17000000
#define Tsat 625.44
#define m_na 1608.24
#define m_water 0.067872
#define G_water 864.605
#define xcrt 0.357431664
/饱和参数/
#define rou_ls 565.18
#define rou_vs 119.48
#define mu_l_s 0.00006472
#define mu_v_s 0.00002418
#define Cp_l_s 10817.
#define Cp_v_s 18309.
#define K_l_s 0.43061
#define K_v_s 0.14174
#define h_l_s 1690035.
#define h_v_s 2547413.
#define hlin 903356.96
#define hv65382 2812819.
#define hv79182 3339351.
#define hfv 857376.9
#define sgm 0.00324
#define n 1.0
DEFINE_EXECUTE_ON_LOADING(on_loading, libname)
{
Set_User_Memory_Name(2,"U-Temperature_Water_Side");
Set_User_Memory_Name(12,"U-HTC_Water_Side");
}
DEFINE_ADJUST(cal_tl_htc, domain)
{
/换热管吸热量求解/
#if !RP_HOST
face_t f;
cell_t c;
Thread *t;
Thread *ct;
real x[ND_ND];
real A[ND_ND];
real brll,brtl,barea,Tall,Tgr,nalht,F,htcfc,htcnb,retp,S,pw,xtd,QTsub,QTsup,QT65382,QT79182,xjdg;
real mu_tw;
real Y[N] = {0.0100,0.0300,0.0500,0.0700,0.0900,0.1100,0.1300,0.1500,0.1700,0.1900,0.2040,0.2120,0.2200,0.2330,0.2512,0.2693,0.2873,0.3054,0.3236,0.3417,0.3598,0.3778,0.3960,0.4090,0.4170,0.4250,0.4398,0.4613,0.4827,0.5042,0.5257,0.5473,0.5688,0.5903,0.6118,0.6332,0.6547,0.6762,0.6977,0.7193,0.7340,0.7420,0.7500,0.7634,0.7823,0.8011,0.8200,0.8388,0.8577,0.8765,0.8954,0.9142,0.9331,0.9614,0.9991,1.0367,1.0745,1.1121,1.1350,1.1430,1.1510,1.1738,1.2115,1.2492,1.2869,1.3246,1.3623,1.4000,1.4377,1.4754,1.5131,1.5360,1.5440,1.5520,1.5748,1.6126,1.6502,1.6880,1.7256,1.7634,1.8010,1.8388,1.8764,1.9142,1.9370,1.9450,1.9530,1.9758,2.0136,2.0512,2.0890,2.1267,2.1644,2.2020,2.2397,2.2775,2.3152,2.3380,2.3460,2.3540,2.3768,2.4146,2.4523,2.4899,2.5277,2.5654,2.6030,2.6407,2.6785,2.7162,2.7390,2.7470,2.7550,2.7779,2.8156,2.8533,2.8909,2.9287,2.9664,3.0041,3.0417,3.0795,3.1172,3.1400,3.1480,3.1560,3.1788,3.2166,3.2543,3.2919,3.3296,3.3674,3.4051,3.4427,3.4805,3.5182,3.5410,3.5490,3.5570,3.5798,3.6176,3.6553,3.6930,3.7306,3.7684,3.8061,3.8438,3.8814,3.9192,3.9420,3.9500,3.9580,3.9808,4.0185,4.0563,4.0939,4.1316,4.1694,4.2070,4.2448,4.2824,4.3201,4.3430,4.3510,4.3590,4.3818,4.4195,4.4573,4.4949,4.5326,4.5703,4.6080,4.6458,4.6834,4.7211,4.7440,4.7520,4.7600,4.7828,4.8205,4.8583,4.8959,4.9337,4.9713,5.0090,5.0468,5.0844,5.1221,5.1450,5.1530,5.1610,5.1838,5.2215,5.2592,5.2969,5.3347,5.3723,5.4100,5.4478,5.4854,5.5231,5.5460,5.5540,5.5620,5.5848,5.6226,5.6602,5.6979,5.7357,5.7733,5.8110,5.8488,5.8864,5.9241,5.9470,5.9550,5.9630,5.9858,6.0236,6.0612,6.0989,6.1367,6.1743,6.2120,6.2498,6.2874,6.3252,6.3480,6.3560,6.3640,6.3868,6.4246,6.4622,6.4999,6.5377,6.5753,6.6130,6.6507,6.6884,6.7262,6.7490,6.7570,6.7650,6.7878,6.8256,6.8632,6.9009,6.9387,6.9763,7.0141,7.0517,7.0894,7.1272,7.1500,7.1580,7.1660,7.1888,7.2266,7.2642,7.3019,7.3397,7.3773,7.4151,7.4527,7.4904,7.5282,7.5510,7.5590,7.5670,7.5898,7.6276,7.6652,7.7030,7.7406,7.7783,7.8161,7.8537,7.8914,7.9292,7.9520,7.9600,7.9680,7.9908,8.0286,8.0662,8.1040,8.1417,8.1793,8.2171,8.2548,8.2924,8.3302,8.3530,8.3610,8.3690,8.3919,8.4296,8.4672,8.5050,8.5427,8.5803,8.6180,8.6558,8.6934,8.7311,8.7540,8.7620,8.7700,8.7928,8.8306,8.8682,8.9059,8.9437,8.9813,9.0191,9.0568,9.0944,9.1321,9.1550,9.1630,9.1710,9.1939,9.2316,9.2692,9.3070,9.3447,9.3823,9.4200,9.4578,9.4955,9.5331,9.5560,9.5640,9.5720,9.5948,9.6326,9.6702,9.7079,9.7457,9.7833,9.8210,9.8588,9.8965,9.9341,9.9570,9.9650,9.9730,9.9959,10.0336,10.0712,10.1090,10.1467,10.1844,10.2220,10.2598,10.2975,10.3351,10.3580,10.3660,10.3740,10.3969,10.4346,10.4722,10.5100,10.5477,10.5854,10.6230,10.6608,10.6985,10.7361,10.7590,10.7670,10.7750,10.7979,10.8356,10.8733,10.9109,10.9487,10.9864,11.0240,11.0617,11.0995,11.1371,11.1600,11.1680,11.1760,11.1988,11.2366,11.2743,11.3119,11.3497,11.3874,11.4250,11.4628,11.5005,11.5381,11.5610,11.5690,11.5770,11.5998,11.6376,11.6753,11.7129,11.7507,11.7884,11.8260,11.8638,11.9015,11.9391,11.9620,11.9700,11.9780,12.0008,12.0386,12.0763,12.1139,12.1517,12.1894,12.2270,12.2648,12.3025,12.3401,12.3630,12.3710,12.3790,12.4018,12.4396,12.4773,12.5149,12.5527,12.5904,12.6280,12.6658,12.7035,12.7411,12.7640,12.7720,12.7800,12.8028,12.8406,12.8783,12.9159,12.9537,12.9914,13.0290,13.0668,13.1045,13.1421,13.1650,13.1730,13.1810,13.2038,13.2416,13.2793,13.3169,13.3547,13.3924,13.4300,13.4678,13.5055,13.5431,13.5660,13.5740,13.5820,13.6048,13.6426,13.6803,13.7179,13.7557,13.7934,13.8310,13.8688,13.9065,13.9441,13.9670,13.9750,13.9830,14.0058,14.0436,14.0813,14.1189,14.1567,14.1944,14.2320,14.2698,14.3075,14.3451,14.3680,14.3760,14.3840,14.4068,14.4446,14.4823,14.5199,14.5577,14.5954,14.6330,14.6708,14.7085,14.7462,14.7690,14.7770,14.7850,14.8078,14.8456,14.8833,14.9209,14.9587,14.9964,15.0340,15.0717,15.1094,15.1472,15.1700,15.1780,15.1860,15.2088,15.2465,15.2843,15.3219,15.3596,15.3974,15.4351,15.4727,15.5105,15.5482,15.5710,15.5790,15.5870,15.6098,15.6476,15.6853,15.7229,15.7607,15.7984,15.8361,15.8737,15.9115,15.9492,15.9720,15.9800,15.9880,16.0108,16.0485,16.0863,16.1240,16.1616,16.1994,16.2371,16.2747,16.3125,16.3502,16.3730,16.3810,16.3890,16.4118,16.4496,16.4873,16.5250,16.5627,16.6003,16.6381,16.6758,16.7134,16.7512,16.7740,16.7820,16.7900,16.8128,16.8505,16.8883,16.9260,16.9636,17.0014,17.0391,17.0767,17.1145,17.1522,17.1750,17.1830,17.1910,17.2139,17.2516,17.2892,17.3270,17.3647,17.4023,17.4401,17.4778,17.5154,17.5532,17.5760,17.5840,17.5920,17.6149,17.6525,17.6903,17.7280,17.7656,17.8034,17.8411,17.8787,17.9165,17.9542,17.9770,17.9850,17.9930,18.0159,18.0536,18.0912,18.1290,18.1667,18.2043,18.2421,18.2798,18.3174,18.3552,18.3780,18.3860,18.3940,18.4168,18.4545,18.4923,18.5299,18.5676,18.6054,18.6431,18.6807,18.7185,18.7562,18.7790,18.7870,18.7950,18.8179,18.8556,18.8932,18.9310,18.9687,19.0063,19.0441,19.0818,19.1194,19.1572,19.1800,19.1880,19.1960,19.2189,19.2565,19.2943,19.3320,19.3696,19.4074,19.4451,19.4827,19.5205,19.5582,19.5810,19.5890,19.5970,19.6199,19.6576,19.6952,19.7330,19.7707,19.8083,19.8461,19.8837,19.9214,19.9592,19.9820,19.9900,19.9980,20.0208,20.0585,20.0963,20.1339,20.1716,20.2094,20.2471,20.2847,20.3225,20.3601,20.3830,20.3910,20.3990,20.4219,20.4596,20.4972,20.5350,20.5727,20.6103,20.6481,20.6858,20.7234,20.7612,20.7840,20.7920,20.8000,20.8229,20.8605,20.8983,20.9360,20.9736,21.0114,21.0490,21.0868,21.1245,21.1621,21.1850,21.1930,21.2010,21.2239,21.2616,21.2992,21.3370,21.3747,21.4123,21.4501,21.4878,21.5254,21.5632,21.5860,21.5940,21.6020,21.6249,21.6625,21.7003,21.7380,21.7757,21.8134,21.8510,21.8888,21.9265,21.9641,21.9870,21.9950,22.0030,22.0259,22.0636,22.1012,22.1390,22.1767,22.2143,22.2521,22.2898,22.3274,22.3652,22.3880,22.3960,22.4040,22.4269,22.4646,22.5023,22.5399,22.5777,22.6154,22.6530,22.6908,22.7285,22.7661,22.7890,22.7970,22.8050,22.8279,22.8656,22.9032,22.9410,22.9787,23.0163,23.0541,23.0917,23.1294,23.1672,23.1900,23.1980,23.2060,23.2288,23.2666,23.3043,23.3419,23.3797,23.4174,23.4550,23.4928,23.5305,23.5681,23.5910,23.5990,23.6070,23.6299,23.6676,23.7052,23.7430,23.7807,23.8183,23.8561,23.8938,23.9314,23.9692,23.9920,24.0000,24.0080,24.0308,24.0686,24.1063,24.1439,24.1817,24.2194,24.2570,24.2948,24.3325,24.3701,24.3930,24.4010,24.4090,24.4319,24.4696,24.5072,24.5450,24.5827,24.6203,24.6581,24.6958,24.7334,24.7712,24.7940,24.8020,24.8100,24.8328,24.8706,24.9083,24.9459,24.9837,25.0214,25.0590,25.0968,25.1345,25.1721,25.1950,25.2030,25.2110,25.2239,25.2417,25.2595,25.2773,25.2951,25.3129,25.3307,25.3485,25.3663,25.3841,25.4019,25.4197,25.4375,25.4553,25.4731,25.4909,25.5087,25.5265,25.5443,25.5621,25.5750,25.5830,25.5910,25.6040,25.6222,25.6403,25.6583,25.6765,25.6945,25.7127,25.7308,25.7488,25.7670,25.7800,25.7880,25.7960,25.8100,25.8300,25.8500,25.8700,25.8900,25.9100,25.9300,25.9500,25.9700,25.9900};
real QTF[N];
int count = 0;
int i=0;
int j=0;
int k=0;
int ii=0;
#endif
#if RP_NODE
QTsub=(h_l_s-hlin)*m_water;
QTsup=(h_v_s-hlin)*m_water;
QT65382=(hv65382-hlin)*m_water;
QT79182=(hv79182-hlin)*m_water;
nalht = 0.;
barea= 0.;
brll=0.;
xtd =0.;
F =0.;
htcfc =0.;
pw =0.;
htcnb =0.;
S =0.;
retp=0.;
xjdg=xcrt; //膜态沸腾临界含气率
for(i=0;i<TD;i++) //遍历每根换热管
{
count = 0;
t=Lookup_Thread(domain,IDUDF);
if (!t) {
Error("Thread IDUDF=%d not found!", IDUDF);
return;
}
//第一次遍历,计算每个管子中face的数量
begin_f_loop(f,t)
{
ct = F_C0_THREAD(f,t);
c = F_C0(f,t);
if(C_UDMI(c,ct,15)-i<=0.001) //如果属于第i根传热管
count++;
}
end_f_loop(f,t)
// 跳过空管(防止 malloc(0))
if(count == 0) continue;
// 分配存储空间
face_t *selected_faces;
if (count>0){
selected_faces = (face_t *)malloc(count * sizeof(face_t));
}
int index = 0;
// 第二次遍历:存储目标管上所有face的指针
begin_f_loop(f,t)
{
ct = F_C0_THREAD(f,t);
c = F_C0(f,t);
if(C_UDMI(c,ct,15)-i<=0.001) //如果属于第i根传热管
selected_faces[index++] = f;
}
end_f_loop(f,t)
// 重新遍历单根传热管
for(j=0;j<N;j++) //遍历轴向面上每个网格
{
for (ii = 0; ii < count; ii++)
{
face_t f = selected_faces[ii];
F_CENTROID(x,f,t);
if(x[2] <= Y[j]-1.1*dy_min) //判断网格节点是否匹配
nalht += -WALL_HEAT_FLUX(f, t); //累加每个网格的换热量
}
nalht = PRF_GRSUM1(nalht);
QTF[j] = nalht;
//if(myid==3)
// Message("Y=%f, QTF = %f,nalht = %f \n",Y[j],QTF[j],nalht);
nalht=0.;
}
/**耦合求解***/
for (ii = 0; ii < count; ii++)
{
face_t f = selected_faces[ii];
F_CENTROID(x,f,t);
c = F_C0(f,t);
F_AREA(A,f,t);
ct = F_C0_THREAD(f,t);
barea = NV_MAG(A);
brll= -WALL_HEAT_FLUX(f,t);
brtl=brll/barea;
Tall=F_T(f,t);
for(j=0;j<N;j++)
{
if(fabs(x[2]-Y[j]) < 0.2*dy_min)
{
C_UDMI(c,ct,0) = QTF[j]/*+(-WALL_HEAT_FLUX(f,t)*24*0.85)*/; //C_UDMI(c,ct,0)=传热量
//if(x[0]<1.423440e-3 && x[0]>0 && x[2]<0)
// Message("y=%f,Y=%f,QTF =%f,C_UDMI(c,ct,14)=%f,myid=%d \n",x[1],Y[j],QTF[j],C_UDMI(c,ct,14),myid);
}
}
//if(x[0]<1.423440e-3 && x[0]>0 && x[2]<0)
// Message("y=%f,Y=%f,QTF =%f,C_UDMI(c,ct,14)=%f\n",x[1],Y[j],QTF[j],C_UDMI(c,ct,14));
if(C_UDMI(c,ct,2)<=Tl_in) C_UDMI(c,ct,2)=Tl_in; if(C_UDMI(c,ct,2)>=791.82) C_UDMI(c,ct,2) = 791.82; //C_UDMI(c,ct,2)=温度,K
if(C_UDMI(c,ct,3)<=0) C_UDMI(c,ct,3)=0.000001;if(C_UDMI(c,ct,3)>=1) C_UDMI(c,ct,3)=1; //C_UDMI(c,ct,3)=含气率
if(C_UDMI(c,ct,0)<=0) //传热量
{
C_UDMI(c,ct,1)=0; //负传热区
C_UDMI(c,ct,3)=0;
C_UDMI(c,ct,4)=0;
C_UDMI(c,ct,0)=0;
C_UDMI(c,ct,2)= -59.232*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,3)+157.04*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,2)+82.372*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,1)+324.19;
if(C_UDMI(c,ct,2)>=Tsat)
C_UDMI(c,ct,2) = Tsat;
if(C_UDMI(c,ct,2)<Tl_in)
C_UDMI(c,ct,2) = Tl_in;
/*if(C_UDMI(c,ct,2)>=Tall)
C_UDMI(c,ct,2) = f_dec*Tall;*/
C_UDMI(c,ct,5)=-0.0000731372*pow(C_UDMI(c,t,2),3)+0.11175*pow(C_UDMI(c,t,2),2)-58.15118*C_UDMI(c,t,2)+11121.29394; //C_UDMI(c,ct,5)=密度
C_UDMI(c,ct,6)=-0.0000000000145502*pow(C_UDMI(c,t,2),3)+0.0000000245354*pow(C_UDMI(c,t,2),2)-0.0000141776*C_UDMI(c,t,2)+0.00289; //C_UDMI(c,ct,6)=粘度
C_UDMI(c,ct,7)=-0.0000000278887*pow(C_UDMI(c,t,2),3)+0.0000382479*pow(C_UDMI(c,t,2),2)-0.01819*C_UDMI(c,t,2)+3.67367; //C_UDMI(c,ct,7)=热导率
C_UDMI(c,ct,8)=1.58939572558845E-06*pow(C_UDMI(c,t,2),5)-0.00426225564860069*pow(C_UDMI(c,t,2),4)+4.56374090199481*pow(C_UDMI(c,t,2),3)-2438.73022173804*pow(C_UDMI(c,t,2),2)+650360.432339001*C_UDMI(c,t,2)-69238389.168302; //C_UDMI(c,ct,8)=定压比热容
C_UDMI(c,ct,9)=G_water/C_UDMI(c,ct,5); //C_UDMI(c,ct,9)=流速
C_UDMI(c,ct,10)=C_UDMI(c,ct,5)*C_UDMI(c,ct,9)*di_water/C_UDMI(c,ct,6); //C_UDMI(c,ct,10)=雷诺数
C_UDMI(c,ct,11)=C_UDMI(c,ct,6)*C_UDMI(c,ct,8)/C_UDMI(c,ct,7); //C_UDMI(c,ct,11)=普朗特数
C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.4)*C_UDMI(c,ct,7)/di_water; //C_UDMI(c, ct, 12)=DB公式换热系数
C_UDMI(c,ct,14) = C_UDMI(c,ct,12); //C_UDMI(c,ct,14)=换热系数
}
if( C_UDMI(c,ct,0)<=QTsub && C_UDMI(c,ct,0)>0) //单相水
{
C_UDMI(c,ct,1)=1;//C_UDMI(c,ct,1)=换热区域编号,1过冷,2泡核,3膜态,4饱和
C_UDMI(c,ct,3)=0;
C_UDMI(c,ct,4)=0; //C_UDMI(c,ct,4)=空泡份额
C_UDMI(c,ct,2)=-59.232*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,3)+157.04*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,2)+82.372*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,1)+324.19;
if(C_UDMI(c,ct,2)>=Tsat)
C_UDMI(c,ct,2) = Tsat;
//if(C_UDMI(c,ct,2)>=Tall)
// C_UDMI(c,ct,2) = f_dec*Tall;
C_UDMI(c,ct,5)=-0.0000731372*pow(C_UDMI(c,t,2),3)+0.11175*pow(C_UDMI(c,t,2),2)-58.15118*C_UDMI(c,t,2)+11121.29394; //C_UDMI(c,ct,5)=密度
C_UDMI(c,ct,6)=-0.0000000000145502*pow(C_UDMI(c,t,2),3)+0.0000000245354*pow(C_UDMI(c,t,2),2)-0.0000141776*C_UDMI(c,t,2)+0.00289; //C_UDMI(c,ct,6)=粘度
C_UDMI(c,ct,7)=-0.0000000278887*pow(C_UDMI(c,t,2),3)+0.0000382479*pow(C_UDMI(c,t,2),2)-0.01819*C_UDMI(c,t,2)+3.67367; //C_UDMI(c,ct,7)=热导率
C_UDMI(c,ct,8)=1.58939572558845E-06*pow(C_UDMI(c,t,2),5)-0.00426225564860069*pow(C_UDMI(c,t,2),4)+4.56374090199481*pow(C_UDMI(c,t,2),3)-2438.73022173804*pow(C_UDMI(c,t,2),2)+650360.432339001*C_UDMI(c,t,2)-69238389.168302; //C_UDMI(c,ct,8)=定压比热容
C_UDMI(c,ct,9)=G_water/C_UDMI(c,ct,5);
C_UDMI(c,ct,10)=C_UDMI(c,ct,5)*C_UDMI(c,ct,9)*di_water/C_UDMI(c,ct,6);
C_UDMI(c,ct,11)=C_UDMI(c,ct,6)*C_UDMI(c,ct,8)/C_UDMI(c,ct,7);
C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.4)*C_UDMI(c,ct,7)/di_water;
C_UDMI(c,ct,14) = C_UDMI(c,ct,12);
}
if( C_UDMI(c,ct,0)>QTsub && C_UDMI(c,ct,0)<QTsup && C_UDMI(c,ct,3)> xjdg) //膜态沸腾
{
C_UDMI(c,ct,1)=3;
C_UDMI(c,ct,2) = Tsat;
C_UDMI(c,ct,3)=(C_UDMI(c,ct,0)/m_water+hlin-h_l_s)/hfv ;//平衡含汽率
if(C_UDMI(c,ct,3)>1) C_UDMI(c,ct,3)=1; if(C_UDMI(c,ct,3)<0) C_UDMI(c,ct,3)=0.00001;
C_UDMI(c,ct,4)=1/(1+(1-C_UDMI(c,ct,3))/C_UDMI(c,ct,3)*rou_vs/rou_ls);
C_UDMI(c,ct,5)=rou_vs*C_UDMI(c,ct,4)+rou_ls*(1-C_UDMI(c,ct,4)); //均相流
C_UDMI(c,ct,6)=mu_v_s*C_UDMI(c,ct,4)+mu_l_s*(1-C_UDMI(c,ct,4));
C_UDMI(c,ct,7)=K_v_s*C_UDMI(c,ct,4)+K_l_s*(1-C_UDMI(c,ct,4));
C_UDMI(c,ct,8)=Cp_v_s*C_UDMI(c,ct,4)+Cp_l_s*(1-C_UDMI(c,ct,4));
//C_UDMI(c,ct,6)=-4.842954771e-6+4.415494732e-8*Tall;
//C_UDMI(c,ct,7)=4.962527816-0.01961204*Tall+0.0000261092*pow(Tall,2)-0.0000000115221*pow(Tall,3);
//C_UDMI(c,ct,8)=1158168.03485404-4651.253221*Tall+6.23591198*pow(Tall,2)-0.002783744*pow(Tall,3);
C_UDMI(c,ct,9)=G_water/C_UDMI(c,ct,5);
C_UDMI(c,ct,10)=C_UDMI(c,ct,5)*C_UDMI(c,ct,9)*di_water/C_UDMI(c,ct,6);
C_UDMI(c,ct,11)=C_UDMI(c,ct,6)*C_UDMI(c,ct,8)/C_UDMI(c,ct,7);
C_UDMI(c,ct,12)=0.0193*pow(G_water*C_UDMI(c,ct,3)*di_water/mu_v_s,0.8)*pow(mu_v_s*Cp_v_s/K_v_s,1.23)*pow((rou_vs/(rou_vs*C_UDMI(c,ct,4)+rou_ls*(1-C_UDMI(c,ct,4)))),0.68)*pow(rou_vs/rou_ls,0.068)*K_v_s/di_water;
C_UDMI(c,ct,14)=0.021*pow(G_water*C_UDMI(c,ct,3)*di_water/mu_v_s,0.8)*pow(C_UDMI(c,ct,11),0.43)*(1-0.1*pow((rou_ls/rou_vs-1)*(1-C_UDMI(c,ct,3)),0.4))*pow(C_UDMI(c,ct,3)+rou_ls/rou_vs*(1-C_UDMI(c,ct,3)),0.8);
}
if( C_UDMI(c,ct,0)>QTsub && C_UDMI(c,ct,0)<QTsup && C_UDMI(c,ct,3)<=xjdg) //泡核沸腾
{
C_UDMI(c,ct,1)=2;
C_UDMI(c,ct,2) = Tsat;
C_UDMI(c,ct,3)=(C_UDMI(c,ct,0)/m_water+hlin-h_l_s)/hfv ;
if(C_UDMI(c,ct,3)>=1) C_UDMI(c,ct,3)=1.0; if(C_UDMI(c,ct,3)<=0) C_UDMI(c,ct,3)=0.00001;
C_UDMI(c,ct,4)=1/(1+(1-C_UDMI(c,ct,3))/C_UDMI(c,ct,3)*rou_vs/rou_ls);
C_UDMI(c,ct,5)=rou_vs*C_UDMI(c,ct,4)+rou_ls*(1-C_UDMI(c,ct,4));
C_UDMI(c,ct,6)=mu_v_s*C_UDMI(c,ct,4)+mu_l_s*(1-C_UDMI(c,ct,4));
C_UDMI(c,ct,7)=K_v_s*C_UDMI(c,ct,4)+K_l_s*(1-C_UDMI(c,ct,4));
C_UDMI(c,ct,8)=Cp_v_s*C_UDMI(c,ct,4)+Cp_l_s*(1-C_UDMI(c,ct,4));
C_UDMI(c,ct,9)=G_water/C_UDMI(c,ct,5);
C_UDMI(c,ct,10)=C_UDMI(c,ct,5)*C_UDMI(c,ct,9)*di_water/C_UDMI(c,ct,6);
C_UDMI(c,ct,11)=C_UDMI(c,ct,6)*C_UDMI(c,ct,8)/C_UDMI(c,ct,7);
xtd = pow(C_UDMI(c,ct,3)/(1-C_UDMI(c,ct,3)),0.9)*pow(rou_ls/rou_vs,0.5)*pow(mu_v_s/mu_l_s,0.1);
if(xtd>0.1)
{F=2.35*pow((xtd+0.213),0.736);}
else
{F=1.;}
htcfc=0.023*K_l_s/di_water*pow((G_water*(1-C_UDMI(c,ct,3))*di_water/mu_l_s),0.8)*pow((mu_l_s*Cp_l_s/K_l_s),0.4)*F;
retp=G_water*(1-C_UDMI(c,ct,3))*di_water/mu_l_s*pow(F,1.25)/10000;
if(retp<32.5) S=1/(1+0.12*pow(retp,1.14));
if(retp>=32.5&&retp<70) S=1/(1+0.42*pow(retp,0.78));
if(retp>=70) S=0.1;
if(Tall<646.)
{
pw = 299581676.5-1112854.9*Tall + 1056.9284*pow(Tall,2);
pw = pw>=Psat? pw:Psat;
}
else
pw = 22115000.;
Tgr = Tall-Tsat;
if(Tgr<=0)
Tgr=0.;
htcnb=0.00122*S*pow(Tgr,0.24)*pow((pw-Psat),0.75)*pow(Cp_l_s,0.45)*pow(rou_ls,0.49)*pow(K_l_s,0.79)/(pow(sgm,0.5)*pow(hfv,0.24)*pow(mu_l_s,0.29)*pow(rou_vs,0.24));
C_UDMI(c,ct,12) = pow(pow(htcfc,n)+pow(htcnb,n),1/n);
C_UDMI(c,ct,14) = htcfc+htcnb;
xtd =0.;
F =0.;
htcfc =0.;
pw =0.;
htcnb =0.;
S =0.;
retp=0.;
}
if(C_UDMI(c,ct,0) >= QTsup && C_UDMI(c,ct,0) <= QT65382) //单相汽
{
C_UDMI(c,ct,1)=4;
C_UDMI(c,ct,3)=1;
C_UDMI(c,ct,4)=1;
//C_UDMI(c,ct,2)=(-47513.190209+pow((pow(47513.190209,2)-4*(-32.65115792)*(-14182632.67-hlin-C_UDMI(c,ct,0)/m_water)),0.5))/(-32.65115792*2);
//C_UDMI(c,ct,2)=(-80531.30434781+pow(80531.30434781*80531.30434781-4*(-58.7944664 )*(-24601481.9069136-(hlin+C_UDMI(c,ct,0)/m_water)),0.5))/(-58.7944664 *2);
C_UDMI(c,ct,2)=15.75*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,3)+74.564*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,2)-632.88*(C_UDMI(c,ct,0)/m_water+hlin)/1e6+1496.8;
if(C_UDMI(c,ct,2)<=Tsat)
C_UDMI(c,ct,2) = Tsat;
if(C_UDMI(c,ct,2)>=653.82)
C_UDMI(c,ct,2) = 653.82;
C_UDMI(c,ct,5)=-0.0000768859547860944*pow(C_UDMI(c,t,2),3)+0.164068505626203*pow(C_UDMI(c,t,2),2)-116.820593637976*C_UDMI(c,t,2)+27823.3434320337;
C_UDMI(c,ct,6)=-1.15138327125887E-12*pow(C_UDMI(c,t,2),3)+2.47167061066652E-09*pow(C_UDMI(c,t,2),2)-1.72523309775328E-06*C_UDMI(c,t,2)+0.000417905039504174;
mu_tw=-4.842954771e-6+4.415494732e-8*Tall;
C_UDMI(c,ct,7)=1.64756047401987E-09*pow(C_UDMI(c,t,2),4)-4.66295787905828E-06*pow(C_UDMI(c,t,2),3)+0.00494746512861121*pow(C_UDMI(c,t,2),2)-2.33242356172728*C_UDMI(c,t,2)+412.339466304253;
C_UDMI(c,ct,8)=0.000827737277387106*pow(C_UDMI(c,t,2),4)-2.31871761943198*pow(C_UDMI(c,t,2),3)+2433.72280465395*pow(C_UDMI(c,t,2),2)-1134380.21513071*C_UDMI(c,t,2)+198127195.165049;
C_UDMI(c,ct,9)=G_water/C_UDMI(c,ct,5);
C_UDMI(c,ct,10)=C_UDMI(c,ct,5)*C_UDMI(c,ct,9)*di_water/C_UDMI(c,ct,6);
C_UDMI(c,ct,11)=C_UDMI(c,ct,6)*C_UDMI(c,ct,8)/C_UDMI(c,ct,7);
C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.4)*C_UDMI(c,ct,7)/di_water;
//C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.33)*C_UDMI(c,ct,7)*pow(C_UDMI(c,ct,6)/mu_tw,0.14)/di_water;
C_UDMI(c,ct,14) = C_UDMI(c,ct,12);
}
if(C_UDMI(c,ct,0)>QT65382 && C_UDMI(c,ct,0)<= QT79182 )
{
C_UDMI(c,ct,1)=4;
C_UDMI(c,ct,3)=1;
C_UDMI(c,ct,4)=1;
C_UDMI(c,ct,2)=-85.051*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,3)+959.84*pow((C_UDMI(c,ct,0)/m_water+hlin)/1e6,2)-3225.4*(C_UDMI(c,ct,0)/m_water+hlin)/1e6+4028.5;
if(C_UDMI(c,ct,2)<=653.82)
C_UDMI(c,ct,2) = 653.82;
if(C_UDMI(c,ct,2)>=791.82)
C_UDMI(c,ct,2) = 791.82;
//if(C_UDMI(c,ct,2)>=Tall)
// C_UDMI(c,ct,2) = f_dec*Tall;
C_UDMI(c,ct,5)=-0.0000768859547860944*pow(C_UDMI(c,t,2),3)+0.164068505626203*pow(C_UDMI(c,t,2),2)-116.820593637976*C_UDMI(c,t,2)+27823.3434320337;
C_UDMI(c,ct,6)=-1.15138327125887E-12*pow(C_UDMI(c,t,2),3)+2.47167061066652E-09*pow(C_UDMI(c,t,2),2)-1.72523309775328E-06*C_UDMI(c,t,2)+0.000417905039504174;
mu_tw=-4.842954771e-6+4.415494732e-8*Tall;
C_UDMI(c,ct,7)=1.64756047401987E-09*pow(C_UDMI(c,t,2),4)-4.66295787905828E-06*pow(C_UDMI(c,t,2),3)+0.00494746512861121*pow(C_UDMI(c,t,2),2)-2.33242356172728*C_UDMI(c,t,2)+412.339466304253;
C_UDMI(c,ct,8)=0.000827737277387106*pow(C_UDMI(c,t,2),4)-2.31871761943198*pow(C_UDMI(c,t,2),3)+2433.72280465395*pow(C_UDMI(c,t,2),2)-1134380.21513071*C_UDMI(c,t,2)+198127195.165049;
C_UDMI(c,ct,9)=G_water/C_UDMI(c,ct,5);
C_UDMI(c,ct,10)=C_UDMI(c,ct,5)*C_UDMI(c,ct,9)*di_water/C_UDMI(c,ct,6);
C_UDMI(c,ct,11)=C_UDMI(c,ct,6)*C_UDMI(c,ct,8)/C_UDMI(c,ct,7);
C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.4)*C_UDMI(c,ct,7)/di_water;
//C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.33)*C_UDMI(c,ct,7)*pow(C_UDMI(c,ct,6)/mu_tw,0.14)/di_water;
C_UDMI(c,ct,14) = C_UDMI(c,ct,12);
}
if(C_UDMI(c,ct,0)>QT79182)
{
C_UDMI(c,ct,1)=4;
C_UDMI(c,ct,3)=1;
C_UDMI(c,ct,4)=1;
C_UDMI(c,ct,2)=791.82;
//if(C_UDMI(c,ct,2)>=Tall)
// C_UDMI(c,ct,2) = f_dec*Tall;
C_UDMI(c,ct,5)=-0.0000768859547860944*pow(C_UDMI(c,t,2),3)+0.164068505626203*pow(C_UDMI(c,t,2),2)-116.820593637976*C_UDMI(c,t,2)+27823.3434320337;
C_UDMI(c,ct,6)=-1.15138327125887E-12*pow(C_UDMI(c,t,2),3)+2.47167061066652E-09*pow(C_UDMI(c,t,2),2)-1.72523309775328E-06*C_UDMI(c,t,2)+0.000417905039504174;
mu_tw=-4.842954771e-6+4.415494732e-8*Tall;
C_UDMI(c,ct,7)=1.64756047401987E-09*pow(C_UDMI(c,t,2),4)-4.66295787905828E-06*pow(C_UDMI(c,t,2),3)+0.00494746512861121*pow(C_UDMI(c,t,2),2)-2.33242356172728*C_UDMI(c,t,2)+412.339466304253;
C_UDMI(c,ct,8)=0.000827737277387106*pow(C_UDMI(c,t,2),4)-2.31871761943198*pow(C_UDMI(c,t,2),3)+2433.72280465395*pow(C_UDMI(c,t,2),2)-1134380.21513071*C_UDMI(c,t,2)+198127195.165049;
C_UDMI(c,ct,9)=G_water/C_UDMI(c,ct,5);
C_UDMI(c,ct,10)=C_UDMI(c,ct,5)*C_UDMI(c,ct,9)*di_water/C_UDMI(c,ct,6);
C_UDMI(c,ct,11)=C_UDMI(c,ct,6)*C_UDMI(c,ct,8)/C_UDMI(c,ct,7);
C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.4)*C_UDMI(c,ct,7)/di_water;
//C_UDMI(c,ct,12)=0.023*pow(C_UDMI(c,ct,10),0.8)*pow(C_UDMI(c,ct,11),0.33)*C_UDMI(c,ct,7)*pow(C_UDMI(c,ct,6)/mu_tw,0.14)/di_water;
C_UDMI(c,ct,14) = C_UDMI(c,ct,12);
}
}
free(selected_faces); // 释放内存
selected_faces = NULL; // 防止悬垂指针
}
#endif
}
DEFINE_PROFILE(t_water,t,i)
{
face_t f;
cell_t c;
Thread *ct;
begin_f_loop(f,t)
{
ct = F_C0_THREAD(f,t);
c = F_C0(f,t);
F_PROFILE(f,t,i) = C_UDMI(c,ct,2);
}
end_f_loop(f,t)
}
DEFINE_PROFILE(hct_water,t,i)
{
face_t f;
cell_t c;
Thread *ct;
begin_f_loop(f,t)
{
ct = F_C0_THREAD(f,t);
c = F_C0(f,t);
F_PROFILE(f,t,i) = C_UDMI(c,ct,12);
}
end_f_loop(f,t)
}