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

Indentify internal field value at specific patch

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Giancarlo_IngChimico

Reply
 
LinkBack Thread Tools Display Modes
Old   April 11, 2013, 17:18
Post Indentify internal field value at specific patch
  #1
New Member
 
Giancarlo
Join Date: Apr 2013
Location: Milan
Posts: 18
Rep Power: 4
Giancarlo_IngChimico is on a distinguished road
Hi guys,
I have a patch named "fluid_to solid" in my mesh. In order to copy the values of a field in correspondence to this specific field I have written the following code:

Code:
forAll( TFluid[j].boundaryField(), patchi)
    {
        label patchID = fluidRegions[j].boundaryMesh().findPatchID("fluid_to_solid"); 
        forAll( TFluid[j].boundaryField()[patchID], facei)
            {
                Tf[facei+1] = TFluid[j].boundaryField()[patchID][facei]; 
            }
                    
    }
It seems to work fine.

My problem now is copy the internal values of the same field at the patch "fluid_to_solid"...

Can anyone help me?


Best


Giancarlo
immortality likes this.
Giancarlo_IngChimico is offline   Reply With Quote

Old   April 13, 2013, 13:54
Default
  #2
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,174
Rep Power: 16
immortality is on a distinguished road
i need to do such work.i didn't grasp.what does this code do exactly? And where in code should it be added?(i use rhoPimpleFoam)
Thanks.
immortality is offline   Reply With Quote

Old   April 13, 2013, 20:05
Default
  #3
New Member
 
Giancarlo
Join Date: Apr 2013
Location: Milan
Posts: 18
Rep Power: 4
Giancarlo_IngChimico is on a distinguished road
This is my solver that I have developed. I need to know the value of internalField only of the cells located at interface. (named "fluid_to_solid")
Giancarlo_IngChimico is offline   Reply With Quote

Old   April 13, 2013, 20:28
Default
  #4
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Mol, Belgium
Posts: 295
Rep Power: 13
Lieven will become famous soon enough
Hi Giancarlo,

I hope this is what you were looking for. Once you have the right patchID you can use something like:
Code:
const fvPatchVectorField& Uw = U.boundaryField()[patchI];
forAll(Uw,faceI)
{
    // The value inside the cell
    const scalar& Up = Uw.patchInternalField()[faceI];
}
It's just from the heart, I haven't tested it so it might not compile immediately but this might give you a direction.

Cheers,

L
Lieven is offline   Reply With Quote

Old   April 14, 2013, 04:47
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,584
Rep Power: 24
ngj will become famous soon enoughngj will become famous soon enough
Good morning,

As an alternative, you can also work with the faceCells in case you have access to the whole of the volume field. This goes something along these lines, and assume that you have a fvPatch called "patch".

Code:
const polyPatch & pp = patch.patch();
const labelList & faceCells( pp.faceCells() );

forAll( faceCells, facei ) 
{
    // A bit of pseudo code
    myBoundaryField[facei] = someOperation<myVolumeField[faceCells[facei]]>;
}
This piece of code is particular interesting, if the volume field, which you need to access, is not the field on which the boundary condition is defined. E.g. accessing the velocity field in the boundary condition for pressure.

Kind regards

Niels
ngj is offline   Reply With Quote

Old   April 14, 2013, 06:10
Default
  #6
New Member
 
Giancarlo
Join Date: Apr 2013
Location: Milan
Posts: 18
Rep Power: 4
Giancarlo_IngChimico is on a distinguished road
Thanks all,
I have solved in this manner:

Code:
const fvPatchList& patches = fluidRegions[j].boundary();
    
    forAll(patches, patchI)
    {
        const fvPatch& cPatch = patches[patchI];
        if(cPatch.name() == "fluid_to_solid")
        forAll(cPatch, celli)
        {
        Tf[celli+1] = TFluid[j].internalField()[celli];
        }
    }
Kind regards

Giancarlo
Giancarlo_IngChimico is offline   Reply With Quote

Old   April 16, 2013, 12:29
Default
  #7
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 7
fredo490 is on a distinguished road
I use this kind of code, I don't know if it works for multi region mesh:

Code:
label patchWall = mesh.boundaryMesh().findPatchID("wall"); //patchID = id of the patch wall
const fvPatch& cPatch = mesh.boundary()[patchWall];

    forAll(cPatch, facei) //facei = id of the face
    {
}
You can maybe adapt it to include your region selection.
fredo490 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 09:34
error message cuteapathy CFX 14 March 20, 2012 07:45
Cyclic BC's: Possible face ordering problem? (Channel flow) sega OpenFOAM Native Meshers: blockMesh 3 September 28, 2010 12:46
chtMultiRegionFoam Tutorial m.nichols19 OpenFOAM 12 September 9, 2010 11:56


All times are GMT -4. The time now is 08:41.