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

Undesired extrapolation when using mapFields/meshToMesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2019, 15:19
Default Undesired extrapolation when using mapFields/meshToMesh
  #1
ch1
New Member
 
Christian
Join Date: Jun 2019
Posts: 14
Rep Power: 7
ch1 is on a distinguished road
Hi everyone,
I am using mapFields/meshToMesh functionality to map a scalar field at runtime between two meshes with inconsistent geometry. You can find images of source and target fields as well as their respective meshes in the attachments.
To produce the mapped target field I'm using the following code in foam-extend 4.0.:
Code:
// read the mapFieldsDict located in /case/system
IOdictionary mapFieldsDict
(
	IOobject
	(
		"mapFieldsDict",
		runTime.system(),
		runTime,
		IOobject::MUST_READ,
		IOobject::NO_WRITE,
		false
	)
);

HashTable<word> patchMap;
wordList cuttingPatches;
mapFieldsDict.lookup("patchMap") >> patchMap;
mapFieldsDict.lookup("cuttingPatches") >>  cuttingPatches;

// Create the interpolation scheme
meshToMesh fluidToEmInterp
(
    mesh, //source mesh
    targetMesh, //target mesh
    patchMap,
    cuttingPatches
);

// Interpolate field
fluidToEmInterp.interpolate
(
    targetField, //target field
    sourceField, //source field
    meshToMesh::INTERPOLATE 
);
In targetField.png you can actually see that mapFields extrapolated over those gaps of the sourceMesh except a thin stripe, which remained from the right gap. But this is actually not so critical.

What really bothers me is the extrapolation of the targetField over the right boundary of the sourceMesh as illustrated in overlappingMeshes.jpg.

How can I suppress this behavior?

Best regards
Christian
Attached Images
File Type: png sourceField.png (12.8 KB, 48 views)
File Type: png targetField.png (9.4 KB, 38 views)
File Type: jpg sourceMesh.jpg (65.4 KB, 39 views)
File Type: jpg targetMesh.jpg (126.1 KB, 33 views)
File Type: jpg overlappingMeshes.jpg (133.9 KB, 36 views)
ch1 is offline   Reply With Quote

Old   October 15, 2019, 06:08
Default
  #2
ch1
New Member
 
Christian
Join Date: Jun 2019
Posts: 14
Rep Power: 7
ch1 is on a distinguished road
I want to note that I still didn't resolve this issue. However, I found that this issue only occurs if fields are mapped from the smaller to the bigger mesh. The other way around works fine.

My current workaround is the following:
Using two meshes that are identically built with blockMesh for the overlapping region.
If I then want to copy field values from source to target mesh I do the following
Code:
        forAll(T, idx)
        {
            const scalar& cellT = T[idx];
            Ttarget[idx] = cellT;
        }
where T is the source field and Ttarget is the target field. Then you can do whatever you want with the copied target field, you can even manipulate inside the loop, for example
Code:
        forAll(T, idx)
        {
            const scalar& cellT = T[idx];
            Ttarget[idx] = 5.0*cellT + 10; //some arbitrary function: y=5*x + 10
        }
In this related thread I described in more detail how to map fields between two meshes in foam-extend 4.0 using meshToMesh library:
Data exchange for internal field values between two different mesh
ch1 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
[ICEM] Export mesh statistics for use in Richardson Extrapolation for grid sensitivity study JuPa ANSYS Meshing & Geometry 13 July 5, 2018 09:35
ReactingFoam (w/ k-omega-SST): Error analysis using Richardson Extrapolation JMDag2004 OpenFOAM Verification & Validation 1 June 10, 2015 13:33
richardson extrapolation Puigar Main CFD Forum 28 March 13, 2013 13:18
Richardson extrapolation pc Main CFD Forum 11 March 8, 2013 07:50
Discretization error with Richardson extrapolation. cfdstudent004 CFX 1 May 29, 2012 20:04


All times are GMT -4. The time now is 02:21.