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

difference volVectorField and vectorField

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

Like Tree1Likes
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2018, 09:25
Default difference volVectorField and vectorField
  #1
Member
 
annan
Join Date: Nov 2016
Posts: 70
Rep Power: 6
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, 06:59
Default
  #2
New Member
 
Karl Yang
Join Date: Jul 2016
Posts: 11
Rep Power: 7
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, 02:32
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,268
Rep Power: 30
olesen will become famous soon enougholesen will become famous soon enough
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.
olesen is offline   Reply With Quote

Old   January 4, 2019, 03:03
Default
  #4
New Member
 
Karl Yang
Join Date: Jul 2016
Posts: 11
Rep Power: 7
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, 03:28
Default
  #5
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 116
Rep Power: 11
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, 18:06
Default
  #6
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 41
Rep Power: 7
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, 05:00
Default
  #7
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 41
Rep Power: 7
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, 14:19
Default
  #8
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,268
Rep Power: 30
olesen will become famous soon enougholesen will become famous soon enough
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
mmohaqeqf likes this.
olesen is offline   Reply With Quote

Old   May 12, 2021, 13:49
Default
  #9
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 41
Rep Power: 7
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

Reply

Tags
openfoam 1712, openfoam 1806, programming

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


All times are GMT -4. The time now is 01:21.