CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   reconstruct gradient of UDS (https://www.cfd-online.com/Forums/fluent/227010-reconstruct-gradient-uds.html)

loving_cfd May 14, 2020 10:52

reconstruct gradient of UDS
 
Hello, my dears,
I want to obtain the gradient of one uds.
Using the C_UDSI_G macro, I find the deviation is too large in the near-wall region.
In the help document, it is described that "The gradients stored in variables with the _G suffix are non-limited values and if used to reconstruct values within the cell (at faces, for example), may potentially result in values that are higher (or lower) than values in the surrounding cells".
However, when I try to program C_UDSI_RG, error is reported, indicating there is no such a function.
Is there any method to get a more accurate gradient and a second-order gradient?

vinerm May 14, 2020 11:14

Scalar Gradient
 
Reconstruction gradient for UDS is not defined. If you need that, you have to calculate it yourself. The reason for high (or unphysical) gradient near a wall is absence of wall treatment for the UDS.

loving_cfd May 14, 2020 11:43

Reply to Vinerm
 
Dear Vinerm

Thanks for your reply!

I have learnt the absence of C_UDSI_RG macro and the reason for the high (or unphysical) gradient near-wall with your help.

However, I've no idea how to calculate the gradient using central difference method or how to give a wall treatment on the uds.

Could you give me more suggestions?

vinerm May 14, 2020 15:23

Uds bc
 
What boundary condition are you using for UDS? If your boundary condition is appropriate, the C_UDSI_G should return correct gradient. Is the gradient in the rest of the domain alright and bad only in the wall boundary region?

loving_cfd May 15, 2020 23:08

Reply to Vinerm
 
Thanks for your patience and apologize for replying so late!

It took me some time to confirm these things.

The boundary condition for the uds is set as zero flux because the local gradient is zero. The discretization scheme is first order upwind for the uds. The result seems to be reasonable.

So I check the C_UDSI_G in the center of computational domain. The higher gradient is also observed in the center region. It may be 3 or 4 times of the reconstruction gradient.

It seems that I have to obtain the reconstruction gradient of uds. How to program on it? Could you give me any suggestions?

vinerm May 16, 2020 06:17

Gradient
 
First, use second-order scheme. Secondly, how do you know that the gradient is 3-4 times higher than reconstruction gradients when you don't even have reconstructed gradient field?

loving_cfd May 17, 2020 00:05

reply to Vinerm
 
Thanks for your reply.

I use a uds to store the value of C_T and don't solve this uds.

Then I can get the values of C_UDSI_G and C_T_RG and compare them.

I have tried the second-order scheme, but the value of C_UDSI_G shows oscillation (between positive and negative, actually it should be positive). Besides, there is a still large difference between the values of C_UDSI_G and C_T_RG. Thus, I've tried the first-order scheme and found it may work better relatively.

If using second-order scheme, how to deal with the problems of oscilliation and difference?

vinerm May 17, 2020 04:41

UDS gradient
 
The values stored in C_UDSI_G are junk if you are not solving for UDS.

loving_cfd May 17, 2020 20:54

Reply to Vinerm
 
I'm sorry that I did not describe my problem properly.

I want to get the second-order gradient of volume fraction in my udf.

So I store the value of C_VOF_RG in a uds.

And then I use C_UDSI_G to obtain the second-order gradient.

I perform these procedures with cell loops in ADJUST macro.

That is the reason why the ude is not solved.

vinerm May 18, 2020 04:20

UDS Gradient
 
The usage is not important. Fluent solves for gradients to determine flux of the field at the faces and diffusion in the cells. If the conservation equation is not being solved, Fluent does not require flux calculation, hence, no gradient calculation is done. So, the solution is to write a code to determine gradient instead of using UDS. You can use any of the gradient calculation approaches.

loving_cfd May 18, 2020 08:39

Reply to Vinerm
 
Thanks for your suggestions and patience.

I will try to write a code to obtain the local gradient.

Best wishes.


All times are GMT -4. The time now is 16:50.