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

difference volVectorField and vectorField

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By olesen
  • 4 Post By olesen
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2018, 10:25
Default difference volVectorField and vectorField
  #1
Member
 
annan
Join Date: Nov 2016
Posts: 72
Rep Power: 10
annan is on a distinguished road
Hello everyone,

I am quite new to OpenFOAM, and I have some issues understanding the difference between vectorField and volVectorField, can anyone help me understand ?

Thank you very much

Annan
annan is offline   Reply With Quote

Old   December 13, 2018, 07:59
Default
  #2
New Member
 
Karl Yang
Join Date: Jul 2016
Posts: 11
Rep Power: 10
HoneyBadger is on a distinguished road
Quote:
Originally Posted by annan View Post
Hello everyone,

I am quite new to OpenFOAM, and I have some issues understanding the difference between vectorField and volVectorField, can anyone help me understand ?

Thank you very much

Annan

I do have the same question? Have you figure it out?
HoneyBadger is offline   Reply With Quote

Old   January 4, 2019, 03:32
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
The Field class is just a List with reference counting. So vectorField is really just a list of vectors.
The volVectorField contains the vectors for each cell (the internal field) and a list of ones for each boundary patch.

It probably makes sense if you look at the source code documentation.
reverseila likes this.
olesen is offline   Reply With Quote

Old   January 4, 2019, 04:03
Default
  #4
New Member
 
Karl Yang
Join Date: Jul 2016
Posts: 11
Rep Power: 10
HoneyBadger is on a distinguished road
Quote:
Originally Posted by olesen View Post
The Field class is just a List with reference counting. So vectorField is really just a list of vectors.
The volVectorField contains the vectors for each cell (the internal field) and a list of ones for each boundary patch.

It probably makes sense if you look at the source code documentation.

Thank you Olesen for your replying. I also found some documents sharing the same idea that vectorField is only a list of vectors without geometric information, while volVectorField does. Thank you for confirming that. I think vectorField is a base class which derived to volVectorField, while itself probably is not very useful for users?


Regards
Juntao
HoneyBadger is offline   Reply With Quote

Old   January 8, 2019, 04:28
Default
  #5
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 119
Rep Power: 14
tiam is on a distinguished road
A vectorField can certainly be useful, for instance for working with boundary data but not only. Compared to a List, besides for reference counting mentioned by Mark, a Field also has all sorts of mathematical operations implemented.
tiam is offline   Reply With Quote

Old   May 7, 2021, 19:06
Default
  #6
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10
mmohaqeqf is on a distinguished road
In the Programmer's Guide, they talk about list<type> and Field<type>.
For example, list<vector> and Field<vector>.
Does anyone know what the difference is between these two classes?
mmohaqeqf is offline   Reply With Quote

Old   May 11, 2021, 06:00
Default
  #7
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10
mmohaqeqf is on a distinguished road
I am going to answer my own question for future reference:
List<Type> is simply a 1-D array of type "Type", while Field<Type> is a generic template for creating a list of classes of type "Type".
mmohaqeqf is offline   Reply With Quote

Old   May 11, 2021, 15:19
Default
  #8
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by mmohaqeqf View Post
I am going to answer my own question for future reference:
List<Type> is simply a 1-D array of type "Type", while Field<Type> is a generic template for creating a list of classes of type "Type".
Not quite. A Field is just a List with additional ref-counting for converting to/from tmp and generally intended to hold numerical types of data (eg, scalar, vector etc) whereas List could be anything (eg, strings, etc). Since we define by convention that a field holds numeric type of data, we can define various operator overloading for operating on them. That's how the "a + b" magic works on fields, but not general lists.

Edit: I just realised that I even answered almost the same thing about 2 years ago (in the same thread!!) but apparently nobody reads it. Really makes me wonder why I bother
olesen is offline   Reply With Quote

Old   May 12, 2021, 14:49
Default
  #9
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10
mmohaqeqf is on a distinguished road
Thanks;
Don't get discouraged, Mark. You are doing a great job.
But, if you think you already have answered one particular question, you can just reference that answer for the possible future similar questions.
mmohaqeqf is offline   Reply With Quote

Old   July 5, 2022, 03:26
Default
  #10
Member
 
Uttam
Join Date: May 2020
Location: Southampton, United Kingdom
Posts: 35
Rep Power: 6
openfoam_aero is on a distinguished road
Quote:
Originally Posted by olesen View Post
Not quite. A Field is just a List with additional ref-counting for converting to/from tmp and generally intended to hold numerical types of data (eg, scalar, vector etc) whereas List could be anything (eg, strings, etc). Since we define by convention that a field holds numeric type of data, we can define various operator overloading for operating on them. That's how the "a + b" magic works on fields, but not general lists.

Edit: I just realised that I even answered almost the same thing about 2 years ago (in the same thread!!) but apparently nobody reads it. Really makes me wonder why I bother
I want to go ahead and ask a questio. You mentioned that a field is intended to hold numeric data. In programmer's guide page 29, there is a definition of Points which got me confused. It reads:

A list of cell vertex point coordinate vectors, i.e. a vectorField, that is renamed pointField using a typedef declaration;

So is it correct to understand this as "a Field being a collection of lists"?
__________________
Best Regards
Uttam

-----------------------------------------------------------------

“When everything seem to be going against you, remember that the airplane takes off against the wind, not with it.” – Henry Ford.
openfoam_aero is offline   Reply With Quote

Old   July 5, 2022, 06:53
Default
  #11
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by openfoam_aero View Post
A list of cell vertex point coordinate vectors, i.e. a vectorField, that is renamed pointField using a typedef declaration;

So is it correct to understand this as "a Field being a collection of lists"?

Not quite. A vector (or point) is more like a struct of three values (not a list).
openfoam_aero likes this.
olesen is offline   Reply With Quote

Reply

Tags
openfoam 1712, openfoam 1806, programming


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
dot product of vectorField and volVectorField sahm OpenFOAM 2 August 28, 2017 04:56
Multiplication of two volVectorField ChGr OpenFOAM Programming & Development 1 May 30, 2016 12:08
How to extract ONLY ONE Boundary data to make a VectorField File from volVectorField hy1112006 OpenFOAM Programming & Development 2 April 14, 2016 13:11
power of vectorField matthias OpenFOAM Programming & Development 0 August 19, 2014 09:52
Create a Vectorfield joskate OpenFOAM Pre-Processing 0 May 8, 2013 11:22


All times are GMT -4. The time now is 14:56.