|
[Sponsors] |
August 8, 2011, 18:26 |
Define source on boundary cells in UDF
|
#1 |
Member
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 15 |
Hi, friends
I want to define a mass source on the boundary cells with udf, here's my code, I don't know why it doesn't work, can any of you guys kindly give me some suggestions? I'm new to udf... Thanks in advance! # include "udf.h" DEFINE_SOURCE(mass_source,c,t,dS,eqn) { real x[ND_ND]; real source; Domain *domain = Get_Domain(1); face_t f; Thread *tb = Lookup_Thread(domain,2); /* Get boundary thread, wall zone id is 2 */ if(c = F_C0(f,tb)) /* if cell is wall boundary cell */ { source = 10000; dS[eqn]=0; } else { source = 0; dS[eqn]=0; } return source; } Thank you very much! Last edited by mingersai; August 9, 2011 at 10:32. |
|
August 9, 2011, 10:33 |
|
#2 |
Member
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 15 |
need help.......
|
|
August 9, 2011, 15:47 |
|
#3 |
Senior Member
|
your if-clause is not right ...
one easy way is to store source values in temporary memory (UDM) and then use it in this macro; another way is to separate adjacent boundary cells to get new thread ID and then use that ...
__________________
Amir |
|
August 10, 2011, 11:04 |
|
#4 |
Member
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 15 |
Hi, Amir
Thanks for your help. Would you please tell me why the if statement is not correct? How to implement this with UDM? Because my problem is not suitable to go with separate zone method, I'll have to stick with the first way.... Thank you very much! |
|
August 10, 2011, 11:35 |
|
#5 | |
Senior Member
|
Quote:
first, your idea about this case is not right; your macro retrieves cell ID and doesn't recognize f; i.e. you just define unreferenced face index (f)! indeed, you need logical statement in if-clause; if(c == F_C0(f,tb)) ... Easier way is to use another macro like on demand forms then, loop over your desired thread and store your source value to temporary volume scalar field (UDM) then use this UDM in above UDF.
__________________
Amir |
||
August 10, 2011, 16:17 |
|
#6 |
Member
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 15 |
Thanks a lot! I learnt a lot from this!
Would you please tell me the difference between different IDs showed in the pic? Why there's two different IDs for wall? what is each ID? Thanks Last edited by mingersai; August 10, 2011 at 23:45. |
|
August 11, 2011, 04:21 |
|
#7 | |
Senior Member
|
Quote:
ID which is in BC panel refer to realistic threads of your grid (consist of nodes, faces,...) and has to be used in, for example, loops over desired thread and so on; on the other hand, the IDs in surface panel have to be used in some calculations such as property integrations over that; note that these surfaces or volumes which are visible in this panel are not necessarily part of your numerical grid, they may be created as virtual surfaces or volumes for post-processing and I usually use then in TUI as a part of journal files. In your case, thread ID=12 refers to realistic part of your grid and ID=2 refers to virtual surface coincides with your realistic one. these are 2 types of IDs which I find in FLUENT 6.3, maybe there would be created other types in later versions. Bests,
__________________
Amir |
||
August 11, 2011, 18:43 |
|
#8 | |
Member
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 15 |
Thanks, Amir
I got it work now! I'm using both DPM and VOF model, The source term I want to define in those cells are function of particle mass. Do you have any idea about how to access DPM particle data in those cells? Thanks~ Quote:
|
||
August 12, 2011, 04:12 |
|
#9 | |
Senior Member
|
Quote:
Experimental measurements and numerical simulations of particle transport and distribution in ventilated rooms; Z. Zhang, Q. Chen; Atmospheric Environment 40 (2006) 3396–3408 Bests,
__________________
Amir |
||
August 12, 2011, 06:23 |
|
#10 | |
Member
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 15 |
Hi, Amir
Do you know specific UDF code we need to use in order to get the particle data in the chosen cells? I can't find it in Fluent documentation, and the paper you mentioned seems have not mentioned that. Thanks! Quote:
|
||
August 12, 2011, 06:38 |
|
#11 | |
Senior Member
|
Quote:
The information in mentioned paper is enough! you need a relation to compute particle concentration in your domain i.e. equation (7); there is not your desired UDF in documantation, but you can use them in your algorithm. Bests,
__________________
Amir |
||
October 30, 2012, 23:34 |
surface heat flux
|
#12 |
New Member
Praneetha
Join Date: Dec 2009
Posts: 7
Rep Power: 16 |
I am trying to do something similar, I am calculating surface integral over boundary which has zone id 15 and trying to use tohis as source for domain (cell zone). the code compiles and loads without any errors. But after 1st iteration nothing happens. It just hovers over 1st iteration. looks like it is going into infinite loop. But cannot figure out how?
#include "udf.h" #define C 1.7e-8 #define V 5.7e-4 DEFINE_SOURCE(source3, c, t, dS, i) { real flux=0; real ID=15; face_t f; Domain *d; d=Get_Domain(1); t=Lookup_Thread(d, ID); begin_f_loop(f,t) { flux += ((pow(F_T(f,t),4))-(pow(297,4)))*(-C)/V; } end_f_loop(f,t) dS[i]=0; return flux; } |
|
February 24, 2015, 09:05 |
Source term UDF
|
#13 |
Member
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11 |
Hi all,
Bharadwaj here, My case has also very similar requirement. I have to assign about 1kg of mass to a sphere surface. which is present in a fluid flow domain (cylindrical). QUESTION: If I use DEFINE_SOURCE UDF, will that be specifying mass directly to a domain or will the UDF just adds a source term to the governing equation. And if it adds the value as mass, how to verify that in FLUENT? Any help by Amir and others are of great use for me. Thanks in advance. Regards, Bharadwaj |
|
July 7, 2015, 12:56 |
Fatal segmentation error
|
#14 |
New Member
Lokanath Mohanta
Join Date: Jun 2015
Posts: 1
Rep Power: 0 |
I have a similar problem in which I would like to define mass and momentum source in the cells close to one surface. UDF gets compiled and I can hook the sources with the volumes. But whenever I start running the fluent, it says Fatal segementation error. Any suggestions ?
Here is my UDF -------------------------- # include "udf.h" DEFINE_SOURCE(mass_source, c,t, dS, eqn) { real source; Domain *domain = Get_Domain(17); face_t f; Thread *tb = Lookup_Thread(domain,24); /* Get boundary thread, wall zone id is 30 */ if(c == F_C0(f,tb)) /* if cell is wall boundary cell */ { source = 10; dS[eqn]=0.0; } else { source = 0; dS[eqn]=0.0; } return source; } DEFINE_SOURCE(momentum_source, c,t, dS, eqn) { real momnt_source; Domain *domain = Get_Domain(17); face_t f; Thread *tb = Lookup_Thread(domain,24); /* Get boundary thread, wall zone id is 30 */ if(c == F_C0(f,tb)) /* if cell is wall boundary cell */ { momnt_source = 0.002; dS[eqn]=0.0; } else { momnt_source = 0; dS[eqn]=0.0; } return momnt_source; } |
|
March 12, 2016, 13:38 |
|
#15 |
New Member
VISHNU
Join Date: Jan 2016
Posts: 13
Rep Power: 10 |
I have to provide an actuation which is base on CL.
How to retrieve CL to my UDF FLUENT from solver?? Which command?? |
|
March 15, 2016, 10:42 |
|
#16 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
What is CL???
If you want your question answered, be as clear as you can be. Using abbreviations does not help. |
|
January 26, 2017, 22:11 |
|
#17 |
Member
Howard
Join Date: Jun 2012
Posts: 43
Rep Power: 14 |
I have been able to do this... problem is fluent seems to compute source terms on a cell-zone basis. That way you can't really choose which cells to apply the source. Well, you can, and it works, but the pressure drop that results is always a bit wrong. between 50-20% of what you would expect. I've been working on this for a few months now, and the best solution I've found is to create a separate cellzone for the sourceterm during mesh generation. The resulting pressure drop is nice and consistent
|
|
June 27, 2017, 16:41 |
segmentation fault
|
#18 |
Member
sebastian bergman
Join Date: Mar 2017
Location: seattle
Posts: 52
Rep Power: 9 |
In my momentum equation owing to density difference i have to write a source term udf. the source term is,
source term= - ρl.(1+∝).u ⃗ .∂fl/∂t where ∝ = the volume of fraction variable fl = liquid fraction ul = Velocity vector ρl and ρs = liquid and solid density respectively I did write a udf for it -----for x-momentum---- #include "udf.h" #define rho_l 1544.0 #define rho_s 1648.0 DEFINE_SOURCE(x_momentum_source,c,t,dS,eqn) { real source; source = -(rho_l*(1+C_VOF(c,t))*C_U(c,t)*((C_LIQF(c,t)-C_LIQF_M1(c,t))/CURRENT_TIMESTEP)); dS[eqn] = 0; return source; } ----for y-momentum----- #include "udf.h" #define rho_l 1544.0 #define rho_s 1648.0 DEFINE_SOURCE(y_momentum_source,c,t,dS,eqn) { real source; source = -(rho_l*(1+C_VOF(c,t))*C_V(c,t)*((C_LIQF(c,t)-C_LIQF_M1(c,t))/CURRENT_TIMESTEP)); dS[eqn] = 0; return source; } i hooked it in the cell zone section. i was using the VOF module. IT is giving me a segmentation fault. I am not able to understand the mistake here. can anybody help? |
|
October 20, 2017, 10:06 |
|
#19 | |
New Member
Hooman
Join Date: Jan 2016
Posts: 19
Rep Power: 10 |
hi amir,
I have written this code for momentum source term for a two-phase VOF model but I faced this error: Error: received a fatal signal (Segmentation fault). what wrong is with it? do you have any idea which parameter is undefined? thank you. Quote:
|
||
October 20, 2017, 10:08 |
|
#20 | ||
New Member
Hooman
Join Date: Jan 2016
Posts: 19
Rep Power: 10 |
Quote:
I have written this code for momentum source term for a two-phase VOF model but I faced this error: Error: received a fatal signal (Segmentation fault). what wrong is with it? do you have any idea which parameter is undefined? thank you. Quote:
|
|||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Robin B.C. | Yu | FLUENT | 3 | May 27, 2012 05:19 |
help:uds source added to boundary cells | FredPacheo | FLUENT | 5 | September 5, 2008 06:45 |
UDF to define source term at every grid point | Ralf Schmidt | FLUENT | 0 | September 21, 2006 12:32 |
Free surface boudary conditions with SOLA-VOF | Fan | Main CFD Forum | 10 | September 9, 2006 13:24 |
Ignore cells on partition boundary | Karl | FLUENT | 7 | May 11, 2002 23:12 |