CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Difference between "scalarField" and "const scalar" (https://www.cfd-online.com/Forums/openfoam-programming-development/154061-difference-between-scalarfield-const-scalar.html)

hy1112006 June 9, 2015 16:44

Difference between "scalarField" and "const scalar"
 
Hi everyone,

I am making a new boundary type for the inlet temperature by referring the "parabolicVelocityFvPatchVectorField" and "AblVelInletFvPatchVectorField".

I got confused with the "scalarField" & "const scalar" in the .H and .C files. What is the difference between them?

Can anyone show it with example?

Thanks soo much

dkxls June 13, 2015 08:16

Quote:

Originally Posted by hy1112006 (Post 549570)
I got confused with the "scalarField" & "const scalar" in the .H and .C files. What is the difference between them?

A scalar is basically a double or float depending on your compiler settings (roughly speaking). The const in front of a type declaration is just a C++ qualifier: https://en.wikipedia.org/wiki/Const_...programming%29

A scalarField is as field of scalars, as the name says. :) To stay in OpenFOAM terms a scalarField is basically a List of scalar (with some addons), where a List is OpenFOAM's own array template class.
So, in a general C++ context you could see it as a array of double (roughly speaking).

And since I guess that your next question would be: What is a volScalarField?
Here the answer: A volScalarField is a scalarField defined on the computational mesh. This means a that the size of a volScalarField is equal to the mesh size, hence the values in a volScalarField are linked to the cells in the computational mesh.

Hope this helps to clear things up.

Cheers,
Armin

P.S.: These are very rough explanations to get you started and are by far not complete descriptions.

hy1112006 June 15, 2015 01:24

Hi Armin,

Thanks so much for your reply.
It is very helpful.

Sincerely,
Yi

hy1112006 June 15, 2015 01:42

Hi Armin, Thanks so much for your reply. It is very helpful. Sincerely, Yi
 
Hi Armin,

Thanks so much for your reply.
It is very helpful.

Sincerely,
Yi


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