|
[Sponsors] |
May 28, 2018, 15:27 |
Surface Incident Radiation Macro
|
#1 |
New Member
Alejandro
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
Hi Everybody!!
I´m working with UDF along with the Discrete Ordinate model radiation and i need to know how to obtain the surface incident radiation by an UDF. Currently, i know that the C_DO_IRRAD(c,t,nb) macro give me the incident radiation, but i need the incident radiation in a surface by an UDF (given in the GUI by Wall Fluxes-Surface Incident Radiation). If any want can help me, I would really appreciate it. Thank you very much. |
|
May 28, 2018, 21:41 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
may be
Code:
F_DO_IRRAD_SHELL(f,t,nb) |
|
May 29, 2018, 15:16 |
|
#3 |
New Member
Alejandro
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
Thanks for your reply, I´ll try and i´ll let you know if it works.
|
|
May 30, 2018, 10:29 |
|
#4 |
New Member
Alejandro
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
I tried with the macro F_DO_IRRAD_SHELL(f,t,nb), however, I have a zero result . Here is my simple code:
#include "udf.h" DEFINE_ON_DEMAND(F_DO) { Domain *d=Get_Domain(1); int ID = 16; /*Boundary condition ID*/ Thread *t = Lookup_Thread(d,ID); face_t f; real temp=0; real sum=0; begin_f_loop(f,t) /*Loop over all faces*/ { temp=F_DO_IRRAD_SHELL(f,t,0); sum+=temp; } end_f_loop(f,t) } When i call the variable sum, it gives me a zero result. Can anyone help me? Thanks |
|
May 30, 2018, 22:31 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
How did you call variable sum?
You have nothing in your code regarding output best regards |
|
May 31, 2018, 10:20 |
|
#6 |
New Member
Alejandro
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
Sorry for copy the code incomplete...
#include "udf.h" DEFINE_ON_DEMAND(F_DO) { Domain *d=Get_Domain(1); int ID = 16; /*Boundary condition ID*/ Thread *t = Lookup_Thread(d,ID); face_t f; real temp=0; real sum=0; begin_f_loop(f,t) /*Loop over all faces*/ { temp=F_DO_IRRAD_SHELL(f,t,0); sum+=temp; } end_f_loop(f,t) printf("Suma1 temp: %f\n",sum); } Thanks |
|
November 9, 2020, 17:41 |
|
#7 |
New Member
Mostafa
Join Date: Sep 2014
Posts: 9
Rep Power: 12 |
Dear axelosc,
Did u find what's the error in ur code? If u got it, please share it here. Thanks in advance BR sasa |
|
November 30, 2022, 16:00 |
|
#8 |
New Member
Moe
Join Date: Jul 2021
Posts: 14
Rep Power: 5 |
anyone got a solution? im trying to define incident radiation using the expression above to use it in another equation but I'm getting errors
|
|
December 1, 2022, 00:59 |
|
#9 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
code above should be: Code:
#include "udf.h" DEFINE_ON_DEMAND(F_DO) { Domain *d; int ID = 16; /*Boundary condition ID*/ Thread *t = Lookup_Thread(d,ID); face_t f; d=Get_Domain(1) real temp=0; real sum=0; begin_f_loop(f,t) /*Loop over all faces*/ { temp=F_DO_IRRAD_SHELL(f,t,0); sum+=temp; } end_f_loop(f,t) sum = PRF_GRSUM1(sum); Message("Suma1 temp: %f\n",sum); }
__________________
best regards ****************************** press LIKE if this message was helpful |
||
December 2, 2022, 07:04 |
|
#10 | |
New Member
Moe
Join Date: Jul 2021
Posts: 14
Rep Power: 5 |
Quote:
Dear, here is what my ending of the code looks like Code:
UREF = urefData[induref]; TACREF = tacrefData[indtacref]; RHREF = rhrefData[indrhref]; l1 = log((zrefu - (2 / 3) * hgrass) / (0.123 * hgrass)); l2 = log((zrefh - (2 / 3) * hgrass) / (0.0123 * hgrass)); ra = (l1 * l2) / (pow(k, 2) * UREF); lamda = 1.91846 * pow(10, 6) * pow(((TACREF + 273.15) / (TACREF + 239.24)), 2); delta = (4098 * 610.8 * exp((17.27 * TACREF) / (TACREF + 237.3))) / pow((TACREF + 237.3), 2); esat = (1.0007 + 3.46 * pow(10, -8) * patm) * 611.21 * exp(((18.678 - TACREF / 234.5) * TACREF) / (257.14 + TACREF)); D = (1 - RHREF) * esat; gamma = patm * aircp * pow((0.622 * lamda), -1); begin_f_loop(f, thread) { F_CENTROID(x, f, thread); y = x[1]; Incedent_Radiation= C_DO_IRRAD(x,f,thread); E = (delta * Incedent_Radiation + 1.225 * aircp * D / ra) / (delta + gamma * (1 + rs / ra)); F_PROFILE(f, thread, position) = E; } end_f_loop(f, thread) } I'm getting error BCS Incident_Radiation is not defined. Do I just plug your code above this section? |
||
December 5, 2022, 02:12 |
|
#11 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
are C_DO_IRRAD(x,f,thread); and F_DO_IRRAD_SHELL(f,t,0); the same? (no) you need Code:
F_DO_IRRAD_SHELL(f,t,0); probably "Incident_Radiation" is not defined just because you didn't define that variable in your code
__________________
best regards ****************************** press LIKE if this message was helpful |
||
December 5, 2022, 16:03 |
|
#12 | |
New Member
Moe
Join Date: Jul 2021
Posts: 14
Rep Power: 5 |
Quote:
I did not include the complete code because I thought that it was too long to be displayed here, sorry for that I will include it below after following your advice, I'm not actually sure of what I did, so please tell me if this should work as intended. I did not get any errors when interpreting this one so I hope it works as intended. i spent a lot of time on this bcs I have no background on UDFs and could not find a clear reference. thanks in advance Code:
#include "udf.h" double rs=83.33; double zrefu=30.0; double zrefh=30.0; double hgrass=0.1; double patm=101325.0; double aircp=1008.0; double k=0.42; float UREF; float TACREF; float RHREF; int induref; int indtacref; int indrhref; float urefData[24] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; float tacrefData[24] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; float rhrefData[24] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; DEFINE_PROFILE(PME_profile, thread, position) { float x[ND_ND]; float y; float E, ra, lamda, gamma, delta, D, esat, l1, l2, Incedent_Radiation; face_t f; real current_time; current_time = CURRENT_TIME; current_time /= 60; if (current_time < 60) { induref = 0; indtacref = 0; indrhref = 0; } else if (current_time < 120) { induref = 1; indtacref = 1; indrhref = 1; } else if (current_time < 180) { induref = 2; indtacref = 2; indrhref = 2; } else if (current_time < 240) { induref = 3; indtacref = 3; indrhref = 3; } else if (current_time < 300) { induref = 4; indtacref = 4; indrhref = 4; } else if (current_time < 360) { induref = 5; indtacref = 5; indrhref = 5; } else if (current_time < 420) { induref = 6; indtacref = 6; indrhref = 6; } else if (current_time < 480) { induref = 7; indtacref = 7; indrhref = 7; } else if (current_time < 540) { induref = 8; indtacref = 8; indrhref = 8; } else if (current_time < 600) { induref = 9; indtacref = 9; indrhref = 9; } else if (current_time < 660) { induref = 10; indtacref = 10; indrhref = 10; } else if (current_time < 720) { induref = 11; indtacref = 11; indrhref = 11; } else if (current_time < 780) { induref = 12; indtacref = 12; indrhref = 12; } else if (current_time < 840) { induref = 13; indtacref = 13; indrhref = 13; } else if (current_time < 900) { induref = 14; indtacref = 14; indrhref = 14; } else if (current_time < 960) { induref = 15; indtacref = 15; indrhref = 15; } else if (current_time < 1020) { induref = 16; indtacref = 16; indrhref = 16; } else if (current_time < 1080) { induref = 17; indtacref = 17; indrhref = 17; } else if (current_time < 1140) { induref = 18; indtacref = 18; indrhref = 18; } else if (current_time < 1200) { induref = 19; indtacref = 19; indrhref = 19; } else if (current_time < 1260) { induref = 20; indtacref = 20; indrhref = 20; } else if (current_time < 1320) { induref = 21; indtacref = 21; indrhref = 21; } else if (current_time < 1380) { induref = 22; indtacref = 22; indrhref = 22; } else { induref = 23; indtacref = 23; indrhref = 23; } UREF = urefData[induref]; TACREF = tacrefData[indtacref]; RHREF = rhrefData[indrhref]; l1 = log((zrefu - (2 / 3) * hgrass) / (0.123 * hgrass)); l2 = log((zrefh - (2 / 3) * hgrass) / (0.0123 * hgrass)); ra = (l1 * l2) / (pow(k, 2) * UREF); lamda = 1.91846 * pow(10, 6) * pow(((TACREF + 273.15) / (TACREF + 239.24)), 2); delta = (4098 * 610.8 * exp((17.27 * TACREF) / (TACREF + 237.3))) / pow((TACREF + 237.3), 2); esat = (1.0007 + 3.46 * pow(10, -8) * patm) * 611.21 * exp(((18.678 - TACREF / 234.5) * TACREF) / (257.14 + TACREF)); D = (1 - RHREF) * esat; gamma = patm * aircp * pow((0.622 * lamda), -1); begin_f_loop(f, thread) { F_CENTROID(x, f, thread); y = x[1]; Incedent_Radiation= F_DO_IRRAD_SHELL(f,thread,0); E = (delta * Incedent_Radiation + 1.225 * aircp * D / ra) / (delta + gamma * (1 + rs / ra)); F_PROFILE(f, thread, position) = E; } end_f_loop(f, thread) } |
||
December 6, 2022, 00:31 |
|
#13 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
the code you've showed last is correct.
what errors do you have?
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 6, 2022, 09:05 |
|
#14 |
New Member
Moe
Join Date: Jul 2021
Posts: 14
Rep Power: 5 |
||
Tags |
incident radiation, macro, radiation do model, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Modeling the flow of solar radiation as the heat flux from the surface. | Gebbels | FLUENT | 0 | March 25, 2012 15:39 |
Surface incident radiation | Pipiola | FLUENT | 0 | August 11, 2009 16:46 |
Incident Radiation | Nicki | CFX | 1 | April 17, 2009 09:18 |
Fluent incident radiation problem | Michael Schwarz | Main CFD Forum | 0 | October 21, 1999 06:56 |