CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Map a field across patch between two meshes (https://www.cfd-online.com/Forums/openfoam-programming-development/221380-map-field-across-patch-between-two-meshes.html)

celestial October 14, 2019 21:58

Map a field across patch between two meshes
 
Hi everybody

Either this will be obvious to most of you or else it will be baffling to all.
I have no idea and so I have to give it a shot.

Here is a short excerpt from my createFields.H :

.........


Info<< "Reading field Fa, Fs \n" << endl;

volScalarField Fa
(
IOobject
(
"Fa",
runTime.timeName(),
airMesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
airMesh
);

volScalarField Fs
(
IOobject
(
"Fs",
runTime.timeName(),
solidMesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
solidMesh
);

..........

and what follows is a relevant excerpt from my C code:



...............

// patch airsolid is defined in the case dictionaries polyMesh for both meshes //airMesh and solidMesh
// the two meshes were created independently of each other. They only share the common interface airsolid in the geometry


const label id1= airMesh.boundaryMesh().findPatchID"airsolid");
const fvPatch& patch1 = airMesh.boundary()[id1];


const label id2= solidMesh.boundaryMesh().findPatchID"airsolid");
const fvPatch& patch2 = solidMesh.boundary()[id2];




scalarField dummy(patch1.size(), scalar(0) );


forAll(patch1, i)
{

dummy[i] = Fa[patch1.faceCells()[i] ] - ????;


// the above line is my problem.
// by ???? I mean some kind of interpolation of the values on the solid side:

// Fs[patch2.faceCells()[j] ] where the values of j will depend on the // current value of i
// (of course, j lies in the range 0 to patch2.size)


}

............

The question is whether any such mapping actually exist in OF.


At any rate, best regards to the community regardless of what come out of this inquiry.

clapointe October 16, 2019 12:17

Check out chtMultiRegionFoam -- this does multiple air/solid regions (that are coupled). The type of boundary condition necessary will depend on the field.

Caelan

celestial October 18, 2019 11:45

Thanks but chtMultiRegionFoam coupling is about interpolating the boundary condition (so on the patch face) In fact, all interpolation schemes e.g. AMI, GGI, groovyBC, have dictionaries that deal with those patches.

I am solving a Poisson equation in say the air region given a potential value on the patch as well as the potential on the solid side on the adjacent cell. Swak4foam's groovyBC has a mapped function in the dictionary that I assume the solver implicitly invokes.

But to test for the solver's convergence, I need access to this adjacent cell potential even after the call to that solver.

So I am now thinking of applying routines found in GIInterpolationWeights.C ( foam-extend 4.0) ( which in essence gets the weights from the Sutherland-Hodgman algorithm on polygon intersections ) to this adjacent potential instead of to the patch face. I am currently trying to find code examples of calls to these routines. If anybody is familiar with them, that would be great.

Best regards to all


All times are GMT -4. The time now is 13:19.