CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] Generating nonuniform meshes with sizefunction (https://www.cfd-online.com/Forums/openfoam-meshing/61812-generating-nonuniform-meshes-sizefunction.html)

johndeas July 16, 2009 04:21

I modified the end of my code this way:

Code:

mesh.movePoints(points);

runTime.functionObjects().off();

runTime++;

mesh.write();

And I don't have errors related to fieldAverage anymore. A new time directory is created, but, only points are exported, not the full mesh with boundaries, owners, neighbours, etc... which doesn't make all this very useful.

johndeas July 16, 2009 05:49

I tried to understand a little how all this work.

In an fvMesh, the write() method is a reimplementation of the virtual write() inherited from polyMesh, itself inherited from objectRegistry (and itself from regIOobject).

But, when fvMesh::write() is called, the following code is executed

Code:

bool fvMesh::write() const
{
    return polyMesh::write();
}

and thus the regIOobject::write() is called, in the end.

The problem in my case is that the only written file is points.

When the fvMesh mesh is created, with

Code:

Foam::fvMesh mesh
(
    Foam::IOobject
    (
    Foam::fvMesh::defaultRegion,
    runTime.timeName(),
    runTime,
    Foam::IOobject::MUST_READ
    )
);

the IOobject provided is used by the inherited constructor of polyMesh, which creates the faces_, owner_, etc... each with their own IOobject, and registering all them on the fvMesh object. I don't see where is the difference of treatment, and why only the "points" file is exported.

Plus, if I try a

Code:

mesh.names()
I get:
Code:

11
(
cellZones
fvSolution
meshPhi
points
neighbour
faces
faceZones
fvSchemes
pointZones
boundary
owner
)

Which made me expect to find those files in the time directory.

henrik July 19, 2009 13:10

John,

it's all about saving disk space.

When OF write a mesh, it only saves data that has changed after the last dump. On read OF goes backwards through the time dumps and collects the necessary data.

All what you have to do in order to obtain a "normal" mesh is to copy 1/polyMesh/points into constant/polyMesh and delete the "1" time directory.

Henrik

johndeas July 19, 2009 13:52

Thank you for the information !

Well rewriting the whole polyMesh forced me to dive a little into OF structure which wasn't a bad thing, after all :)

johndeas July 20, 2009 04:36

Something that might be attractive (my 2 cents...) would be to have the same kind of rule for field reading. If I apply a preprocess on the mesh, which outputs to other time directories, the process of field reading would detect and use the latest version so I don't have to manually copy everything on the last time directory.

guillaumem March 26, 2010 03:58

hyperbolic mesh
 
Hi
I am also performing LES on channel flow and i would like to use ane hyperbolic mesh does someone has some know how to do that how to implement the routine in the code

Bertrand April 11, 2010 05:01

Hello Alberto,

I am very new to OF and would like to know if it is possible for you to send me your code about "hyperbolic" (or any other analytical function" meshing? Because I would like to implement it on a variable cross-sectional cylinder, with the number of cells depending on the radius, for instance...

Thank you very much!

Best,

Bertrand

levka April 18, 2012 03:53

final code
 
Hello guys,
could you please upload final working code...:)

kmefun July 31, 2017 17:50

Quote:

Originally Posted by alberto (Post 204647)
Thanks Hrv. It works! :-)

Hello Alberto
I know this is a very old thread. But could you possibly share your code of how to move the internal points of a uniform mesh?

Thank you,

Kaufman


All times are GMT -4. The time now is 06:20.