CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Surrounding cells of a node

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2009, 18:08
Default Surrounding cells of a node
  #1
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17
gemini is on a distinguished road
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
gemini is offline   Reply With Quote

Old   June 29, 2009, 13:30
Default
  #2
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17
ak6g08 is on a distinguished road
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
ak6g08 is offline   Reply With Quote

Old   June 30, 2009, 02:30
Default
  #3
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17
gemini is on a distinguished road
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
gemini is offline   Reply With Quote

Old   June 30, 2009, 06:29
Default
  #4
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17
ak6g08 is on a distinguished road
Quote:
Originally Posted by gemini View Post
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
ak6g08 is offline   Reply With Quote

Old   June 30, 2009, 12:31
Default
  #5
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17
gemini is on a distinguished road
Quote:
Originally Posted by ak6g08 View Post
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
gemini is offline   Reply With Quote

Old   July 1, 2009, 12:40
Default
  #6
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17
ak6g08 is on a distinguished road
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
ak6g08 is offline   Reply With Quote

Old   July 2, 2009, 14:28
Default
  #7
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17
gemini is on a distinguished road
Quote:
Originally Posted by ak6g08 View Post
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
gemini is offline   Reply With Quote

Old   July 2, 2009, 18:05
Default
  #8
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17
ak6g08 is on a distinguished road
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
ak6g08 is offline   Reply With Quote

Old   July 4, 2009, 14:54
Default
  #9
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17
gemini is on a distinguished road
Quote:
Originally Posted by ak6g08 View Post
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*/
DEFINE_SOURCE(spcharge_quad,c,t,dS,eqn)
...
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
gemini is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get node coordinates for free surface cells fred FLUENT 1 August 15, 2014 01:52
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
7 Node Hexahedral Cells Mark FLUENT 0 February 5, 2007 11:10
defining cells where connecting to one node Asghari FLUENT 0 July 11, 2006 09:36
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


All times are GMT -4. The time now is 07:58.