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

Confusion about polyMesh constructor

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 2 Post By dlahaye
  • 1 Post By olesen
  • 1 Post By Tobermory
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 28, 2023, 01:32
Default Confusion about polyMesh constructor
  #1
Ary
New Member
 
Join Date: Apr 2023
Posts: 11
Rep Power: 3
Ary is on a distinguished road
Dear all,

This may be another stupid question, but I am so confued. So sorry to bother you.

When we construct mesh object for manipulation such as

Code:
Info<< mesh.cellVolumes() << endl;
We construct the mesh object by

Code:
Foam::polyMesh mesh
{
    IOobject
    (
        defaultRegion,
        runTime.timeName(),
        runTime,
        IOobject::MUST_READ
    )
};
So, why construct mesh based on path [runTime.timeName()] instead of maybe path [runTime.constant().polyMesh()] (or something representing case/constant/polyMesh/)?

I am confused that the mesh is supposed to relate to [constant/polyMesh/] directly rather than [time] directory, right?

If not, how does the [mesh] object get information (such as points, faces) from [constant/polyMesh] directory?

Thank you very much if any kind foamer could help me.

Best regards,
Ary
Ary is offline   Reply With Quote

Old   July 28, 2023, 05:54
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 736
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
Does https://github.com/UnnamedMoose/Basi.../OFtutorial3.C help you?
Tobermory and Ary like this.
dlahaye is offline   Reply With Quote

Old   July 28, 2023, 09:00
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,689
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Ary View Post
Dear all,

This may be another stupid question, but I am so confued. So sorry to bother you.

When we construct mesh object for manipulation such as

Code:
Info<< mesh.cellVolumes() << endl;
We construct the mesh object by

Code:
Foam::polyMesh mesh
{
    IOobject
    (
        defaultRegion,
        runTime.timeName(),
        runTime,
        IOobject::MUST_READ
    )
};
So, why construct mesh based on path [runTime.timeName()] instead of maybe path [runTime.constant().polyMesh()] (or something representing case/constant/polyMesh/)?

I am confused that the mesh is supposed to relate to [constant/polyMesh/] directly rather than [time] directory, right?

If not, how does the [mesh] object get information (such as points, faces) from [constant/polyMesh] directory?

Thank you very much if any kind foamer could help me.

Best regards,
Ary

The simple counter question: how would you manage restarts from dynamic meshes is you always construct from time = constant?
Tobermory likes this.
olesen is offline   Reply With Quote

Old   July 29, 2023, 09:32
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 670
Rep Power: 14
Tobermory will become famous soon enough
Quote:
Originally Posted by dlahaye View Post
That's what I love about this forum - whilst there's a fair amount of sand to sift, I am always tripping across nuggets like this one. Thanks Domenico!
dlahaye likes this.
Tobermory is offline   Reply With Quote

Old   July 30, 2023, 21:08
Default
  #5
Ary
New Member
 
Join Date: Apr 2023
Posts: 11
Rep Power: 3
Ary is on a distinguished road
Quote:
Originally Posted by dlahaye View Post
Thank you so much for your kind reply.

I am so sorry. I didn't get it. I read the member functions before. But how the member functions work even [mesh] object didn't construct from [polyMesh] directory which really contains the poins, faces and cells?

I am sorry my question was not clear before.
Ary is offline   Reply With Quote

Old   July 30, 2023, 21:15
Default
  #6
Ary
New Member
 
Join Date: Apr 2023
Posts: 11
Rep Power: 3
Ary is on a distinguished road
Quote:
Originally Posted by olesen View Post
The simple counter question: how would you manage restarts from dynamic meshes is you always construct from time = constant?
Thank you so much for your kind reply.

Thank you for your question. I don't know anything about dynamic mesh yet. Maybe construct from two both, time and constant/polyMesh ?

I just wonder why the constructor doesn't include [polyMesh] parameter.

I am sorry I am a new foamer and if I make my question stupid.
Ary is offline   Reply With Quote

Old   July 31, 2023, 10:51
Default
  #7
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,689
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
If you read that constructing from timeName() also includes searching back in time until it reaches some valid mesh date, you'll recognize that timeName() also includes constant().
In addition to a static mesh (where everything is defined as "constant" and doesn't change) it is possible to have meshes with changing topologies and meshes in which only the points move, but the connectivity stays the same. These last ones are covered by the difference in points and face instances (if you are examining the code).
Ary likes this.
olesen is offline   Reply With Quote

Old   July 31, 2023, 20:13
Default
  #8
Ary
New Member
 
Join Date: Apr 2023
Posts: 11
Rep Power: 3
Ary is on a distinguished road
Quote:
Originally Posted by olesen View Post
If you read that constructing from timeName() also includes searching back in time until it reaches some valid mesh date, you'll recognize that timeName() also includes constant().
In addition to a static mesh (where everything is defined as "constant" and doesn't change) it is possible to have meshes with changing topologies and meshes in which only the points move, but the connectivity stays the same. These last ones are covered by the difference in points and face instances (if you are examining the code).
Thank you so much for your kind help. I will check that part to understand the question.
Ary is offline   Reply With Quote

Old   August 1, 2023, 03:40
Default
  #9
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,689
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Ary View Post
Thank you so much for your kind help. I will check that part to understand the question.

Don't dive too deeply though - it's easy to get lost.
olesen is offline   Reply With Quote

Old   August 6, 2023, 21:45
Default
  #10
Ary
New Member
 
Join Date: Apr 2023
Posts: 11
Rep Power: 3
Ary is on a distinguished road
Quote:
Originally Posted by olesen View Post
Don't dive too deeply though - it's easy to get lost.
Thank you for the advice.
Ary 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
Adding a Constructor to ThermoCloud schradc OpenFOAM Programming & Development 0 February 4, 2023 21:15
eigenValues of volTensorField xuegy OpenFOAM Programming & Development 8 February 26, 2021 16:46
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 00:21
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 14:07
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 10:56


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