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

internalField of a volField & geoMesh

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By toboto
  • 2 Post By olesen
  • 1 Post By Michael@UW

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2016, 13:25
Default internalField of a volField & geoMesh
  #1
New Member
 
toboto
Join Date: Jun 2016
Posts: 20
Rep Power: 9
toboto is on a distinguished road
Dear All,

I have some questions and I would appreciate if someone help me.

Q1: I am a little bit confused about the difference between volField and it's associated internalField. I can't see any difference although many claims that there is (I think that should be the case).

In the GeometricField.H we can find the definition of the interalField as

Code:
   39 Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&
   40 Foam::GeometricField<Type, PatchField, GeoMesh>::
   41 internalField() const
   42 {
   43     return *this;
   44 }
Also I made a small test to get some attribute of those two fields as follows:
Code:
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info << U.size() << endl;
Info <<U.internalField().size() << endl;
Info << typeid(U).name() << endl;
Info << typeid(U.internalField()).name() << endl;
and the output was
Code:
58539
58539
N4Foam14GeometricFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEE
N4Foam14GeometricFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEE
I.e. the same type and the same size. Also if I print them I get the same values where U.internalField() also contain the boundary information.

So may someone elaborate a little bit on the difference between them.

Q2: where does GeoMesh class reside in the mesh heirarchy in OpenFoam or simply what is the relation between GeoMesh and fvMesh. I tried to find that by looking into the cpp docs but I caouldn't figure out.

Q3: What is the difference/relation between GeometricField and DimensionedField?

Best regards.
toboto is offline   Reply With Quote

Old   November 10, 2016, 19:20
Default
  #2
Member
 
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12
rhythm is on a distinguished road
Hi,

Won't be able to fully answer your question but can give some input.

Q3) GeometricField is derived from DimensionedField. To my basic understanding it adds boundary field to DimensionedField and I guess a bunch of other functions and parameters that are associated with it.
Code:
template<class Type, template<class> class PatchField, class GeoMesh>
class GeometricField
:
    public   DimensionedField<Type, GeoMesh>
{
...
}
Q2) Similar answer. GeoMesh is a 'wrapper' class for different mesh types and volMesh is a derivative class of it:
Code:
class volMesh
:
    public    GeoMesh<fvMesh>
{
...
}
Q1) I'm not entirely sure, so will leave it for someone else to give their input

Cheers,
Ben
rhythm is offline   Reply With Quote

Old   November 14, 2016, 10:14
Default
  #3
New Member
 
toboto
Join Date: Jun 2016
Posts: 20
Rep Power: 9
toboto is on a distinguished road
Dear Ben,

Thanks for your contribution. It really helps. Can you please elaborate on this:
Quote:
GeoMesh is a 'wrapper' class
what does wrapper class mean and for which purpose volMesh for example is used?

Best regards.
granzer likes this.
toboto is offline   Reply With Quote

Old   November 15, 2016, 16:09
Default
  #4
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
I'm not sure how to give you a good answer as I doubt if I have a proper understanding of the matter at hand. But I think reading the programmer's guide might help:
http://foam.sourceforge.net/docs/Gui...mmersGuide.pdf
Go to page 27 and start reading from section 2.2
anishtain4 is offline   Reply With Quote

Old   November 16, 2016, 07:47
Default
  #5
Member
 
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12
rhythm is on a distinguished road
Quote:
Originally Posted by toboto View Post
Dear Ben,

Thanks for your contribution. It really helps. Can you please elaborate on this:

what does wrapper class mean and for which purpose volMesh for example is used?

Best regards.

Hi,

Well I used the terminology that is used in description of the GeoMesh file ($FOAM_SRC/OpenFOAM/meshes/GeoMesh/GeoMesh.H).

Anyways, I believe that what it means is that GeoMesh is simply a class out of which all of the other mesh classes are derived.
My guess is that they call it wrapper because it does not have the regular *.H *.C code structure and it does not really do much. Anyways, we are delving into semantics here (which I probably would be butchered for by proper C++ programmers ).

As I have said classes like volMesh, surfaceMesh, pointMesh, etc. are derived from GeoMesh class/wrapper.

For the future hierarchy questions I would recommend checking doxygen page of OpenFOAM as it gives a graphical representation of how parent-daughter classes are connected -> http://openfoam.com/documentation/cpp-guide/html/
volMesh: http://openfoam.com/documentation/cp...ml/a03059.html

Hope this helps.
Cheers,
Ben
rhythm is offline   Reply With Quote

Old   November 20, 2016, 23:03
Default
  #6
New Member
 
toboto
Join Date: Jun 2016
Posts: 20
Rep Power: 9
toboto is on a distinguished road
O.K. I think now it's clear enough. Thanks again Ben.
Still question 1 if any one can help
toboto is offline   Reply With Quote

Old   November 21, 2016, 02:10
Default
  #7
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Better said that GeoMesh is a template parameter, not a wrapper.
olesen is offline   Reply With Quote

Old   November 21, 2016, 02:19
Default
  #8
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
A volField has dimensions, an internalField and a boundaryField. You'll see this in the field files (eg, 0/U etc).
There are various ways that you could use to have these three bits of information in a class: bundle each as a data member, use multiple inheritance, inherit one or more and add the balance as data members.
You could, for instance, think of a volField as an internal field with an additional boundary field 'attached' to it.
guin and Michael@UW like this.
olesen is offline   Reply With Quote

Old   April 28, 2020, 12:40
Default
  #9
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
Quote:
Originally Posted by toboto View Post
O.K. I think now it's clear enough. Thanks again Ben.
Still question 1 if any one can help
Can you explain a little bit about volMesh? What is the purpose of this class? Since it is derived from GeoMesh<fvMesh>, then it has everything from fvMesh. If we have a fvMesh, why do we need volMesh?
granzer likes this.
Michael@UW is offline   Reply With Quote

Old   December 22, 2020, 05:47
Default
  #10
Senior Member
 
Mandeep Shetty
Join Date: Apr 2016
Posts: 185
Rep Power: 10
granzer is on a distinguished road
Quote:
Originally Posted by Michael@UW View Post
Can you explain a little bit about volMesh? What is the purpose of this class? Since it is derived from GeoMesh<fvMesh>, then it has everything from fvMesh. If we have a fvMesh, why do we need volMesh?
Here is what I have learned sofar and I am not sure this is a perfect account of how things work as I have still a lot to learn on how OF works. But I will give it a go.
As you said volMesh does inherit from the GeoMesh<fvmesh>. But if you read about the GeoMesh template its actually GeoMesh<MESH>, where MESH is just an identifier for a data type/class that GeoMesh <MESH> template will me 'templated' on. GeoMesh can be templated on, as in our case, fvMesh but also on other types of mesh like polyMesh etc. Now the GeoMesh template is a wrapper class. A wrapper class mean that it will extend the functionalities of 'something' either by giving more functions or changing the interface to the 'somethig' (so its like an API). That 'something' here in our case is fvMesh, but it could also be surfMesh, faMesh, polymesh etc... and the GeoMesh further 'extends' all these different types of meshes by allowing us to deal with all of them in a similar way(ie we don't have to worry if we have a fvMesh or faMesh or polyMesh etc when we 'wrape' it using GeoMesh).
You are right in saying that when there is fvMesh we don't actually need volMesh. But volMesh class is created so as to make our life easy in accessing certain info required for FV discritization (for example size() function in volMesh) . That info is ofcourse already present in fvMesh but if we had to access it from fvMesh we would have to write few lines of code. Since this info is required quite regularly a separate class was created called volMesh. Now the info that volMesh deals with has to do with cell centers and it doesn't deal with other info that are present in fvMesh like face centers etc. (That will be delt with by surfaceMesh)

Note: Compare volMesh, surfaceMesh, pointMesh with volField<type>, surfaceField<type> and pointField<type> to understand more.

If someone with more knowledge can verify what I have written that will be great.

Last edited by granzer; January 6, 2021 at 06:09.
granzer is offline   Reply With Quote

Reply


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
Help with if statement CHARLES OpenFOAM Programming & Development 17 August 22, 2021 03:14
Elementwise multiplication operator johndeas OpenFOAM Running, Solving & CFD 3 March 9, 2019 13:03
adding compressible option to ptot immortality OpenFOAM Programming & Development 13 June 15, 2015 15:00
Sampling rhoFlux in electrostaticFoam sverdoold OpenFOAM Post-Processing 14 November 16, 2010 16:19
A stupid question luckyluke OpenFOAM Running, Solving & CFD 14 August 13, 2007 04:25


All times are GMT -4. The time now is 04:11.