|
[Sponsors] |
January 8, 2007, 13:04 |
Hi all,
I have such a problem
|
#1 |
Member
|
Hi all,
I have such a problem: I'm using PatchToPatchInterpolation.faceInterpolate() to map boundary conditions on a patch from the coincident patch on another mesh (imposing heat flux and temperature continuity on a solid-fluid interface in a conjugate solver). In a single-processor run it is working perfectly even if the two meshes are not conformal (the global geometry is the same). If I run the case in parallel, with the processor patch normal to the interface, the two sides (solid & fluid) of the interface on processorn are not conformal and have different geometry (there is no way of decomposing the meshes in order to obtain coincident geometry: no shared vertex). In this case PatchToPatchInterpolation.faceInterpolate() is not giving good results in the zone near processor patch, read where the two sides of the interface differ in geometry. Any hint on how to still use PatchToPatchInterpolation.faceInterpolate() is very appreciated. (I use default choices for algorithm and direction) Thanks a lot Cosimo
__________________
Cosimo Bianchini Ergon Research s.r.l. Via Panciatichi, 92 50127 Florence - ITALY Tel: +39 055 0763716 Mob: +39 320 9460153 e-mail: cosimo.bianchini@ergonresearch.it URL: www.ergonresearch.it |
|
April 12, 2011, 07:20 |
|
#2 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Hi,
I realise this is quite an old thread but did you ever get the patchToPatchInterpolation class to work correctly in parallel? Philip |
|
April 12, 2011, 08:38 |
|
#3 |
New Member
Andreas Feymark
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 18
Rep Power: 17 |
Hi,
I'm also interested in knowing the answer! /FEYMARK |
|
April 30, 2011, 13:52 |
|
#4 |
Member
|
It actually is a quite old thread but to my knowledge patchToPatchInterpolation is not working in parallel in the latest versions too. In order to make it work in parallel you can try one of the following ways:
Cosimo
__________________
Cosimo Bianchini Ergon Research s.r.l. Via Panciatichi, 92 50127 Florence - ITALY Tel: +39 055 0763716 Mob: +39 320 9460153 e-mail: cosimo.bianchini@ergonresearch.it URL: www.ergonresearch.it |
|
June 3, 2011, 09:50 |
|
#5 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Hi,
I was able to get my code with patchToPatchInterpolation to work in parallel. The way I did it was: In the case, for the patches of interest define faceZones, using the setSet utility Code:
faceSet <patchName>FaceZone new patchToFace <patchName> quit Code:
setsToZones -noFlipMap Code:
globalFaceZones ( <faceZoneName1> <faceZoneName2>) In your code, you can create a zoneToZoneInterpolation Code:
label faceZone1ID = cp_.mesh().faceZones().findZoneID(facezoneName1); label faceZone2ID = mesh.faceZones().findZoneID(faceZoneName2); zoneToZoneInterpolation faceZoneInterpolator ( mesh.faceZones()[faceZone1ID](), // from mesh.faceZones()[FaceZone2ID](), // to zone ); However be careful when you have a moving mesh as the faceZone meshes might not be moved correctly, you might have to correct them and keep them consistent across the processors. Hope it helps, Philip |
|
March 7, 2013, 16:30 |
|
#6 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
I am trying to use patchtopatchinterpolation.H and I ID'd my patches and declared the pointtopointinterpolation. How do I do the last step, use the interpolator to map one patch to another?
Benjamin Here is my code: 1) Set findID codes. label cathodeID = mesh.boundaryMesh(). findPatchID("bottomcathode"); label electrodeID = mesh.boundaryMesh().findPatchID("topelectrode"); 2) Declare patchtopatchinterpolation. const polyPatch& electrodePatch = mesh.boundaryMesh()[electrodeID]; const polyPatch& cathodePatch = mesh.boundaryMesh()[cathodeID]; patchToPatchInterpolation cathodeToElectrode ( cathodePatch, electrodePatch ); |
|
March 7, 2013, 16:37 |
|
#7 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Hi Benjamin,
From your email, you need to specify the template parameter for the faceInterpolate function i.e: Code:
scalarField interpolatedQuantity = cathodeToElectrode.faceInterpolate<scalar> ( H2O.boundaryField()[cathodePatch] ); Philip |
|
March 7, 2013, 17:30 |
|
#8 | |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
Quote:
HTML Code:
vectorField interpolatedQuantity = fromPatch_To_toPatch_Interpolate.faceInterpolate<vector> ( quantity.boundaryField()[fromPatchIndex] );
Second, what does quantity refer to in your "quantity.boundaryField()[fromPatchIndex]? I am putting my scalarfield (H2O) there but I do not think that is correct. Sincerely, Benjamin |
||
March 8, 2013, 05:38 |
|
#9 | |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Quote:
The quantities mentioned in my previous post are just generic and are to be replaced with your specific scalar/vector/tensor fields. I will try give a more clear example: If I want to copy my temperature field T from the boundary patch called "left" to the boundary patch called "right": Code:
label leftID = mesh.boundaryMesh().findPatchID("left"); label rightID = mesh.boundaryMesh().findPatchID("left"); patchToPatchInterpolation interpolator ( mesh.boundaryMesh()[leftID], // from patch mesh.boundaryMesh()[rightID], // to patch intersection::FULL_RAY, intersection::CONTACT_SPHERE ); scalarField TRightPatch = interpolator.faceInterpolate<scalar>(T.boundaryField()[leftID]); Philip |
||
March 8, 2013, 13:55 |
Nearly there...
|
#10 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
Here is my code, pretty much an exact replica of yours:
HTML Code:
label bottomID = mesh.boundaryMesh().findPatchID("bottomcathode");
label topID = mesh.boundaryMesh().findPatchID("topelectrode");
patchToPatchInterpolation interpolator
(
mesh.boundaryMesh()[bottomID], // from patch
mesh.boundaryMesh()[topID], // to patch
intersection::FULL_RAY,
intersection::CONTACT_SPHERE
);
scalarField H2ObottomcathodePatch = interpolator.faceInterpolate<scalar>
(
H2O.boundaryField()[bottomID]
);
Also, what should my case/0/H2O file look like? Specifically, what type do I use for the patches I'm connecting? Lastly, just to double check, I place this code within the time loop of my solver, right? Sincerely, Benjamin |
|
March 8, 2013, 14:02 |
|
#11 | |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Quote:
The distances are then calculated by either fitting spheres between the surfaces (CONTACT_SPHERE) or using a normal vector (VECTOR). To find out more, you can read through the patchToPatchInterpolation class. Best regards, Philip |
||
March 8, 2013, 14:56 |
|
#12 | |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
Quote:
What should my case/0/H2O file look like? Specifically, what type do I use for the patches I'm connecting? Lastly, just to double check, I place this code within the time loop of my solver, right? Sincerely, Benjamin |
||
March 8, 2013, 15:42 |
|
#13 | ||
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
Quote:
Quote:
HTML Code:
label leftID = mesh.boundaryMesh().findPatchID("left"); label rightID = mesh.boundaryMesh().findPatchID("left"); patchToPatchInterpolation interpolator ( mesh.boundaryMesh()[leftID], // from patch mesh.boundaryMesh()[rightID], // to patch intersection::FULL_RAY, intersection::CONTACT_SPHERE ); scalarField TRightPatch = interpolator.faceInterpolate<scalar>(T.boundaryField()[leftID]);
Benjamin |
|||
March 8, 2013, 16:58 |
Update
|
#14 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
So this is what I have so far:
HTML Code:
label bottomID = mesh.boundaryMesh().findPatchID("bottomcathode");
label topID = mesh.boundaryMesh().findPatchID("topelectrode");
patchToPatchInterpolation interpolator
(
mesh.boundaryMesh()[bottomID], // from patch
mesh.boundaryMesh()[topID], // to patch
intersection::FULL_RAY,
intersection::VECTOR
);
H2O.boundaryField()[topID] = interpolator.faceInterpolate <scalar>
(
H2O.boundaryField()[bottomID]
);
Benjamin |
|
March 11, 2013, 05:44 |
|
#15 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Hi Benjamin,
The patchToPatch interpolation explicitly passes a field from one patch to another, so it allows explicit coupling of patches. Depending on the system, you may need a loop within each time-step where you solve the governing equation then explicitly update the boundaries and iterate until convergence. Alternatively if you could use implicitly coupled boundaries it would probably be faster and more stable. Best regards, Philip |
|
March 11, 2013, 12:13 |
|
#16 | |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
Quote:
Sincerely, Benjamin |
||
March 11, 2013, 13:19 |
|
#17 | |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
Quote:
So I read through your posts that you got patchtopatch coupling working in parallel. And you had already been able to work it in serial. Do you have the code in serial where you get patchtopatch coupling working? Would you be able to share that code? Sincerely, Benjamin |
||
March 12, 2013, 12:05 |
|
#18 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Hi Benjamin,
I used patchToPatchInterpolation in the elasticContactSolidFoam solver (actually in the contactPatchPatch class) which is in the solidMechanics branch of OpenFOAM-1.6-ext. As regards implicit boundary coupling, I am not that familiar with it, I would recommend google and the forum search. Best regards, Philip |
|
March 12, 2013, 16:07 |
|
#19 | ||
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 14 |
Quote:
Quote:
I downloaded the open extension 1.6 and the solidmechanics files. It is extremely complex but I've filtered through it and it seems that I am on the right track. When you do use the interpolator you definitely do use a forall loop. So, I've tried modifying my code. I was hoping you could take a quick look at it to see where I have gone wrong. It just doesn't seem to be picking up those mapped patches when I run the case. It is of a really simple case so very basic. Sincerely, Benjamin |
|||
March 12, 2013, 17:24 |
|
#20 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 |
Benjamin,
I downloaded waterFoam2.tar.gz and looked at the '.C' file, there is a lot of code commented out and it is not clear what exactly you are trying to do and where your problem is. If you tidy up the solver and add descriptive comments pointing out exactly what code is not doing what you expect, then I may be able to help. Best regards, Philip |
|
|
|