|
[Sponsors] |
November 10, 2016, 13:25 |
internalField of a volField & geoMesh
|
#1 |
New Member
toboto
Join Date: Jun 2016
Posts: 20
Rep Power: 9 |
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 } 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; Code:
58539 58539 N4Foam14GeometricFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEE N4Foam14GeometricFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEE 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. |
|
November 10, 2016, 19:20 |
|
#2 |
Member
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12 |
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> { ... } Code:
class volMesh : public GeoMesh<fvMesh> { ... } Cheers, Ben |
|
November 14, 2016, 10:14 |
|
#3 | |
New Member
toboto
Join Date: Jun 2016
Posts: 20
Rep Power: 9 |
Dear Ben,
Thanks for your contribution. It really helps. Can you please elaborate on this: Quote:
Best regards. |
||
November 15, 2016, 16:09 |
|
#4 |
Senior Member
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18 |
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 |
|
November 16, 2016, 07:47 |
|
#5 | |
Member
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12 |
Quote:
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 |
||
November 20, 2016, 23:03 |
|
#6 |
New Member
toboto
Join Date: Jun 2016
Posts: 20
Rep Power: 9 |
O.K. I think now it's clear enough. Thanks again Ben.
Still question 1 if any one can help |
|
November 21, 2016, 02:10 |
|
#7 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
Better said that GeoMesh is a template parameter, not a wrapper.
|
|
November 21, 2016, 02:19 |
|
#8 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
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. |
|
April 28, 2020, 12:40 |
|
#9 |
Senior Member
|
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?
|
|
December 22, 2020, 05:47 |
|
#10 | |
Senior Member
Mandeep Shetty
Join Date: Apr 2016
Posts: 185
Rep Power: 10 |
Quote:
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. |
||
|
|
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 |