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

Indentify internal field value at specific patch

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 2 Post By Giancarlo_IngChimico
  • 1 Post By immortality
  • 1 Post By Giancarlo_IngChimico
  • 1 Post By Lieven
  • 1 Post By ngj
  • 2 Post By Giancarlo_IngChimico
  • 1 Post By fredo490

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 11, 2013, 18:18
Post Indentify internal field value at specific patch
  #1
New Member
 
Giancarlo
Join Date: Apr 2013
Location: Milan
Posts: 21
Rep Power: 13
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 and Zhiheng Wang like this.
Giancarlo_IngChimico is offline   Reply With Quote

Old   April 13, 2013, 14:54
Default
  #2
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
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.
Zhiheng Wang likes this.
immortality is offline   Reply With Quote

Old   April 13, 2013, 21:05
Default
  #3
New Member
 
Giancarlo
Join Date: Apr 2013
Location: Milan
Posts: 21
Rep Power: 13
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")
Zhiheng Wang likes this.
Giancarlo_IngChimico is offline   Reply With Quote

Old   April 13, 2013, 21:28
Default
  #4
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22
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
Zhiheng Wang likes this.
Lieven is offline   Reply With Quote

Old   April 14, 2013, 05:47
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
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
Zhiheng Wang likes this.
ngj is offline   Reply With Quote

Old   April 14, 2013, 07:10
Default
  #6
New Member
 
Giancarlo
Join Date: Apr 2013
Location: Milan
Posts: 21
Rep Power: 13
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
Zhiheng Wang and ruloz like this.
Giancarlo_IngChimico is offline   Reply With Quote

Old   April 16, 2013, 13:29
Default
  #7
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
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.
Zhiheng Wang likes this.
fredo490 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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34
error message cuteapathy CFX 14 March 20, 2012 07:45
[blockMesh] Cyclic BC's: Possible face ordering problem? (Channel flow) sega OpenFOAM Meshing & Mesh Conversion 3 September 28, 2010 13:46
chtMultiRegionFoam Tutorial m.nichols19 OpenFOAM 12 September 9, 2010 12:56


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