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.

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 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.

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 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?

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...

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...

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) .