CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Pressuretools: pressureDifferencePatch (https://www.cfd-online.com/Forums/openfoam-post-processing/180694-pressuretools-pressuredifferencepatch.html)

verboomj November 28, 2016 08:48

Pressuretools: pressureDifferencePatch
 
I'm want to use this tool to calculate the pressure difference between the inlet and outlet, as I'm optimizing with respect to minimum pressure loss.

Code:

postProcess -func "pressureDifferencePatch(...)"
I've tried different ways to define my patches (name=outlet,name=inlet) or (outlet, inlet). But none seem to work, and give me the following error:

Code:

--> FOAM Warning :
    From function bool Foam::functionObjectList::read()
    in file db/functionObjects/functionObjectList/functionObjectList.C at line 644
    Caught FatalError
--> FOAM FATAL ERROR:
surfaceRegion pressureDifferencePatch(inletoutlet).region1: patch(<patch1>):
    Unknown patch name: <patch1>. Valid patch names are:
4
(
inlet
outlet
fixedWalls
frontAndBack
)

The pressureDifferencePach file looks like:

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      pressureDifferencePatch;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

pressureDifferencePatch
{
    patch1 <patch1>;
    patch2 <patch2>;

    #includeEtc "caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg"
}



I got the flow rate command working for a single patch as given in the user guide:

Code:

postProcess -func "flowRatePatch(name=outlet)"
Thanks.

dyle February 17, 2017 07:17

Hi, Jeroen,
Check out the file pressureDifferencePatch at $FOAM_ETC\caseDicts\postProcessing\pressure. Names of Two patches , in your case outlet and inlet, could be defined in it.
Then you can use postPrcoess by including it in controlDict file. Now it would work.:)

Diro7 February 18, 2017 11:44

Quote:

Originally Posted by dyle (Post 637519)
Hi, Jeroen,
Check out the file pressureDifferencePatch at $FOAM_ETC\caseDicts\postProcessing\pressure. Names of Two patches , in your case outlet and inlet, could be defined in it.
Then you can use postPrcoess by including it in controlDict file. Now it would work.:)

Hi Dyle,

I'm trying too to use pressureDifferencePatch but I didn't understand what you suggested.
I tried to use the dictionary in the ect/... folder by copying and modifying it in the case directory and then using the -dict attribute while calling postProcess in the command line, but it is not working.

How did you make it work?

Thanks

dyle February 18, 2017 19:07

Hi Andrea,

I didn't use the -dict attribute. Instead, I add
functions
{
#includeFunc pressureDifferencePatch
}
to controlDict, and then call postProcess directly.


Best,
Dyle

minzhang March 1, 2017 15:18

Hello Jeroen,

Have you fixed your problem with pressureDifferencePatch function?

sepp.zell January 10, 2018 05:22

Hi together,

I try to give a solution that works for me:
Add in your system directory of your case a file pressureDifferencePatch as suggested in the first post and replace <patch1> and <patch2> by the names of your patches.

Then in the command line one can call the command
Code:

postProcess -fields '(p)' -func pressureDifferencePatch
At least for me this works. Maybe you can report, if this also works for you.

Regards
Sebastian

Robin.Kamenicky April 9, 2018 07:19

Hi Sebastian,

this approach works also for me.

Thank you,
Regards,
Robin

dickcruz April 10, 2018 02:03

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      pressureDifferencePatch;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

pressureDifferencePatch
{
    patch1 <patch1>;
    patch2 <patch2>;

    #includeEtc "caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg"
}

I think that this right here was the problem, that you're supposed to replace the square brackets with your actual patch names. It works fine for me when this is done. As dyle mentioned, you just need to ensure that you have the #include directive in the controlDict for the case.

randolph March 27, 2020 14:07

pressureDifferencePatch is nothing but a wrapper over fieldValueDelta.

For more controls. Just use

Code:

        pressureDifferencePatch1
        {
                type            fieldValueDelta;
                libs            ("libfieldFunctionObjects.so");
                operation      subtract;
                writeControl    timeStep;
                writeInterval  1;
                log            true;

                region1
                {
                    #includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
                    operation      areaAverage;
                    fields          (p);
                        regionType  patch;
                    name        inlet;
                }
                region2
                {
                    #includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
                    operation      areaAverage;
                    fields          (p);
                        regionType  patch;
                    name        outlet;
                }
        }


Himanshu_Shrivastava June 8, 2020 13:56

Quote:

Originally Posted by randolph (Post 763267)
pressureDifferencePatch is nothing but a wrapper over fieldValueDelta.

For more controls. Just use

Code:

        pressureDifferencePatch1
        {
                type            fieldValueDelta;
                libs            ("libfieldFunctionObjects.so");
                operation      subtract;
                writeControl    timeStep;
                writeInterval  1;
                log            true;

                region1
                {
                    #includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
                    operation      areaAverage;
                    fields          (p);
                        regionType  patch;
                    name        inlet;
                }
                region2
                {
                    #includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
                    operation      areaAverage;
                    fields          (p);
                        regionType  patch;
                    name        outlet;
                }
        }


Old post but i hope to get a reply....
I have internal "faceZone" (using writeZone) and I wanted to calculate total pressure on this facezone. But, as we know pressure value is stored on cell center.
if we use faceSource will it interpolate the value or we have some other way to calculate total pressure.
and p will give static pressure so for total pressure do we use " fields (total(p))"?


All times are GMT -4. The time now is 22:10.