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

Internal faces for monitoring

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

Like Tree11Likes
  • 1 Post By jason.ryon
  • 3 Post By wyldckat
  • 3 Post By Iose
  • 2 Post By wyldckat
  • 2 Post By artymk4

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2010, 17:40
Default Internal faces for monitoring
  #1
New Member
 
Jason Ryon
Join Date: Oct 2009
Posts: 17
Rep Power: 16
jason.ryon is on a distinguished road
I would like to know how to monitor at an internal face (faceZone or faceSet). I want to know p, U, etc... for every point in the faceZone, as well as the mass flow through the entire face.

This is what I have tried so far, but can't seem to get things to work:
1. Import mesh (with "interior" surfaces) from Fluent using:
>fluentMeshToFoam mesh.msh -writeSets -writeZones
2. I see the name (interior_001) in faceZones of the faceZone that I want to monitor
3. Now, I have tried using the "surfaces" functionObject which works for slice planes or patches, but is it possible to use this to output a faceZone or faceSet?
4. I also tried even using the libfieldFunctionObjects.so but this seems to only work on a faceZone that is a patch and not an internal one.
5. Also, I have used libsimplefunctionobjects to work very well for mass flow at patches (i.e. pressure_inlet) but I don't know if this works for internal faceZones too.
http://openfoamwiki.net/index.php/Co...unctionObjects

I am sorry if this has been posted before, I searched through the Forum but keep hitting dead-ends.

Thanks,
Jason
misospider likes this.
jason.ryon is offline   Reply With Quote

Old   April 24, 2010, 08:48
Default
  #2
Member
 
Johan Spång
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 35
Rep Power: 17
josp is on a distinguished road
(Assuming OpenFOAM-1.6.x) insert this into your controlDict and update according to your case:

Code:
functions
(
//=========================================================//
Meas-outlet  // Name also used to identify output folder
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   timeStep;
        outputInterval  1;
        log             true;
        valueOutput     false;
        source          faceZone;  // Type of face source: faceZone, patch
        sourceName      meas-outlet;
        operation       sum;
        fields
        (
            phi
        );
    }
This should integrate massflow (or volume flow for incompressible flow). I'm unsure about the other scalars as they are not defined at the faces so they have to be interpolated..

OpenFOAM-1.6.x/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H:

- if the field is a volField the faceZone can only consist of boundary faces.

You could write something yourself like:
Code:
surfaceScalarField test = fvc::interpolate(field);
label q = mesh.faceZones().findZoneID(surfaceName);
const labelList& faces = mesh.faceZones()[q];

forAll(faces, j)
{
label facei = faces[j];
result+= test[facei]
...
}
Or check if surfaceInterpolateFieldsFunctionObjects can help you.

Last edited by josp; April 24, 2010 at 10:05.
josp is offline   Reply With Quote

Old   April 26, 2010, 17:56
Default
  #3
New Member
 
Jason Ryon
Join Date: Oct 2009
Posts: 17
Rep Power: 16
jason.ryon is on a distinguished road
josp,

Thanks for your response. I think this sum(phi) is close to what I am looking for, but not quite right. I am wondering though if this is "mass flow" or "mass flow rate"? I am looking for "mass flow rate".

I tried the sum(phi) at an inlet patch, and it is giving me results that are not the same as "mass flow rate" from Fluent or from the libsimpleFunctionObjects mass-flux calculations (both of which match up reasonably well to each other):

Thanks again for your help,
Jason
jason.ryon is offline   Reply With Quote

Old   April 27, 2010, 06:31
Default
  #4
Member
 
Cedric Van Holsbeke
Join Date: Dec 2009
Location: Belgium
Posts: 81
Rep Power: 16
CedricVH is on a distinguished road
sum(phi) is the mass flow rate trough the patch. However, in incompressible solvers, phi has the dimension m^3/s and not kg/s. You will have to multiply this value with rho to have the same results as Fluent.
CedricVH is offline   Reply With Quote

Old   June 20, 2010, 16:21
Default surfaceScalarField
  #5
New Member
 
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17
ubaid is on a distinguished road
Hello everybody,

I am new to openfoam but have a similar question. I am wondering what I will get as an output if i have the following case.

surfaceScalarField abc

Info<<"Whats this"<<abc[100];

will it give me output of abc at the face number 100?

If I have faceSets, and get the facenumbers out of these facesets, could i get the value of abc at the putting the face number inside the brackets as following
Info<<"value at the required facenumber"<<abs[facenumber];

Thanks in advance.
ubaid is offline   Reply With Quote

Old   May 10, 2012, 09:35
Default
  #6
New Member
 
Michal
Join Date: Apr 2012
Location: Czech Republic
Posts: 27
Rep Power: 13
majkl is on a distinguished road
Quote:
Originally Posted by josp View Post
surfaceScalarField test = fvc::interpolate(field);
label q = mesh.faceZones().findZoneID(surfaceName);
const labelList& faces = mesh.faceZones()[q];

forAll(faces, j)
{
label facei = faces[j];
result+= test[facei]
...
}
[/CODE]Or check if surfaceInterpolateFieldsFunctionObjects can help you.
Well, it must be implemented in faceSource.H file? Thank you for your response. Majkl
majkl is offline   Reply With Quote

Old   October 11, 2018, 08:52
Default
  #7
New Member
 
Josef Dobeš
Join Date: Mar 2012
Location: Czech republic
Posts: 12
Rep Power: 14
Iose is on a distinguished road
Hi guys,
could you provide me some more information if you had/have succesfully implemented monitoring pressure on faceZones. I used OpenFOAM v6 and I am able to online monitoring phi as flux on the internal faces - faceZones, but if I want to monitoring pressure it doesn't work. Any help would be appreciated.

Thanks.
Iose is offline   Reply With Quote

Old   October 13, 2018, 07:13
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: You will have to create a baffle from that faceZone and apply cyclic boundary conditions to it. Search for "createBafflesDict" in the "tutorials" folder... I don't remember which tutorial has it...
jherb, artymk4 and superkelle like this.
__________________
wyldckat is offline   Reply With Quote

Old   October 15, 2018, 04:14
Default
  #9
New Member
 
Josef Dobeš
Join Date: Mar 2012
Location: Czech republic
Posts: 12
Rep Power: 14
Iose is on a distinguished road
Hi wyldckat,
you have a briliant idea. It works. My createBaffleDict looks:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      createBafflesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Whether to convert internal faces only (so leave boundary faces intact).
// This is only relevant if your face selection type can pick up boundary
// faces.
internalFacesOnly true;

fields true;

// Baffles to create.
baffles
{
    I0_B
    {
        //- Use predefined faceZone to select faces and orientation.
        type        faceZone;
        zoneName    I0;

        patchPairs
        {
            type            cyclic;
        }
    }
    
    I3_B
    {
        //- Use predefined faceZone to select faces and orientation.
        type        faceZone;
        zoneName    I3;

        patchPairs
        {
            type            cyclic;     
        }
    }
}


// ************************************************************************* //
And my output looks like this:
Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : dev-8f3f2f7365c1
Exec   : createBaffles -overwrite
Date   : Oct 15 2018
Time   : 08:37:25
Host   : "dobesj-Precision-T5600"
PID    : 26264
I/O    : uncollated
Case   : /media/dobesj/Data_disc/Re_CS_OF
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading baffle criteria from createBafflesDict

Not converting faces on non-coupled patches.

Reading geometric fields

Reading volScalarField p
Reading volScalarField nut
Reading volScalarField k
Reading volScalarField epsilon
Reading volScalarField omega
Reading volVectorField U
Created zone I0_B at index 24 with 610 faces
Created zone I3_B at index 25 with 610 faces
Converted 1220 faces into boundary faces in patches 
4
(
I0_B_master
I0_B_slave
I3_B_master
I3_B_slave
)


--> FOAM Warning : 
    From function int main(int, char**)
    in file createBaffles.C at line 854
    Setting field on boundary faces to zero.
You might have to edit these fields.
Writing mesh to 0
End
Maybe one little question about FOAM Warning - the error tells me that I don't setup boundary condition for cyclic, am I right?

Thanks.

----

Hi wyldckat,
thank you for your briliant idea, it works. In my log file, during create baffles I received that warning:

Code:
--> FOAM Warning : 
    From function int main(int, char**)
    in file createBaffles.C at line 854
    Setting field on boundary faces to zero.
You might have to edit these fields.
This is only about information that I don't setup boundary condition for cyclic face zones, am I right?
jherb, mechy and artymk4 like this.

Last edited by wyldckat; October 20, 2018 at 17:04. Reason: merged posts a few minutes apart
Iose is offline   Reply With Quote

Old   October 20, 2018, 17:12
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: There is a quick way you can automatically apply boundary conditions to types of boundaries... This line:
Code:
#includeEtc "caseDicts/setConstraintTypes"
when added to the start of the block "boundaryField", can be used for automatically assigning boundary conditions, based on geometric boundary type... here is a thread on this topic: #includeEtc "caseDicts/setConstraintTypes"

The tutorial case "heatTransfer/buoyantSimpleFoam/circuitBoardCooling" is also a good example on how to both use this and define the new boundary conditions via "system/createBafflesDict".
mechy and the_ichthyologist like this.
wyldckat is offline   Reply With Quote

Old   April 18, 2019, 10:11
Default
  #11
Member
 
Martin
Join Date: Aug 2018
Posts: 33
Rep Power: 7
artymk4 is on a distinguished road
I had the same problem. Now I solved it with help from Ione and wyldckat so I'm sharing my code if it helps anyone.
I wanted to output average pressure on internal face "CKOUT" which was defined as faceZone. First I tried with function type surfaceFieldValue but I got error "Unable to process internal faces for volume field p"
Then I made file createBafflesDict similar to Iose's and ran command createBaffles
Two new patches were created, CKOUT_master and CKOUT_slave. Files U, p, k etc. in 0/ folder needs to have these two patches included this way:
Code:
    CKOUT_master
    {
        type            cyclic;
    }
    CKOUT_slave
    {
        type            cyclic;
    }
Now you can add function to your controlDict file that will output pressure on internal face. My function looks like this*:
Code:
functions
{
    p_CKOUT
    {
        type patchAverage;
        fields (p);
        functionObjectLibs ("libsimpleFunctionObjects.so");
        patches
        (
             CK_OUTmaster
        );
        allowCoupled true;
        writeStartTime no;
        outputControlMode outputTime;
//        outputControlMode timeStep;
//        outputInterval 10;
    }
}
* As far as I know, you need swak4foam installed if you want this function to work.


Alternative option, if you don't have swak4foam, is that you put this to controlDict:
Code:
functions
{
    #includeFunc patchAverage(name=CKOUT_master,p)
}
But this way you cannot control how often is the average pressure calculated and saved. It is calculated every time step so this might slow down your simulation a little bit.
aow and zhouqy1994 like this.
artymk4 is offline   Reply With Quote

Old   October 13, 2021, 16:39
Default faceZoneAverage OpenFOAM V8 and V9
  #12
New Member
 
Join Date: Aug 2021
Posts: 11
Rep Power: 4
Daniel_C is on a distinguished road
Since OF V8 it should be possible to have the field values processed for a given faceZone.

If I add a function file in system in this way e.g. :

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
-------------------------------------------------------------------------------
Description
    Calculates the average values of fields on a faceZone.

\*---------------------------------------------------------------------------*/

        type            surfaceFieldValue;
        libs            ("libfieldFunctionObjects.so");
        writeControl    timeStep;
        writeInterval   1;
        log             yes;
        writeTotalArea  no;
        writeFields     no;
        regionType      faceZone;
        name            my_facezone;
        operation       areaAverage;
	fields  
	(
	    U
	);

// ************************************************************************* //
And after include the function in controlDict via #includeFunc my_function, it throws an exception in the terminal at runtime:

Quote:
surfaceFieldValue my_function: faceZone(my_facezone):
Unable to process internal faces for volume field U
The same is true for other scalars e.g. p. Except for phi. Seems there is something I'd missed. Can anyone give me a hint, what I am doing wrong?

Regards

Daniel
Daniel_C is offline   Reply With Quote

Old   June 4, 2023, 15:20
Default
  #13
New Member
 
Join Date: Aug 2019
Posts: 3
Rep Power: 6
Behradskn is on a distinguished road
Since type is surfaceFieldValue, so you only can read the face values like phi, but you can't read a volume field like U.
Behradskn is offline   Reply With Quote

Reply

Tags
internal monitoring

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 20:43
How to store the variable on internal faces to calculate UDS_FLUX? bigfans FLUENT 0 October 28, 2009 15:22
Problem in IMPORT of ICEM input file in FLUENT csvirume FLUENT 2 September 9, 2009 02:08
Unaligned accesses on IA64 andre OpenFOAM 5 June 23, 2008 11:37


All times are GMT -4. The time now is 05:06.