|
[Sponsors] |
how to write udf for a component source term on a wall ? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 13, 2019, 04:33 |
|
#21 | |
Member
Vignesh Lakshmanan
Join Date: Nov 2016
Posts: 79
Rep Power: 10 |
Quote:
Thanks for your swift reply. Sorry, I confused you. By "x", I didnt mean position. Its difficult to explain in words. But I understood the part and I will try to workout the problem. Regards Vignesh |
||
October 8, 2021, 07:34 |
Wall Surface Reactions
|
#22 |
New Member
Ugur Goktolga
Join Date: Jul 2013
Posts: 4
Rep Power: 13 |
I think the problem in the original question could've been solved without any UDF. In Fluent, you can also specify wall surface reactions, and then define your reaction rate constants. By playing with the reaction rate constants (Pre-exponential term, activation energy and temperature exponent), you can get your desired reaction rates I believe.
|
|
January 17, 2022, 11:34 |
|
#23 |
New Member
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Hi all,
I would like to implement a source in the cell row that is adjacent to a wall and I think the UDF of Hasan_Najafi is a good approach for this. I have already compiled the UDF without error, but I cannot execute the UDF on demand in Fluent, because Fluent does not respond when I want to execute the UDF in the "Execute on Demand" dialog box. Any suggestion would be helpful. Many greetings Joe |
|
January 19, 2022, 04:06 |
|
#24 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
can you execute on_demand macro in case there is only Message("text"); function inside?
Code:
#include "udf.h" DEFINE_ON_DEMAND(test) { Message("text"); }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
January 19, 2022, 04:29 |
|
#25 |
New Member
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Dear Alexander,
Thank you for your reply. As in the UDF of Hasan_Najafi I used the UDM to mark the cells adjacent to the wall. In the meantime, I checked if the UDF saves the values of the UDM to the cells on the wall. This is the case. Now I have the question, what can be the reason, that nevertheless the source is not implemented. The code looks like the following: Code: #include "udf.h" DEFINE_ON_DEMAND(selecting_cell) { #if !RP_HOST Domain *d; Thread *t, *tc, *t0; face_t f; cell_t c, c0; d = Get_Domain(1); tc = Lookup_Thread(d, 8); thread_loop_c(t, d) { begin_c_loop(c, t) { C_UDMI(c, t, 0) = 0; } end_c_loop(c,t) } begin_f_loop(f, tc) { c0 = F_C0(f, tc); t0 = THREAD_T0(tc); C_UDMI(c0, t0, 0) = 1; } end_f_loop(f,tc) #endif } DEFINE_SOURCE(energy_source, c, t, dS, eqn) { real source; if (C_UDMI(c, t, 0) > 0) { source = 1000.0; dS[eqn] = 0.0; } else { source = 0.0; dS[eqn] = 0.0; } return source; } Thank you in advance. Many greetings Joe |
|
January 19, 2022, 04:41 |
|
#26 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
check values of udm_0 in your domain, it must be 1 near the wall with ID = 8
__________________
best regards ****************************** press LIKE if this message was helpful |
|
January 19, 2022, 04:58 |
|
#27 |
New Member
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Dear Alexander,
Thank you for your reply. I checked the values of the UDM in the cells adjacent to the wall and instead of 1, they are 0.5. Shouldn't this work with 0.5? Thanks Many greetings Joe |
|
January 20, 2022, 00:42 |
|
#28 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
its not possible to have 0.5 as you have only 0 or 1 in your code.
this is error of plotting: turn off node values while making the contour. however, as you can see something except 0, means udf works, so source is applied also. 1000 means 1000W/m3. check if it enough to get some effect for your case
__________________
best regards ****************************** press LIKE if this message was helpful |
|
January 20, 2022, 07:07 |
|
#29 |
New Member
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Dear Alexander,
Thank you for your answer. I have issued the node values and am now getting values of 1. Additionally, I have separated the UDF's. Both UDF' I have compiled with no errors. The DEFINE_SOURCE UDF I have hooked in the desired fluid domain and the DEFINE_ON_DEMAND UDF I have executed on demand. Now the source UDF works as well. But the question arises why not both UDF could be executed on demand. Shouldn't this also work? Many thanks in advance. Many greetings Joe |
|
January 20, 2022, 22:03 |
|
#30 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
On_demand is eceuted manually by user from fluent GUI define_source returns some value to specified zone, is executed before each time step automatically
__________________
best regards ****************************** press LIKE if this message was helpful |
||
January 21, 2022, 03:10 |
|
#31 | |
New Member
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Quote:
Many greetings Joe |
||
February 13, 2022, 17:28 |
|
#32 | |
New Member
DhyaniBaba
Join Date: Aug 2019
Posts: 23
Rep Power: 7 |
Quote:
I am doing a similar problem, where I apply a mass flow source term at an inlet boundary. I came across your UDF, although I am a bit confused on how to implement it? After I interpret the code, I see two UDFs loaded in Fluent, one is for selecting_the_cells, and the other is energy_source. How do I apply these UDFs, and where? Secondly, I am just starting to work with UDFs, so I am having trouble understanding the syntax, and following the manual is not trivial for me as of now. Could you please shed some light on the syntax? Thanks, Priyank |
||
February 15, 2022, 23:24 |
|
#33 | |
New Member
Hasan Najafi Khaboshan
Join Date: Jan 2018
Posts: 11
Rep Power: 8 |
Quote:
1. Set the ID number (in Line 11) of your inlet boundary in the UDF and save it with a filename.c. 2. Launch with a parallel solver. 3. Set one User-defined memory in your case (User Define>Memory>set 1 for Number of User-Defined Memory Location). 4. Compile the UDF. 5. Set the UDF of your source term in Cell Zone conditions. 6. Initialize your case. I think if you hook the Execute on Demand and after that Initialize your case, the data of UDM will be gone. 7. Hook Execute on Demand (User Define>Execute on Demand button>chose the name of Execute on Demand UDF "selecting_the_cells">click OK). Also, you can plot the contour of UDM before running your case to check. 8. Then you can run your solver. Let me know if you need more help. Hope you run your case file. Best regards, Hasan Najafi Khaboshan |
||
April 29, 2022, 03:08 |
|
#34 |
New Member
București
Join Date: Jan 2021
Posts: 3
Rep Power: 5 |
Hello! I kind of face the same issue here. I have used the same code in which I have added the "Message("%e\n", C_UDMI(c0,t0,0))" in order to check if the values for the cells 0 and 1 are implemented. After I compile and run the Define_On Demand macro I receive a message with the numbers of cells with 0 and 1. Nonetheless, the source term is implemented as 0 everywhere. I checked the UDM contour and it seems that all cell values are 0. Could you please be so kind and give me an idea on what I am doing wrong? This will be highly appreciated!
|
|
May 1, 2022, 01:26 |
|
#35 | |
New Member
Hasan Najafi Khaboshan
Join Date: Jan 2018
Posts: 11
Rep Power: 8 |
Quote:
You should set the UDM, then interpret the Define_On Demand and check the contour. |
||
Tags |
mass source udf, wall udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mesh file for flow over a circular cylinder | Ardalan | Main CFD Forum | 7 | December 15, 2020 14:06 |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 10:07 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 13:41 |
[swak4Foam] build problem swak4Foam OF 2.2.0 | mcathela | OpenFOAM Community Contributions | 14 | April 23, 2013 14:59 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |