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

patchToPatchInterpolation doesn't work properly

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2022, 06:44
Default patchToPatchInterpolation doesn't work properly
  #1
New Member
 
pardoa
Join Date: May 2018
Posts: 29
Rep Power: 7
pardoa is on a distinguished road
Hello,

I have successfully coupled two solvers to solve several fields on two separate meshes. Both meshes have the same resolution and share one patch which works as coupling interface. The flow solution from each mesh at the coupling interface is mapped on the other mesh at each timestep. This means, e.g, the U field resulting at the interface patch of one mesh is mapped on the the same patch of the second mesh at each timestep. To achieve this, I have used the function PatchToPatchInterpolation. However, the mapping doesn't work properly. The solution is correct at most of the faces, but somehow, the values are not transferred at some. Since, initially, the nodes are at the same location for both meshes at the interface patch, I assume that the lack of mapping at some faces could be the result of rounding errors? I am just guessing here. Else I don't see why the faces are not correctly mapped from one patch to the other, as their location is exactly the same.

This is the piece of code I am using for the mapping:

Code:
PatchToPatchInterpolation<primitivePatch,primitivePatch> bottomToTopInter
(
    bottomPatchMesh1, //fromPatch
    topPatchMesh2 //toPatch
);

PatchToPatchInterpolation<primitivePatch, primitivePatch> topToBottomInter
(
    topPatchMesh2, //fromPatch
    bottomPatchMesh1 //toPatch
);

U2.boundaryFieldRef()[topPatchMesh2ID] == bottomToTopInter.faceInterpolate<scalar>(U1.boundaryField([bottomPatchMesh1ID]);

U1.boundaryFieldRef()[bottomPatchMesh1ID] == topToBottomInter.faceInterpolate<vector>(U2.boundaryField([topPatchMesh2ID]);
Is there a way to define an interpolation distance or interval? Maybe that could help. Any hint on this matter would be greatly welcome. Thanks!!

Alvaro
pardoa is offline   Reply With Quote

Old   July 22, 2022, 07:21
Default
  #2
New Member
 
pardoa
Join Date: May 2018
Posts: 29
Rep Power: 7
pardoa is on a distinguished road
Hello again,

I tried to directly assign the values from one patch to the other based on the face center coordinates, but some faces remained unmapped.

This is the piece of code that I implemented:

Code:
forAll (faceCtr_meshSub,i)
{
    forAll (faceCtr_mesh,j)
    {
        if (round(mag(faceCtr_mesh[j])*10e6) == round(mag(faceCtr_meshSub[i])*10e6))
        {
            hSub.boundaryFieldRef()[topPatchMesh2ID][i] = hSur.boundaryField()[bottomPatchMesh1ID][j];
        }
    }
}
The coordinates are rounded to avoid potential small differences (smaller than 10e-9) between the coordinates of the face centers of both patches.

By doing this, the differences between both patches decrease dramatically, but the mismatch persists at some cells. I really have no idea why this happens, as now the assignment is straight. There is no interpolation.

Any help will be very welcome!

Alvaro
pardoa 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
Companies that lease software & hardware for cloud-based work? Catthan ANSYS 0 June 18, 2014 10:53
Do all CFD analysts have to do some hands-on work except PhDs? e13drd Main CFD Forum 2 March 17, 2014 14:56
OpenFOAM does not work any more! kiddmax OpenFOAM Installation 12 June 25, 2013 02:56
Why do the Plant library cases don't work? Alumna Phoenics 6 June 22, 2004 12:08
why my In-Form doesn't work? green Phoenics 2 May 27, 2004 21:03


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