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

MapFields utility for staggered grid

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By NotOverUnderated
  • 1 Post By saeed jamshidi
  • 1 Post By NotOverUnderated
  • 1 Post By saeed jamshidi
  • 1 Post By NotOverUnderated
  • 1 Post By saeed jamshidi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 20, 2024, 08:16
Default MapField for different patch and mesh size
  #1
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Hello all,

I have simulated my case in openfoam with the non staggered mesh. However, I'm going to use mapField utility to map for example velocity field on a rectangular staggered mesh.

How can I do that? Is it possible?!

Thank you in advance.

Last edited by saeed jamshidi; January 21, 2024 at 04:02.
saeed jamshidi is offline   Reply With Quote

Old   January 20, 2024, 08:28
Default
  #2
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
How did you run an OpenFOAM case with a non-staggered mesh?
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 20, 2024, 09:37
Default
  #3
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Ok, it was my bad explanation.

Let's consider this case in which you've modelled your case with the following mesh:
layeraddition_snappy.png

now you are goiing to map the velocity field to the following mesh:
400px-Cube_case_base_mesh.jpg

The question is how it can be performed?
saeed jamshidi is offline   Reply With Quote

Old   January 20, 2024, 10:34
Default
  #4
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
Try to follow the steps in this post:

How to mapfields

If that does not work for some reason, report the error message here.

Regards
saeed jamshidi likes this.
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 20, 2024, 12:49
Default
  #5
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Dear NotOverUnderated,

Thank you for the reply.

I am beginner in mapfield utility, and I need more details in order to handle my case.

Could you provide me some more information regarding the procedures?

Best
saeed jamshidi is offline   Reply With Quote

Old   January 20, 2024, 14:28
Default
  #6
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
I made some progress...

However, I have come across an error about number of target cells:

Code:
saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/target$ mapFields -consistent -sourceTime 'latestTime' ../source/
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : mapFields -consistent -sourceTime latestTime ../source/
Date   : Jan 20 2024
Time   : 21:54:10
Host   : DESKTOP-TK3D7CI
PID    : 606
I/O    : uncollated
Case   : /mnt/e/OpenFoam/Run/target
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "/mnt/e/OpenFoam/Run" "source"
Target: "/mnt/e/OpenFoam/Run" "target"

Create databases as time

Source time: 0
Target time: 0.2
Create meshes

Source mesh size: 668000        Target mesh size: 11200



--> FOAM FATAL ERROR: (openfoam-2112 patch=220610)
Incompatible meshes: different number of patches, fromMesh = 7, toMesh = 5

    From Foam::meshToMesh0::meshToMesh0(const Foam::fvMesh&, const Foam::fvMesh&)
    in file meshToMesh0/meshToMesh0.C at line 134.

FOAM exiting
It says that the number of target cells must be greater than the source!

why? It isn't possible to map from fine mesh to course mesh?
NotOverUnderated likes this.
saeed jamshidi is offline   Reply With Quote

Old   January 20, 2024, 18:42
Default
  #7
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
Hi Saeed,

as far as I know, mapFields works perfectly fine with mesh with different size. I think the error you're getting is related to the number of patches which is different between the source case and the target case.

I myself used mapFields only in some simple cases. If you're interested to get a quick overview about this utility check this video by József Nagy: https://youtu.be/qUMPdkvKBS8

I can find this thread that I think is related to your case: mapFields with different number of patches

I hope this helps.

Regards
saeed jamshidi likes this.
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 21, 2024, 02:53
Default
  #8
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
NotOverUnderated thanks again.

Yes, it was because of patch issues and I am doing map with different sizes and patches.

However, I tried different commands for executation of mapField;
case 1:
Code:
saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/Target$ mapFields -consistent -sourceTime 'latestTime' ../source/
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : mapFields -consistent -sourceTime latestTime ../source/
Date   : Jan 21 2024
Time   : 09:50:20
Host   : DESKTOP-TK3D7CI
PID    : 603
I/O    : uncollated
Case   : /mnt/e/OpenFoam/Run/Target
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "/mnt/e/OpenFoam/Run" "source"
Target: "/mnt/e/OpenFoam/Run" "Target"

Create databases as time

Source time: 0
Target time: 0.2
Create meshes

Source mesh size: 668000        Target mesh size: 11200



--> FOAM FATAL ERROR: (openfoam-2112 patch=220610)
Incompatible meshes: different number of patches, fromMesh = 7, toMesh = 6

    From Foam::meshToMesh0::meshToMesh0(const Foam::fvMesh&, const Foam::fvMesh&)
    in file meshToMesh0/meshToMesh0.C at line 134.

FOAM exiting
case 2:
Code:
saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/Target$ mapFields -consistent -sourceTime 'latestTime' ../source/ -parallelSource
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : mapFields -consistent -sourceTime latestTime ../source/ -parallelSource
Date   : Jan 21 2024
Time   : 10:01:35
Host   : DESKTOP-TK3D7CI
PID    : 616
I/O    : uncollated
Case   : /mnt/e/OpenFoam/Run/Target
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "/mnt/e/OpenFoam/Run" "source"
Target: "/mnt/e/OpenFoam/Run" "Target"

Create databases as time
Create target mesh

Target mesh size: 11200

Source processor 0

Source time: 0.2
Target time: 0.2
mesh size: 111513
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch outlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch top has no faces. Not performing mapping for it.

Mapping fields for time 0.2


Source processor 1

Source time: 0.2
Target time: 0.2
mesh size: 111371
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch inlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch outlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch top has no faces. Not performing mapping for it.

Mapping fields for time 0.2


Source processor 2

Source time: 0.2
Target time: 0.2
mesh size: 111116
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch inlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch top has no faces. Not performing mapping for it.

Mapping fields for time 0.2


Source processor 3

Source time: 0.2
Target time: 0.2
mesh size: 111154
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch outlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch bottom has no faces. Not performing mapping for it.

Mapping fields for time 0.2


Source processor 4

Source time: 0.2
Target time: 0.2
mesh size: 111296
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch inlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch outlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch bottom has no faces. Not performing mapping for it.

Mapping fields for time 0.2


Source processor 5

Source time: 0.2
Target time: 0.2
mesh size: 111550
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch inlet has no faces. Not performing mapping for it.
--> FOAM Warning :
    From void Foam::meshToMesh0::calcAddressing()
    in file meshToMesh0/calculateMeshToMesh0Addressing.C at line 148
    Source patch bottom has no faces. Not performing mapping for it.

Mapping fields for time 0.2


End
case 3:
Code:
saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/Target$ mapFields -sourceTime 'latestTime' ../source/ -parallelSourc
e
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : mapFields -sourceTime latestTime ../source/ -parallelSource
Date   : Jan 21 2024
Time   : 10:10:56
Host   : DESKTOP-TK3D7CI
PID    : 619
I/O    : uncollated
Case   : /mnt/e/OpenFoam/Run/Target
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "/mnt/e/OpenFoam/Run" "source"
Target: "/mnt/e/OpenFoam/Run" "Target"

Create databases as time
Create target mesh

Target mesh size: 11200

Source processor 0

Source time: 0.2
Target time: 0.2
mesh size: 111513

Mapping fields for time 0.2


Source processor 1

Source time: 0.2
Target time: 0.2
mesh size: 111371

Mapping fields for time 0.2


Source processor 2

Source time: 0.2
Target time: 0.2
mesh size: 111116

Mapping fields for time 0.2


Source processor 3

Source time: 0.2
Target time: 0.2
mesh size: 111154

Mapping fields for time 0.2


Source processor 4

Source time: 0.2
Target time: 0.2
mesh size: 111296

Mapping fields for time 0.2


Source processor 5

Source time: 0.2
Target time: 0.2
mesh size: 111550

Mapping fields for time 0.2


End
The case 3 was performed without any error, but nothing has genereted in latestTime (0.2 second) folder in target!!!
saeed jamshidi is offline   Reply With Quote

Old   January 21, 2024, 02:59
Default
  #9
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
By the way this is my mapFieldDict:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      mapFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

patchMap
(

);

cuttingPatches 
(

);


// ************************************************************************* //
Source blockMesh:
Code:
saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/source$ checkMesh
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : checkMesh
Date   : Jan 21 2024
Time   : 10:28:06
Host   : DESKTOP-TK3D7CI
PID    : 623
I/O    : uncollated
Case   : /mnt/e/OpenFoam/Run/source
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0

Mesh stats
    points:           740740
    faces:            2076200
    internal faces:   1931800
    cells:            668000
    faces per cell:   6
    boundary patches: 7
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     668000
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch               Faces    Points   Surface topology
    inlet               1600     1771     ok (non-closed singly connected)
    outlet              1600     1771     ok (non-closed singly connected)
    cylinder            2400     2640     ok (non-closed singly connected)
    top                 2600     2871     ok (non-closed singly connected)
    bottom              2600     2871     ok (non-closed singly connected)
    back                66800    67340    ok (non-closed singly connected)
    front               66800    67340    ok (non-closed singly connected)

Checking faceZone topology for multiply connected surfaces...
    No faceZones found.

Checking basic cellZone addressing...
    No cellZones found.

Checking geometry...
    Overall domain bounding box (-0.4 -0.4 -0.01) (1 0.4 0.01)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (-4.41575e-18 -7.09869e-18 1.66212e-14) OK.
    Max cell openness = 9.0192e-16 OK.
    Max aspect ratio = 65.3413 OK.
    Minimum face area = 1.5997e-08. Maximum face area = 0.000174079.  Face area magnitudes OK.
    Min volume = 3.20006e-11. Max volume = 3.48158e-07.  Total volume = 0.0223749.  Cell volumes OK.
    Mesh non-orthogonality Max: 44.1889 average: 7.86983
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.434082 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End
Target blockMesh:
Code:
saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/Target$ blockMesh
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : blockMesh
Date   : Jan 21 2024
Time   : 10:27:14
Host   : DESKTOP-TK3D7CI
PID    : 621
I/O    : uncollated
Case   : /mnt/e/OpenFoam/Run/Target
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Creating block mesh from "system/blockMeshDict"
Creating block edges
No non-planar block faces defined
Creating topology blocks

Creating topology patches - from boundary section

Creating block mesh topology

Check topology

        Basic statistics
                Number of internal faces : 0
                Number of boundary faces : 6
                Number of defined boundary faces : 6
                Number of undefined boundary faces : 0
        Checking patch -> block consistency

Creating block offsets
Creating merge list (topological search)...
Deleting polyMesh directory "constant/polyMesh"

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale (1 1 1)
    Block 0 cell size :
        i : 0.01 .. 0.01
        j : 0.01 .. 0.01
        k : 0.02 .. 0.02


There are no merge patch pairs

Writing polyMesh with 0 cellZones
----------------
Mesh Information
----------------
  boundingBox: (-0.4 -0.4 -0.01) (1 0.4 0.01)
  nPoints: 22842
  nCells: 11200
  nFaces: 45020
  nInternalFaces: 22180
----------------
Patches
----------------
  patch 0 (start: 22180 size: 80) name: inlet
  patch 1 (start: 22260 size: 80) name: outlet
  patch 2 (start: 22340 size: 140) name: top
  patch 3 (start: 22480 size: 140) name: bottom
  patch 4 (start: 22620 size: 11200) name: front
  patch 5 (start: 33820 size: 11200) name: back

End

Last edited by saeed jamshidi; January 21, 2024 at 04:02.
saeed jamshidi is offline   Reply With Quote

Old   January 21, 2024, 04:40
Default
  #10
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Hi again,

I found the problem. The contents of the 0 folder must be inside the latest time (0.2 second) folder.
Code:
saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/Target$ mapFields -sourceTime 'latestTime' ../source/ -parallelSource
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2112                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch   : "LSB;label=32;scalar=64"
Exec   : mapFields -sourceTime latestTime ../source/ -parallelSource
Date   : Jan 21 2024
Time   : 11:54:25
Host   : DESKTOP-TK3D7CI
PID    : 762
I/O    : uncollated
Case   : /mnt/e/OpenFoam/Run/Target
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "/mnt/e/OpenFoam/Run" "source"
Target: "/mnt/e/OpenFoam/Run" "Target"

Create databases as time
Create target mesh

Target mesh size: 11200

Source processor 0

Source time: 0.2
Target time: 0.2
mesh size: 111513

Mapping fields for time 0.2

    interpolating nut
    interpolating p
    interpolating k
    interpolating omega
    interpolating U

Source processor 1

Source time: 0.2
Target time: 0.2
mesh size: 111371

Mapping fields for time 0.2

    interpolating nut
    interpolating p
    interpolating k
    interpolating omega
    interpolating U

Source processor 2

Source time: 0.2
Target time: 0.2
mesh size: 111116

Mapping fields for time 0.2

    interpolating nut
    interpolating p
    interpolating k
    interpolating omega
    interpolating U

Source processor 3

Source time: 0.2
Target time: 0.2
mesh size: 111154

Mapping fields for time 0.2

    interpolating nut
    interpolating p
    interpolating k
    interpolating omega
    interpolating U

Source processor 4

Source time: 0.2
Target time: 0.2
mesh size: 111296

Mapping fields for time 0.2

    interpolating nut
    interpolating p
    interpolating k
    interpolating omega
    interpolating U

Source processor 5

Source time: 0.2
Target time: 0.2
mesh size: 111550

Mapping fields for time 0.2

    interpolating nut
    interpolating p
    interpolating k
    interpolating omega
    interpolating U

End
Let's summarize the required steps:
  1. Make Target directory with containing folders of system, constant and latest Time (name it based on the what time step you want, for example here is 0.2 second)
  2. Copy all 0 folder contents (U, P & ...) inside sourse directory to this folder in Target directory
  3. Append MapfieldDict in the system folder in Target
  4. In order to execute mapping go to the target directory and enter the following command (change it based on your case):
  5. Code:
    saeedfoam@DESKTOP-TK3D7CI:/mnt/e/OpenFoam/Run/Target$ mapFields -sourceTime 'latestTime' ../source/ -parallelSource

Edit: keep in mind you should execute blockMesh in target directory before running the above command.
Attached Images
File Type: jpg Screenshot (261).jpg (176.3 KB, 14 views)
NotOverUnderated likes this.

Last edited by saeed jamshidi; January 21, 2024 at 08:15.
saeed jamshidi is offline   Reply With Quote

Old   January 21, 2024, 08:08
Default
  #11
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
That was the case where you can do maping for a specific period of time, now I would like to do maping over runtime through the following utility:

Code:
mapFields1
{
    // Mandatory entries (unmodifiable)
    type            mapFields;
    libs            (fieldFunctionObjects);

    // Mandatory (inherited) entries (runtime modifiable)
    fields          (<field1> <field2> ... <fieldN>);
    mapRegion       coarseMesh;
    mapMethod       cellVolumeWeight;
    consistent      true;

    // Optional entries (runtime modifiable)
    // patchMapMethod  direct;  // AMI-related entry
    // enabled if consistent=false
    // patchMap        (<patchSrc> <patchTgt>);
    // cuttingPatches  (<patchTgt1> <patchTgt2> ... <patchTgtN>);

    // Optional (inherited) entries
    region          region0;
    enabled         true;
    log             true;
    timeStart       0;
    timeEnd         1000;
    executeControl  timeStep;
    executeInterval 1;
    writeControl    timeStep;
    writeInterval   1;
}
So what would be the steps?

I have adopted it inside my controlDict:

Code:
functions
{
     mapFields1
    {
        type            mapFields;
        libs            (fieldFunctionObjects);
        mapRegion       Target;
        mapMethod       cellVolumeWeight;
        consistent      no;
        patchMap        ();
        cuttingPatches  ();
        fields
        (
            U
            p
        );

        executeControl  writeTime;

        writeControl    writeTime;
        
    }

}
Nevertheless, one question left for me about mapRegion Target?!
How can I adopt this part for my case?

Regards
saeed jamshidi is offline   Reply With Quote

Old   January 21, 2024, 08:31
Default
  #12
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
I think you need to create a region. I have never done that myself before but I believe this is easy when checking the cavityMappingTest tutorials.

Code:
$FOAM_TUTORIALS/tutorials/incompressible/icoFoam/cavityMappingTest
In that tutorial only one case is used but two blockMeshDict files are used to create a coarse and a fine meshes.

Code:
# create the coarse mesh
blockMesh -dict system/blockMeshDict.coarse

# move the coarse mesh to its own folder
mv constant/polyMesh constant/coarseMesh

# create the fine mesh
blockMesh -dict system/blockMeshDict.fine
Notice also that there is a folder with the name 'coarseMesh' inside the system directory as well.
saeed jamshidi likes this.
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 21, 2024, 13:16
Default
  #13
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Thanks for the information.

Code:
 // Optional (inherited) entries
        region          region0;
It doesn't mandatory to create a region, region0 refers to the entire domain by default and it is optional.

However, in the cavityMappingTest tutorial the mapping over runtime has not mentioned.

I would appreciate any help regarding this matter as well as any idea for mapping all of the time steps with postProcess utility.

Thanks.

Last edited by saeed jamshidi; January 21, 2024 at 14:56.
saeed jamshidi is offline   Reply With Quote

Old   January 21, 2024, 16:38
Default
  #14
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
In your question you're asking about mapRegion keyword not region keyword.
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 21, 2024, 16:40
Default
  #15
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
I am working on it, and it gave me some satisfactory feedback.
Tomorrow I will share my findings.

Best
saeed jamshidi is offline   Reply With Quote

Old   January 22, 2024, 08:05
Default
  #16
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Dear NotOverUnderated,

I followed the steps of cavityMappingTest, and finally became successful to perform mapping over runTime. However, I have come across another isssue with that.

Original result:Screenshot (263).jpg

The interpolated results:Screenshot (264).jpg & Screenshot (265).jpg

As you can see, when I use point data illustration, every thing got messed up!

However, mapping of cell data illustration seems good.

Does it depend on the factors of:

Quote:
Options for the mapMethod entry:
  • direct
  • mapNearest
  • cellVolumeWeight
  • correctedCellVolumeWeight

Options for the patchMapMethod entry:
  • directAMI
  • mapNearestAMI
  • faceAreaWeightAMI
  • partialFaceAreaWeightAMI
??
saeed jamshidi is offline   Reply With Quote

Old   January 23, 2024, 04:21
Default
  #17
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Any idea?
saeed jamshidi is offline   Reply With Quote

Old   January 23, 2024, 12:36
Default
  #18
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Finally, I found the problem.

The point is I should assign empty type to all patches in the blockMeshDict.course for my case.
Code:
boundary
(
    
    inlet
    {
        type empty;
        faces
        (
            (0 4 7 3)
        );
    }
    outlet
    {
        type empty;
        faces
        (
            (1 5 6 2)
        );
    }
	top
    {
        type empty;
        faces
        (
            (3 2 6 7)
			
        );
    }
	
	bottom
    {
        type empty;
        faces
        (
            
			(0 1 5 4)
        );
    }

	front
    {
        type empty;
        faces
        (
			(0 1 2 3)
				
        );
    }
	back
    {
        type empty;
        faces
        (
			
			(4 5 6 7)	
        );
    }

);
Here is a sample of mapping of flow over a cylinder:

Screenshot (276).jpg & Screenshot (277).jpg
KKlee likes this.
saeed jamshidi 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
Using mapFields on a moving grid Reptider OpenFOAM Running, Solving & CFD 1 June 28, 2021 06:10
IBM grid recognition in foam-extend 4.1 Guanzhu OpenFOAM 0 January 25, 2021 22:23
Grid Check Script pdp.aero SU2 2 April 23, 2015 02:54
Grid Adaptation Suresh FLUENT 0 October 15, 2003 14:18
GRID TO GRID INTERPOLATION in FLUENT calogero FLUENT 3 June 4, 2003 09:32


All times are GMT -4. The time now is 17:56.