|
[Sponsors] |
UDF heat flux boundary conditions (heat fulx - convective losses - radiation losses) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 31, 2021, 06:27 |
UDF heat flux boundary conditions (heat fulx - convective losses - radiation losses)
|
#1 |
New Member
Jose Martin
Join Date: Jan 2021
Posts: 11
Rep Power: 5 |
Hi folks,
I am creating my first UDF and I have a big problem, I do not understand how to read the face wall temperature . Can anyone help me?. The code is almost ready except how to input this temperature. Many thanks in advance. PS: If i set up temperature at 500 K all calculus are ok, but I would need to read the real one! UDF below! #include "udf.h" #define QMAX 407400 /* W/m2 */ #define EEPSILON 0.1 #define TAU 5.67e-8 #define T_AIRE 300 #define H_AIRE 40 /* convective coef.W/m2K */ /* profile for heat flux*/ DEFINE_PROFILE(heatflux_profile, t, i) { /* variable declaration */ real centroide[ND_ND]; /* vector position */ real x; real y; face_t f; cell_t cell; real seno; /* heat distribution */ real T_p; /* wall temperature */ begin_f_loop(f, t) { F_CENTROID(centroide,f,t); x=centroide[0]; /* valor del cntroide en la componente x */ y=centroide[1]; /* valor del cntroide en la componente y */ seno=y/sqrt((x*x)+(y*y)); T_p = 500; /* I NEED TO FIND THE FUNCTION IN ORDER TO READ THE WALL TEMPERATURE */ if (0 < y) { F_PROFILE(f,t,i)=(QMAX*seno)+TAU*((T_p*T_p*T_p*T_p )-(EEPSILON*T_AIRE*T_AIRE*T_AIRE*T_AIRE))+H_AIRE*(T_ p-T_AIRE); } else { F_PROFILE(f,t,i)=0; } } end_f_loop(f, t) } |
|
January 31, 2021, 08:44 |
|
#2 |
New Member
Jose Martin
Join Date: Jan 2021
Posts: 11
Rep Power: 5 |
Small correction:
#include "udf.h" #define QMAX 407400 /* W/m2 */ #define EEPSILON 0.1 #define TAU 5.67e-8 #define T_AIRE 300 #define H_AIRE 40 /* convective coef.W/m2K */ /* profile for heat flux*/ DEFINE_PROFILE(heatflux_profile, t, i) { /* variable declaration */ real centroide[ND_ND]; /* vector position */ real x; real y; face_t f; cell_t cell; real seno; /* heat distribution */ real T_p; /* wall temperature */ begin_f_loop(f, t) { F_CENTROID(centroide,f,t); x=centroide[0]; /* valor del cntroide en la componente x */ y=centroide[1]; /* valor del cntroide en la componente y */ seno=y/sqrt((x*x)+(y*y)); T_p = 500; /* I NEED TO FIND THE FUNCTION IN ORDER TO READ THE WALL TEMPERATURE, DO NOT WHY F_T(f,t) DOES NOT WORK */ if (0 < y) { F_PROFILE(f,t,i)=(QMAX*seno)-TAU*((T_p*T_p*T_p*T_p )-(EEPSILON*T_AIRE*T_AIRE*T_AIRE*T_AIRE))-H_AIRE*(T_ p-T_AIRE); } else { F_PROFILE(f,t,i)=0; } } end_f_loop(f, t) } |
|
January 31, 2021, 08:59 |
|
#3 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You say F_T does not work, but can you be more specific? What happens if you do that?
|
|
January 31, 2021, 09:12 |
|
#4 |
New Member
Jose Martin
Join Date: Jan 2021
Posts: 11
Rep Power: 5 |
Sure!! (btw many thanks!!! I am really stacked). And just one comment, the mesh I have is not good because I was trying to run the UDF and then I was gonna work on the mesh and so on, hope it is not the problem because when I set up T_p = 500 K it works...
Please find below the error , it seems it´s about the UDF in line 21 "Divergence detected in AMG solver: temperatureWarning: C:\\Users\\usuario\\Desktop\\udf\\heatflux_profile - copia (21).c: line 21: Warning: C:\\Users\\usuario\\Desktop\\udf\\heatflux_profile - copia (21).c: line 21: Warning: C:\\Users\\usuario\\Desktop\\udf\\heatflux_profile - copia (21).c: line 21: Error at host: floating point exception Warning: C:/Users/usuario/AppData/Local/Temp/heatflux_profile - copia (21).c.19192.0.c: line 21: Warning: C:/Users/usuario/AppData/Local/Temp/heatflux_profile - copia (21).c.19192.0.c: line 21: Warning: C:/Users/usuario/AppData/Local/Temp/heatflux_profile - copia (21).c.19192.0.c: line 21: Error at Node 0: floating point exception Error: floating point exception Error Object: #f Registering Udf, ("C:\Users\usuario\Desktop\udf\heatflux_profile - copia (21).c") Calculation complete." That´s the UDF I have used with the right function to read the wall temperature #include "udf.h" #define R 0.01 #define QMAX 40740 /* W/m2 */ #define EEPSILON 0.1 #define TAU 5.67e-8 #define T_AIRE 300 #define H_AIRE 40 /* profile for heat flux*/ DEFINE_PROFILE(BC, t, i) { /* declaración de variables */ real centroide[ND_ND]; /* vector de posición */ real x; real y; face_t f; cell_t cell; real seno; /* para meter la distribucion de calor */ real T_p; /* temperatura de la pared */ begin_f_loop(f, t) { F_CENTROID(centroide,f,t); x=centroide[0]; /* valor del cntroide en la componente x */ y=centroide[1]; /* valor del cntroide en la componente y */ seno=y/sqrt((x*x)+(y*y)); T_p = F_T(f,t); if (0 < y) { F_PROFILE(f,t,i)=(QMAX*seno)-TAU*((T_p*T_p*T_p*T_p)-(EEPSILON*T_AIRE*T_AIRE*T_AIRE*T_AIRE))-H_AIRE*(T_p-T_AIRE); } else { F_PROFILE(f,t,i)=0; } } end_f_loop(f, t) } |
|
January 31, 2021, 12:21 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Is that in the first iteration?
And try this: initialize your simulation, don't run, and plot the heat Flux on your relevant boundary. Is that what you expected? |
|
January 31, 2021, 13:19 |
|
#6 |
New Member
Jose Martin
Join Date: Jan 2021
Posts: 11
Rep Power: 5 |
Hi Pakk, I think it was the mesh.... I cannot beleive it... I am running the simulation, but first checks seems good.... I will replay in a few hours heheheh.... I created a good mesh, but now I dont have the floating point (it was in the second iteration BTW)
|
|
January 31, 2021, 15:56 |
|
#7 |
New Member
Jose Martin
Join Date: Jan 2021
Posts: 11
Rep Power: 5 |
Just to close out this issue, I guess there were two different problems:
1) The mesh 2) just in case I created alll "z" coordinates in the positive side, just in case Additionally, a pair of formulas were not ok, but it was not the problem... Below the UDF for a tube of a solar receiver, were you can see the heat flux, and the two losses (convective and radiation) #include "udf.h" #define QMAX 407400 /* W/m2 */ #define EEPSILON 0.9 #define TAU 5.67e-8 #define T_AIRE 300 #define H_AIRE 40 /* profile for heat flux*/ DEFINE_PROFILE(receiver, t, i) { /* declaración de variables */ real centroide[ND_ND]; /* vector de posición */ real x; real y; face_t f; cell_t cell; real seno; /* para meter la distribucion de calor */ real T_p; /* temperatura de la pared */ begin_f_loop(f, t) { F_CENTROID(centroide,f,t); x=centroide[0]; /* valor del cntroide en la componente x */ y=centroide[1]; /* valor del cntroide en la componente y */ seno=y/sqrt((x*x)+(y*y)); T_p=F_T(f,t); /*500*/ if (0 < y) { F_PROFILE(f,t,i)=(QMAX*seno)-TAU*((T_p*T_p*T_p*T_p)-(EEPSILON*T_p*T_p*T_p*T_p))-H_AIRE*(T_p-T_AIRE); } else { F_PROFILE(f,t,i)=0; } } end_f_loop(f, t) } PS: Thanks pakk |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFD analaysis of Pelton turbine | amodpanthee | CFX | 31 | April 19, 2018 19:02 |
Problem in setting Boundary Condition | Madhatter92 | CFX | 12 | January 12, 2016 05:39 |
Waterwheel shaped turbine inside a pipe simulation problem | mshahed91 | CFX | 3 | January 10, 2015 12:19 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 08:00 |
mixed boundary conditions including heat flux, convective heat transfer and radiation | lotus_blue | FLUENT | 0 | April 3, 2013 19:55 |