CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   DirectMappedPatchBase, offset and samplePatch (http://www.cfd-online.com/Forums/openfoam-bugs/80736-directmappedpatchbase-offset-samplepatch.html)

Fransje October 5, 2010 06:20

DirectMappedPatchBase, offset and samplePatch
 
Dear Foamers,

I've encountered an issue I couldn't quite understand when using the directMappedVelocityFlux boundary condition. In the ./constant/polyMesh/boundary file I specify the following:
Code:

inlet1
{
    type                directMappedPatch;
    nFaces            512;
    startFace          95232;
    offset              (0 0 0);
    sampleRegion    region0;
    sampleMode      nearestPatchFace;
    samplePatch      outlet1;
}

inlet2
{
    type              directMappedPatch;
    nFaces            512;
    startFace        95744;
    offset              (0 0 0);
    sampleRegion  region0;
    sampleMode    nearestPatchFace;
    samplePatch    outlet2;
}

And run blockMesh. The blockMesh utility overwrites the samplePatch information back to none, so after running blockMesh, I re-modify samplePatch back to outlet1 and outlet2. Up to here, all is well.
The problem comes when running pisoFoam, which returns the following error:
Code:

--> FOAM FATAL ERROR:
Did not find sample (0 0.03125 0.0625) on any processor of region region0

    From function directMappedPatchBase::findSamples(const pointField&, labelList&, labelList&, pointField&)
    in file directMapped/directMappedPolyPatch/directMappedPatchBase.C at line 364.

FOAM exiting

Changing the offset value to (1 0 0) for both patches returns almost the same error, with pisoFoam complaining about not finding sample (1 0.03125 0.0625).

However! Changing the offset value to (2 0 0) does work! Any tips/ideas why? :confused: :confused: :confused:

And when specifying that offset, the mapped velocities are taken from the patches outlet1 and outlet2 located at (6 0 0) -which was what I was trying to achieve-, but having absolutely nothing to do with the offset (2 0 0)...
So I was thinking that maybe I was misunderstanding the concept of the offset value, and I was wondering if someone would happen to know what the offset value is compared to the samplePatch option? Do they have anything to do with each other?

Looking forward to you replies!

Francois.

elia87 September 28, 2012 07:53

Hi Francois,

I don't know if you are still using OpenFOAM and anyway I guess you have solved this problem, but I'm going to answer your question hoping it will be useful for other foamers.

In offset dictionary you have to put the distance between the mapped patches.


For example:

I want to map a fan_outlet patch to the fan_inlet one; fan_outlet is a linear extrusion of fan_inlet patch in positive y direction for 2.75 meters.

This is how I set my constant/polyMesh/boundary file

Code:

    fan_outlet
    {
        type                mappedPatch;
        nFaces            800;
        startFace          2524850;
        sampleMode        nearestPatchFace;
        samplePatch        fan_inlet;
        offsetMode          uniform;
        offset                        (0 -2.75 0); //negative because fan_inlet is behind fan_outlet
    }
    fan_inlet
    {
        type              patch;
        nFaces          800;
        startFace      2525650;
    }


Jeffzda April 16, 2013 21:21

Question
 
Hi Elia,

I am having trouble understanding what it means to map a patch. Does this map all the surface fields to the new patch? I'm trying to generate a mappedPatch for use with the viewFactorsGen utility for radiation modelling. Specifically, I don't understand what you mean by one patch being a 'linear extrusion' of another. My understanding is that an extrusion of an area is a volume, but the extrusion you're talking about is still surely a patch area. I wonder if you could explain this a bit further.

Thank you for posting this just for a sake of fellow foamers!

Cheers,

Jeff

elia87 April 29, 2013 10:52

2 Attachment(s)
Hi Jeffzda,

I will try to better explain myself.

I have modeled a jet fan in a road tunnel as a simple cave cylinder (in figure 1.png you can see a slice of the tunnel with fan_inlet and fan_outlet patches).

For some reasons I want the flow through fan_outlet to be the same as the fan_inlet's one, so I mapped U, epsilon, k and nut from fan_inlet (where they have a 'zeroGradient' boundary condition) to fan_outlet.
In figure 2.png you can see for example the axial component of velocity on fan_inlet and fan_outlet patches.

To do this it is necessary to use a 'mapped' boundary conditions on fan_outlet for U and turbulent quantities.

Code:

// content of 0/U file //   

fan_outlet
    {
        type                mapped;
        value              uniform (0 0 0);
        interpolationScheme cell;
        setAverage          false;
        average            (0 0 0);
    }

But 'mapped' boundary conditions can be applied only on 'mappedPatch' patches.
So I have manually modified (it is not necessary to use 'createPatch' in this case, at least in OF 2.1.x) the 'constant/polyMesh/boundary' file for fan_outlet

Code:

// content of constant/polyMesh/boundary file //
   
    fan_outlet
    {
        type            mappedPatch;
        nFaces        800;
        startFace      2524850;
        sampleMode        nearestPatchFace;
        samplePatch        fan_inlet;
        offsetMode        uniform;
        offset  (0 -2.75 0); //negative because fan_inlet is behind fan_outlet
    }
    fan_inlet
    {
        type              patch;
        nFaces          800;
        startFace      2525650;
    }

Where (0 -2.75 0) is simply the distance between patch fan_outlet and fan_inlet. The word "extrusion" is quite inappropriate, sorry.

PS: I used a 'mapped' boundary condition for U, k and epsilon, but for p I used a 'zeroGradient' condition on fan_outlet. So I think you can choose which fields to map on the 'mappedPatch'. If you use a BC type different from 'mapped', the 'mappedPatch' (fan_outlet in my case) will behave as a simple patch of 'patch' type.

Jeffzda May 1, 2013 03:38

Hi Elia,

Thanks for your reply, that is much clearer now!

Jeff


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