CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Laplace, Grad, snGrad of T (https://www.cfd-online.com/Forums/openfoam-solving/106988-laplace-grad-sngrad-t.html)

dl6tud September 14, 2012 04:52

Laplace, Grad, snGrad of T
 
I have a constant Temperature field with T=300:

Quote:

internalField uniform 300;

boundaryField
{
floor
{
type fixedValue;
value uniform 300;
}
ceiling
{
type fixedValue;
value uniform 300;
}
fixedWalls
{
type fixedValue;
value uniform 300;
}
}
I try the following:
fvc::snGrad(T) = 0
fvc::grad(T) != 0
fvc::laplacian(constant,T) != 0

Having a constant Temperture field, I assume, that the gradient is zero. But in OF it is not zero!!! Using a vectorField (like U with Ux,Uy,Uz) the gradient is 0, that is ok.

The problem occurs when solving a temperature equation, where the laplacian is calculated. If the laplacian of a constant temperature field is not zero, I get wrong results.

Can anyone help?

dl6tud September 17, 2012 08:43

I tried different numerical schemes for grad and laplacian:

grad(T)
- Gauss linear: not correct
- leastSquares: ok
- fourth: ok

snGrad(T)
- corrected: ok
- uncorrected: ok

laplacian(x,T)
- Gauss xxxxxxx, uncorrected: not correct

It seems, there is a problem with Gaussian differencing schemes. When I use them on a constant field, I get grad/laplacian which is not zero.

bigphil September 17, 2012 09:13

Hi,

are the grad/laplacian fields non-zero everywhere in your domain or only in certain places (skewed cells, boundary cells, …)?

Philip

dl6tud September 17, 2012 10:00

Only in certain places:

grad(T)=
Quote:

(2.77556e-14 0 2.77556e-14)
(-2.42861e-14 2.77556e-14 2.77556e-14)
(0 0 0)
(0 5.55112e-14 2.77556e-14)
(0 2.77556e-14 0)
(2.77556e-14 0 2.77556e-14)
(-2.94903e-14 0 -2.77556e-14)
(0 0 0)
(2.94903e-14 -2.77556e-14 0)
(-2.77556e-14 0 -2.77556e-14)
(0 -1.73472e-15 2.77556e-14)
(-6.93889e-15 -3.1225e-14 -2.77556e-14)
(1.73472e-15 -1.73472e-15 -2.77556e-14)
(0 0 0)
(0 -2.77556e-14 0)

bigphil September 17, 2012 10:13

OK,

What are the certain places? Are they poor cells or boundary cells? It is very difficult to determine the problem without sufficient information.

The gradients you have given are very very small (less than 1e-13) and as such can be considered zero for most applications as you are approaching the machine tolerance.

Philip

dl6tud September 17, 2012 10:34

1 Attachment(s)
Thanks for your answer, Philip!

It seems, that all cells have wrong values (see picture).

You are right, the values are very small, but unfortunately too high for the problem I am working on. These 'invented' temperatures induce a local fluid movement which destroyes my simulation.

Anyway the gradient of a constant temperature fields must be zero.

bigphil September 17, 2012 10:50

Quote:

Originally Posted by dl6tud (Post 382167)
Anyway the gradient of a constant temperature fields must be zero.

Yes mathematically the gradient of a constant field is zero, however, numerical it may not be exactly zero due to the way the computer stores the number.

As a computer can only store to a certain precision for double precision floating point number, then you would expect that the gradient would be zero within this tolerance. I believe the non-zero numbers you are seeing are due to this tolerance.

If your simulations are sensitive to such very small numbers then you should consider using different base units (i.e. MPa instead of Pa, mm instead of m, etc.).

Philip

dl6tud September 18, 2012 07:13

Thank you!
When using a 0-temperature field, gradient and laplace are zero, too. It is not perfect yet, but acceptable. :)


All times are GMT -4. The time now is 12:39.