Cell gradient reconstruction

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Cell gradient reconstruction

Post by Luciano Garelli »

Hello,

I am facing a problem when computing the gradient of a scalar field with a variable physical property (conductivity) in the domain. Using the cs_field_gradient_scalar() I can compute the correct gradient in the domain, but in the cells in the interface between different properties, where a discontinuity in the gradient exists, I get an erroneous (an average) value. Then, when I use this gradient and the cell value of the physical propertie to compute, e.j , which should be constant in this very simple test case, but I get an overestimate value and in the next cell an underestimate value (Fig 2).

I am using harmonic face diffusion to compute the diffusive fluxes.

Is there any way (function) in CS to reconstruct the cell gradient based on the existing face fluxes without computing the face value based on that fluxes?
grad_scalar.png
current.png

Regards,
Luciano
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Cell gradient reconstruction

Post by Yvan Fournier »

Hello Luciano,

I do not know of a good way to handle that currently but will check with colleagues.
Discontinuities can be handled for the pressure gradient or other potential field gradients usimg external forces and the iphydr option, and neptune_cfd may have other options to handle this.

Do least-squares and Gauss-based gradients lead to the same issues here ?

Best regards,

Yvan
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: Cell gradient reconstruction

Post by Luciano Garelli »

Hello Yvan, thanks for your answer.

Yes, both lead to the same issue. In discussions with colleagues at the institute, two options emerged...one was to obtain the potential face value using the fluxes and then compute the gradients based on this face value and the local conductivity. This option works well in cartesian grids but I have my doubts in more general meshes. Another option is to compute the cell gradient using eq. 3.4 of this paper (https://www.sciencedirect.com/science/a ... 9118301931. I test this option and also works well.

Eq. 3.4
reco.jpeg
Result - orange line.
reco2.png
Regards,
Luciano
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Cell gradient reconstruction

Post by Yvan Fournier »

Hello Luciano,

Do you have a prototype of the gradient implementation you recommend ? I would be interested in reviewing if with the dev team, for possible integration.

Best regards,

Yvan
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: Cell gradient reconstruction

Post by Luciano Garelli »

Hello Yvan,

I have implemented inside the extra_operation.c function, but I will prepare a small test case with the gradient reconstruction using this equation and I will share for your analysis.

Regards,
Luciano
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: Cell gradient reconstruction

Post by Luciano Garelli »

Hello Yvan,

Attached it is a very simple case (1D) with the comparison of the cell gradient reconstruction for the temperature. The J fields are the thermal fluxes and the Grad fields are the gradients.

Additionally, in this case, with different thermal conductivities in the domain, the thermal flux is not correctly computed (compared with the analytical) with the arithmetic face viscosity field interpolation and should be used the harmonic interpolation as mentioned in the theory guide.
resu2.png
Resu.png
Let me know if it is ok, or if I am doing some mistake.

Regards,
Luciano
Post Reply