help temperature profil
Hello
Help I want to introduce an array of temperature fonction of time as a boundary condition to simulate unsteady conduction problem by using udf I try this udf NNN time in hours /************************************************** ******************** unsteady.c UDF for specifying a transient temperature profile boundary condition TT temperature ************************************************** *********************/ #include "udf.h" DEFINE_PROFILE(unsteady_TEMP, thread, position) { face_t f; float t = CURRENT_TIME; float TT[24]; int NNN; int first = 1; TT[1]=31.2 + 273.; TT[2]=30.9 + 273.; TT[3]=30.3 + 273.; TT[4]=30. + 273.; TT[5]=29.6 + 273.; TT[6]=29.2 + 273.; TT[7]=29.8 + 273.; TT[8]=31.3 + 273.; TT[9]=32.9 + 273.; TT[10]=34.7 + 273.; TT[11]=36.1 + 273.; TT[12]=36.9 + 273.; TT[13]=37.6 + 273.; TT[14]=38.2 + 273.; TT[15]=38.2 + 273.; TT[16]=37.9 + 273.; TT[17]=37.7 + 273.; TT[18]=36.7 + 273.; TT[19]=35.3 + 273.; TT[20]=34.6 + 273.; TT[21]=33.9 + 273.; TT[22]=33.3 + 273.; TT[23]=32.6 + 273.; TT[24]=31.9 + 273.; begin_f_loop(f, thread) { t = CURRENT_TIME; if (first == 1){ first_iteration=0; if(t < 3600.) { NNN = 1; F_PROFILE(f, thread, position) = TT[NNN]; } else if ((t == (NNN*3600.)) && (NNN <= 23) ){ NNN++; F_PROFILE(f, thread, position) = TT[NNN]; printf("\n NNN=%d fprofil=%f t=%f\n",NNN,F_PROFILE(f, thread, position),t); } } } end_f_loop(f, thread) } |
help temperature profil
Hello
Help I want to introduce an array of temperature fonction of time as a boundary condition to simulate unsteady conduction problem by using udf I try this udf /************************************************** ******************** unsteady.c UDF for specifying a transient temperature profile boundary condition TT temperature NNN time in hours ************************************************** *********************/ #include "udf.h" DEFINE_PROFILE(unsteady_TEMP, thread, position) { face_t f; float t = CURRENT_TIME; float TT[24]; int NNN; int first = 1; TT[1]=31.2 + 273.; TT[2]=30.9 + 273.; TT[3]=30.3 + 273.; TT[4]=30. + 273.; TT[5]=29.6 + 273.; TT[6]=29.2 + 273.; TT[7]=29.8 + 273.; TT[8]=31.3 + 273.; TT[9]=32.9 + 273.; TT[10]=34.7 + 273.; TT[11]=36.1 + 273.; TT[12]=36.9 + 273.; TT[13]=37.6 + 273.; TT[14]=38.2 + 273.; TT[15]=38.2 + 273.; TT[16]=37.9 + 273.; TT[17]=37.7 + 273.; TT[18]=36.7 + 273.; TT[19]=35.3 + 273.; TT[20]=34.6 + 273.; TT[21]=33.9 + 273.; TT[22]=33.3 + 273.; TT[23]=32.6 + 273.; TT[24]=31.9 + 273.; begin_f_loop(f, thread) { t = CURRENT_TIME; if (first == 1){ first=0; if(t < 3600.) { NNN = 1; F_PROFILE(f, thread, position) = TT[NNN]; } else if ((t == (NNN*3600.)) & (NNN <= 23) ){ NNN++; F_PROFILE(f, thread, position) = TT[NNN]; printf("\n NNN=%d fprofil=%f t=%f\n",NNN,F_PROFILE(f, thread, position),t); } } } end_f_loop(f, thread) } |
Hi, try this. Not sure if it is OK.
DEFINE_PROFILE(unsteady_TEMP, thread, position) { real x[ND_ND]; real y; face_t f; float TT[24]; int NNN; float time; TT[1]=31.2 + 273.; TT[2]=30.9 + 273.; TT[3]=30.3 + 273.; TT[4]=30. + 273.; TT[5]=29.6 + 273.; TT[6]=29.2 + 273.; TT[7]=29.8 + 273.; TT[8]=31.3 + 273.; TT[9]=32.9 + 273.; TT[10]=34.7 + 273.; TT[11]=36.1 + 273.; TT[12]=36.9 + 273.; TT[13]=37.6 + 273.; TT[14]=38.2 + 273.; TT[15]=38.2 + 273.; TT[16]=37.9 + 273.; TT[17]=37.7 + 273.; TT[18]=36.7 + 273.; TT[19]=35.3 + 273.; TT[20]=34.6 + 273.; TT[21]=33.9 + 273.; TT[22]=33.3 + 273.; TT[23]=32.6 + 273.; TT[24]=31.9 + 273.; begin_f_loop(f, thread) { F_CENTROID(x, f, thread); y = x[1]; time = CURRENT_TIME/3600; if (time>=24.) // you need to fix it ; else if (time >= 23.) NNN=23; else if (time >= 22.) NNN=22; //and so on . . . F_PROFILE(f, thread, position) = TT[NNN]; } end_f_loop(f,thread) } another way Im not sure if it is possible is to declare variable NNN as integer and set NNN=CURRENT_TIME/3600; (and take care about NNN=0) |
It’s very good idea
Thank you very much |
All times are GMT -4. The time now is 20:22. |