CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Using mapFields if the mesh has different regions (http://www.cfd-online.com/Forums/openfoam-pre-processing/84595-using-mapfields-if-mesh-has-different-regions.html)

stevenvanharen February 3, 2011 06:31

Using mapFields if the mesh has different regions
 
Dear all,

I would like to use mapFields to map the velocity field form a simulation containing only one region to a simulation containing multiple regions. Is this possible? Does somebody know how to do it?

On of the regions in the targer folder is the same size as the region in the source folder.

Any help will be appreciated.

Kind regards,

Steven

stevenvanharen February 3, 2011 13:12

Fixed it myself, turned out it was not to hard :D

If anyone needs it let me know.

laurint March 3, 2011 01:16

I would like to hear your solution. I'm mapping from mesh with two region onto a mesh with similar regions, but nothing seems to work.

Lauri

stevenvanharen March 3, 2011 04:03

1 Attachment(s)
Just take a look at this source code.

I added the -region option to the utility and changed:

Code:

  fvMesh meshTarget
        (
            IOobject
            (
                fvMesh::defaultRegion,
                runTimeTarget.timeName(),
                runTimeTarget
            )
        );

into:

Code:

  fvMesh meshTarget
        (
            IOobject
            (
                            regionName,
                            runTimeTarget.timeName(),
                            runTimeTarget,
                            Foam::IOobject::MUST_READ
                            /* 
                fvMesh::defaultRegion,
                runTimeSource.timeName(),
                runTimeSource*/
            )
        );

However, this will only work for consistent meshes and serial cases.

laurint March 3, 2011 04:53

Thank you for the quick reply. Your solution works perfectly.

I added the region-thing also for the source, although now they have to have same names.


All times are GMT -4. The time now is 03:15.