# Surrounding cells of a node

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 9, 2009, 18:08 Surrounding cells of a node #1 Member   Join Date: Mar 2009 Location: Istanbul, Turkiye Posts: 45 Rep Power: 10 Hi everyone, In my udf, I need to calculate the node value of a UDS. To do this I want to use following formula UDS_node_value = (1/number_of_CVs)*(summation of cell center UDS value of surrounding CVs) Does someone have an idea how to obtain cell ids of surrounding cells. Scanning adjacent cells of a node make things very complicated. Thanks

 June 29, 2009, 13:30 #2 Member   Akour Join Date: May 2009 Posts: 79 Rep Power: 10 hi, I would like to do something similar...unfortunately i dont know how, have you gotten anywhere with this yet?...I would appreciate any advice if you have. Thanks AK

 June 30, 2009, 02:30 #3 Member   Join Date: Mar 2009 Location: Istanbul, Turkiye Posts: 45 Rep Power: 10 Hi, I don't have a solution for this issue. I think Fluent will not let us to use more accurate gradient calculation. I applied the Gauss theorem myself using face values calculated by equating fluxes from the two cells adjacent to the face. Good luck. Gemini

June 30, 2009, 06:29
#4
Member

Akour
Join Date: May 2009
Posts: 79
Rep Power: 10
Quote:
 Originally Posted by gemini Hi, I don't have a solution for this issue. I think Fluent will not let us to use more accurate gradient calculation. I applied the Gauss theorem myself using face values calculated by equating fluxes from the two cells adjacent to the face. Good luck. Gemini
Hi,

Thanks for your speedy reply, so when you access an adjacent cell in FLUENT using the F_CO and F_C1 macros, how do you know if its the cell to the right, left, top or bottom of it??? adjacent could be in any direction...this effectively means that we cannot do detailed Finite volume discretisation within the UDF environment im assuming..am I right? There is no way to know which direction the adjacent cell is in relative to the initial cell?

Thanks again
AK

June 30, 2009, 12:31
#5
Member

Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 45
Rep Power: 10
Quote:
 Originally Posted by ak6g08 Hi, Thanks for your speedy reply, so when you access an adjacent cell in FLUENT using the F_CO and F_C1 macros, how do you know if its the cell to the right, left, top or bottom of it??? adjacent could be in any direction...this effectively means that we cannot do detailed Finite volume discretisation within the UDF environment im assuming..am I right? There is no way to know which direction the adjacent cell is in relative to the initial cell? Thanks again AK
You can check this by looking at Area vector if A vector points +x direction for example your neighbor cell is at the EAST for example, or is Area vector point -y direction your neighbour cell is at the SOUTH. This is true if cell pointed by c0 and cell pointed by c are the same. if not you'll have area vector with opposite direction.

Please careful that c0 cell is your center cell identified by c. if not you should treat c1 cell as your center cell. You can check this by making 3x3 2d grid having 9 cells and by writing an execute on demand function which prints out current cell id (c) and its face ids (f) and c0 and c1 values of each face of the current cell (c) with area vector (A) components. So you can clearly understand the situation.

best luck
Gemini

 July 1, 2009, 12:40 #6 Member   Akour Join Date: May 2009 Posts: 79 Rep Power: 10 Gemini, thank you very much for your help, i have one FINAL question, i promise, you seem experienced so I woul value your assistance, when I use the macro C_UDSI_G(...) for gradient calculation, if I want to calculate a source term which depends on the gradient of the scalar being solved, do I need to write the gradient down as C_UDSI_G(...)*C_VOLUME(c,t)...because of gauss's theorem? or does fluent treat the gradient function C_UDSI_G(...) as a fully discretised version which incorporates the integration of the gradient?? Thank you very much for all of your help AK

July 2, 2009, 14:28
#7
Member

Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 45
Rep Power: 10
Quote:
 Originally Posted by ak6g08 Gemini, thank you very much for your help, i have one FINAL question, i promise, you seem experienced so I woul value your assistance, when I use the macro C_UDSI_G(...) for gradient calculation, if I want to calculate a source term which depends on the gradient of the scalar being solved, do I need to write the gradient down as C_UDSI_G(...)*C_VOLUME(c,t)...because of gauss's theorem? or does fluent treat the gradient function C_UDSI_G(...) as a fully discretised version which incorporates the integration of the gradient?? Thank you very much for all of your help AK
I'm sorry that I couldn't understand what are you trying to do, so can you explain your aim in detail by giving your source term?

regards,

Gemini

 July 2, 2009, 18:05 #8 Member   Akour Join Date: May 2009 Posts: 79 Rep Power: 10 hi gemini, My actual problem is outlined in the post 'problematic source term UDS', here is the link: http://www.cfd-online.com/Forums/flu...-term-uds.html I posted this about a week ago, basically, the way I defined my source term (see the post) causes my solution to diverge so I think I may need to do it manually somehow via accessing individual cell faces, and calculating gradients manually by accessing north, south,east and west faces... I think the soltuion is diverging because of a problem similar to decoupling of pressure and velocity when solving the momentum equation, only in my case it is with space charge and electric field... If it is easier you can reply on that post, the source term is a little bit more complicated than usual... Thank you so much AK __________________ akour

July 4, 2009, 14:54
#9
Member

Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 45
Rep Power: 10
Quote:
 Originally Posted by ak6g08 hi gemini, My actual problem is outlined in the post 'problematic source term UDS', here is the link: http://www.cfd-online.com/Forums/flu...-term-uds.html I posted this about a week ago, basically, the way I defined my source term (see the post) causes my solution to diverge so I think I may need to do it manually somehow via accessing individual cell faces, and calculating gradients manually by accessing north, south,east and west faces... I think the soltuion is diverging because of a problem similar to decoupling of pressure and velocity when solving the momentum equation, only in my case it is with space charge and electric field... If it is easier you can reply on that post, the source term is a little bit more complicated than usual... Thank you so much AK
Hi,

In your first function you have

Code:
```/*problematic source of scalar 2 (Q)*/
DEFINE_SOURCE(spcharge_lin,c,t,dS,eqn)
...
dS[eqn] = 0.0;```
However, in the second function you have

Code:
```/*OK source of scalar 2*/
...
dS[eqn] = -(2*pow(C_R(c,t),2)*C_UDSI(c,t,1)*kappa)/epsilon;```
So it seems that you did not linearized the source term in your problematic source function while you did it in the second function. The only thing I can say is that you should try linearizing the source term (See Patankar's book) .

Good luck

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post fred FLUENT 1 August 15, 2014 01:52 hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50 Mark FLUENT 0 February 5, 2007 12:10 Asghari FLUENT 0 July 11, 2006 09:36 kris Siemens 2 August 3, 2005 00:32

All times are GMT -4. The time now is 22:25.