CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Difference between "scalarField" and "const scalar"

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree5Likes
  • 5 Post By dkxls

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2015, 17:44
Default Difference between "scalarField" and "const scalar"
  #1
New Member
 
Yi Han
Join Date: Oct 2013
Location: Laramie WY
Posts: 15
Rep Power: 12
hy1112006 is on a distinguished road
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
hy1112006 is offline   Reply With Quote

Old   June 13, 2015, 09:16
Default
  #2
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
Quote:
Originally Posted by hy1112006 View Post
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.
dkxls is offline   Reply With Quote

Old   June 15, 2015, 02:24
Default
  #3
New Member
 
Yi Han
Join Date: Oct 2013
Location: Laramie WY
Posts: 15
Rep Power: 12
hy1112006 is on a distinguished road
Hi Armin,

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

Sincerely,
Yi
hy1112006 is offline   Reply With Quote

Old   June 15, 2015, 02:42
Default Hi Armin, Thanks so much for your reply. It is very helpful. Sincerely, Yi
  #4
New Member
 
Yi Han
Join Date: Oct 2013
Location: Laramie WY
Posts: 15
Rep Power: 12
hy1112006 is on a distinguished road
Hi Armin,

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

Sincerely,
Yi
hy1112006 is offline   Reply With Quote

Reply

Tags
boundary types, const scalar, scalarfield

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
An error about "const volVectorField& U = db().lookupObject<volVectorField>("U");" babala OpenFOAM Programming & Development 1 December 3, 2014 04:25


All times are GMT -4. The time now is 09:06.