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 postProcessing function objects in 2.2.0 (https://www.cfd-online.com/Forums/openfoam-post-processing/118267-pressuretools-postprocessing-function-objects-2-2-0-a.html)

immortality May 23, 2013 17:16

pressureTools postProcessing function objects in 2.2.0
 
here:
http://www.openfoam.org/version2.2.0...processing.php
its mentioned about pressureTools.how can use these function objects?
is there a tutorial or more guidance through?
new pressureTools - enables the calculation of pressure (from kinematic pressure), total pressure, pressure coefficient and total pressure coefficient.

wyldckat May 23, 2013 17:58

Hi Ehsan,

Quick answer:
  1. In the following page is a description of the base configurations for function objects: http://foam.sourceforge.net/docs/cpp/a00002.html
  2. In this page is the description on how to use the pressure tools: http://foam.sourceforge.net/docs/cpp...8.html#details
Best regards,
Bruno

immortality May 24, 2013 06:27

thank you Bruno
can use a
Code:

operation      areaAverage;
with it?
totally can use other features of function objects like the one below with it?
and is there a totalTemperature too or isn't?
Code:

Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            yes;
        valueOutput    false;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            //phi // surface fields not supported for sampledSurface
            U
            T
            rho
            h
            e
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }


wyldckat May 25, 2013 16:33

Hi Ehsan,

A bit of a confusion of ideas going on here... OK, so to sort out by items:
  • Total temperature? I can find anything like that. And temperature in OpenFOAM is usually in Kelvin, so there isn't anything more "total temperature" than the unit that stands for the absolute temperature measurement! :D
  • The function object "pressureTools" must come first in the list of function objects, if you want to use the resulting fields elsewhere.
  • The function object "pressureTools" creates volume fields, depending on the calculation. There isn't a direct description, but from the source code, it can create the following field names, depending on the options:
    Code:

    total(p)
    static(p)
    total(p)_coeff
    static(p)_coeff

    These names can be used in the field list for the average function object.
Best regards,
Bruno

immortality May 25, 2013 16:43

you mean I can simply add total(p) to the function as below?without adding anything other?
Code:

Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            yes;
        valueOutput    false;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            total(p)
            U
            T
            rho
            h
            e
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }


wyldckat May 25, 2013 16:51

:confused: Where's the "pressureTools" entry?

I have not tested this, this is just copy-paste-adapt from the pages I posted links for:
Code:

    myFunctionObject    // user-defined name of function object entry
    {
        type            pressureTools;
        libs            ("libutilityFunctionObjects.so");
        //region          defaultRegion;
        enabled        yes;
        //timeStart      0;
        //timeEnd        10;
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
        calcTotal  yes;
        calcCoeff  no;
    }

    Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            yes;
        valueOutput    false;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            total(p)
            U
            T
            rho
            h
            e
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }


immortality May 25, 2013 17:43

Ok.thanks.is it true now?
Code:

totalP    // user-defined name of function object entry
    {
        type            pressureTools;
        libs            ("libutilityFunctionObjects.so");
        //region          defaultRegion;
        enabled        yes;
        //timeStart      0;
        //timeEnd        10;
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
        calcTotal  yes;
        calcCoeff  no;
    }

//patch-left------------------------------------------------------------------
    flowInlet
    {
        type swakExpression;
        valueType patch;
        patchName left;
        expression "phi";
        accumulations (
            sum
        );
        verbose true;
    }

  Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            yes;
        valueOutput    false;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            //phi // surface fields not supported for sampledSurface
            U
            T
            rho
            h
            e
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }
      totalPressure_left
    {
        $Average_left;
        operation      weightedAverage;
        weighted rho;
        fields
        (
          total(p)
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }

what was the correct form of this part:
Code:

operation      weightedAverage;
        weighted rho;

because I have to use weightedAverage for totalPressure as the link you took me before in another thread.

wyldckat May 25, 2013 18:47

I think it's all OK. I can't see nothing wrong with it.

immortality May 25, 2013 19:04

hi Bruno
Really?i thought maybe those lines for weightedAverarage had another keywords as the case you sent to me before but i can't find now.please have a look into it again tomorrow.
Thanks.
Have a good night.

wyldckat May 25, 2013 19:12

Hi Ehsan,

:confused: Sorry, I don't understand the question. The function objects code seems to be OK. I don't see any problem with it.
The reference page on how to use "faceSource" is this one: http://foam.sourceforge.net/docs/cpp...5.html#details

Wait... :eek: now I see the problem! It should be:
Code:

operation weightedAverage;
weightField rho;

Best regards,
Bruno

immortality May 26, 2013 04:30

Hi
if I want to use function object on a face,how should change these terms?
Code:

source          patch;
        sourceName      left;

found it:
Code:

source          sampledSurface;
        //sourceName      baffleFaces;
        sampledSurfaceDict
        {
          type cuttingPlane;
          planeType pointAndNormal;
          pointAndNormalDict
          {
            basePoint      (0.0345 0.002 0);
            normalVector    (1 0 0);
          }
          interpolate true;
        }


immortality June 11, 2013 17:40

in compressible case I should use pRef 0;
correct?

immortality June 12, 2013 10:29

it writes total(p) values in all time steps in the solution folder but not in the patch I have set:
Code:

# Source : patch left
# Faces  : 60
# Time        sum(magSf)        weightedAverage(total(p))
1.123595506e-08        1.2e-05
2.375195563e-08        1.2e-05
3.694449677e-08        1.2e-05
5.013703791e-08        1.2e-05
6.332957905e-08        1.2e-05
7.652212019e-08        1.2e-05
8.971466133e-08        1.2e-05
1.029072025e-07        1.2e-05
1.160997436e-07        1.2e-05
1.292922847e-07        1.2e-05
1.424848259e-07        1.2e-05
1.55677367e-07        1.2e-05
1.688699082e-07        1.2e-05
1.820624493e-07        1.2e-05
1.952549904e-07        1.2e-05
2.084475316e-07        1.2e-05
2.216400727e-07        1.2e-05
2.348326139e-07        1.2e-05
2.48025155e-07        1.2e-05
2.612176961e-07        1.2e-05
2.744102373e-07        1.2e-05
2.876027784e-07        1.2e-05
3.007953196e-07        1.2e-05
3.110777413e-07        1.2e-05
3.210621219e-07        1.2e-05
3.304918147e-07        1.2e-05
3.395392226e-07        1.2e-05
3.482294959e-07        1.2e-05
3.565855281e-07        1.2e-05
3.64730015e-07        1.2e-05

its the totalP function:
Code:

totalP    // user-defined name of function object entry
    {
        type            pressureTools;
        libs            ("libutilityFunctionObjects.so");
        //region          defaultRegion;
        enabled        yes;
        //timeStart      0;
        //timeEnd        10;
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
        calcTotal  yes;
        calcCoeff  no;
        pRef 0;
    }

and I want on this patch:
Code:

totalPressure_left
      {
        $Average_left;
        operation      weightedAverage;
        weightField    rho;
        fields
        (
          total(p)
        );
      }

that its Average_left:
Code:

Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            yes;
        valueOutput    false;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            //phi // surface fields not supported for sampledSurface
            T
            rho
            h
            U
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }


wyldckat June 15, 2013 15:54

Hi Ehsan,

Took me a while to get to here, but here goes:
  1. You told me through an email that if you used swak4Foam, you only needed 1 function instead of 3.
  2. Guess what!? swak4Foam 0.2.4 is already available, at least through SVN and at my GitHub account https://github.com/wyldckat/swak4foam (look for the big ZIP button).
    (Side note: Bernhard was at the OFW8 these past days and I think he hasn't had the time to do the final announcements, but he has already provided these news over Twitter.
    ... edit: never mind, he's on top of things :): http://www.cfd-online.com/Forums/ope...tml#post433484 post #29)
  3. With this version of swak4Foam, which builds without problems with OpenFOAM 2.2.0, the following additional code for the function object should work as expected:
    Code:

    outputControlMode outputTime;
    outputInterval 1;



__________________


As for the original issue on the previous post, I'll quote what I've already sent you through emails - The following function objects worked well together:
Code:

functions
{
    writeMissingFields
    {
        type writeRegisteredObject;
        functionObjectLibs ( "libIOFunctionObjects.so" );
        objectNames ("phi");
        outputControl    outputTime;
    }
//................................................................................
    totalP    // user-defined name of function object entry
    {
        type            pressureTools;
        libs            ("libutilityFunctionObjects.so");
        //region          defaultRegion;
        enabled        yes;
        //timeStart      0;
        //timeEnd        10;
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
        calcTotal  yes;
        calcCoeff  no;
        pRef 0;
    }


    Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            yes;
        valueOutput    false;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            //phi // surface fields not supported for sampledSurface
            T
            rho
            h
            U
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }
      reloadTotalP
      {
          type        readFields;
          functionObjectLibs ("libfieldFunctionObjects.so");
          //region          defaultRegion;
          enabled        yes;
          //timeStart      0;
          //timeEnd        10;
          outputControl timeStep;//outputTime;//
          outputInterval 1; // 5000;
          fields
          (
              "total(p)"
          );
      }
      totalPressure_left
      {
        $Average_left;
        operation      weightedAverage;
        weightField    rho;
       
        fields
        (
          total(p)
        );
      }
}

Notes:
  • The function object "readFields" was needed for reloading back into memory the field "total(p)".
  • As for time folders that only have the field "total(p)": it's because of how the function object was created. It only calculates when it has to write the field to file and it is not registered into memory, which is why we have to use "readFields" for loading it back.
  • For this function object to always calculate the field and save it only occasionally, this would require to edit the original source code for the "pressureTools" function object.
Best regards,
Bruno

immortality June 16, 2013 10:36

dear Bruno
it wouldn't make any trouble to use it?because I'm in middle of the run and Bernhard has told maybe it will cause some inconsistency with before versions if I have understood correctly?

wyldckat June 16, 2013 11:09

Quote:

Originally Posted by immortality (Post 434280)
Bernhard has told maybe it will cause some inconsistency with before versions if I have understood correctly?

Are you talking about the following?
Quote:

Originally Posted by gschaider (Post 433484)
- functionObjects now store their data in the sub-directory postProcessing according to the new convention OpenFOAM has (sorry: this may break existing scripts relying on the old location)
- slight change in the format written may break the restart of cases where swak-specific restart data was written with older swak-version (should not hit many people)

Mmm... the first detail isn't very relevant... it's just a matter of moving the folders from the previously generated swak-like folders into the "postProcessing" folder, if I'm not mistaken.
The second detail is likely related to groovyBC!?

immortality June 16, 2013 11:22

thanks.I'm compiling i now.it will replaced to before version automatically?
and I have to move old folders to postProcessing folder manually and no other issue will take place?

wyldckat June 16, 2013 11:39

Quote:

Originally Posted by immortality (Post 434294)
thanks.I'm compiling i now.it will replaced to before version automatically?

Yes, I think so.

Quote:

Originally Posted by immortality (Post 434294)
and I have to move old folders to postProcessing folder manually and no other issue will take place?

Yes, move the ones in the case folder named "swak*". I haven't tested this yet myself, so I'm not 100% sure of this. But from what I briefly saw yesterday from the source code, I think it's all that is necessary.

BenJ July 31, 2014 03:25

Hi Ehsan and Bruno,

I found your post very interesting, since I'm trying to use the pressureTools to compute the static pressure from an incompressible case that uses kinematic pressure.

I would have used the utility as follows:

{
type pressureTools;
libs ("libutilityFunctionObjects.so");
enabled yes;
outputControl timeStep;//outputTime;//
calcTotal no;
calcCoeff no;
}

It does yield a static(p) field, but the values are very low (1e-16).

Have I done something wrong ?

Best regards
BenJ

GRAUPS August 15, 2014 14:49

Quote:

It does yield a static(p) field, but the values are very low (1e-16).
Ben,

I just figured this out not too long ago. You have to specify a rho value for pressure tools to use to convert from kinematic to static pressure. Add these two lines to your pressure tools functionObject...

rhoName rhoInf;
rhoInf 1.225; // density value

______________________________________

Gentlemen,

I have an additional question related to this pressure tools function object. Is there a way to calculate static pressure for every time step and not have it write out the iteration folder every time step? I want to be able to monitor a mass-weighted static pressure at an outlet every time-step (for an in-compressible solver). I can't find a way to do this though without forcing pressure tools to write an iteration folder every time step. Here is my current pressure-tools setup...

Code:

    p_tools
    {
        type                pressureTools;
        functionObjectLibs  ("libutilityFunctionObjects.so");       
        enabled            yes;       
        outputControl      timeStep;
        outputInterval      1;
        rhoName              rhoInf;
        rhoInf              831.1;
        calcTotal          no;
        calcCoeff          no;
    }

Thanks for any help you guys can provide!

Brock

wyldckat August 16, 2014 12:22

Greetings to all!

@Brock: That wasn't possible in OpenFOAM 2.2, but it is possible to do in OpenFOAM 2.3. The source code file in question is this:
Code:

$FOAM_SRC/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C
As of 2.3.0, at the end of each time step, it will execute the calculation of this requested pressure.

Best regards,
Bruno

BenJ August 20, 2014 08:57

Hi!

Thank you GRAUPS, it works perfectly now!

Now I hop this static pressure field can be used to change from simpleFoam to rhoSimpleFoam :)

Best regards
Benjamin

GRAUPS August 28, 2014 11:02

Quote:

Originally Posted by wyldckat (Post 506268)
As of 2.3.0, at the end of each time step, it will execute the calculation of this requested pressure.

@Bruno: Thanks for your comment. You are correct, OpenFOAM 2.3 now executes the calculation after every time-step.

Quote:

Originally Posted by BenJ (Post 506835)
Thank you GRAUPS, it works perfectly now!

@Ben: Glad I could help!

jrwrodgers September 22, 2014 17:22

pressureTools
 
Dear all,

I'm trying to get "pressureTools" function to work with simpleFoam but I get the error shown below. I've checked and the files were definitely compiled so should be available to call. Can anyone offer an insight?

Thanks,

James :D

Code:

--> FOAM FATAL ERROR:
Unknown function type pressureTools

Valid functions are :

17
(
cellSource
faceSource
fieldAverage
fieldCoordinateSystemTransform
fieldMinMax
fieldValueDelta
nearWallFields
patchProbes
probes
processorField
readFields
regionSizeDistribution
sets
streamLine
surfaceInterpolateFields
surfaces
wallBoundedStreamLine
)

My function call looks like this:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

 pressuretools1  // user-defined name of function object entry
    {
        type            pressureTools;
        libs ("libutilityFunctionObjects.so");
        //region          defaultRegion;
        enabled        yes;
        //timeStart      0;
        //timeEnd        10;
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
        calcTotal  yes;
        calcCoeff  yes;
    }


// ************************************************************************* //


jrwrodgers September 23, 2014 04:41

So.. I have had some success!

I need to change the library reference to:
functionObjectLibs ("libutilityFunctionObjects.so");

However, I then needed to specify:
pRef
pInf
rhoInf
UInf

And the result was total pressure coefficient (Cp0) being calculated but not static pressure coefficient (Cp)? Will the function only calculate one or the other or can you get it to calculate both?


The modes of operation are:
\table
Mode | calcTotal | calcCoeff
static pressure | no | no
total pressure | yes | no
pressure coefficient | no | yes
total pressure coefficient | yes | yes
\endtable

Any advice gratefully received!
Thanks

wyldckat April 6, 2015 13:48

Greetings James,

Sorry for the very late reply, but only today did I finally manage to take a look into this.
From what I can see from another post you've done, you've found a solution:
Quote:

Originally Posted by jrwrodgers (Post 513198)
I'm by no means an expert but when through a similar exercise a week ago. I found that to calculate the coefficients both static and total you need to specify the reference static pressure and reference velocity within the pressureTools {}. OF didn't pick up the values from the boundary conditions. I think I ended up specifying also the reference density although this is superfluous for the incompressible simulation I was running.

In addition to your finding, the answer to your previous post:
Quote:

Originally Posted by jrwrodgers (Post 511441)
And the result was total pressure coefficient (Cp0) being calculated but not static pressure coefficient (Cp)? Will the function only calculate one or the other or can you get it to calculate both?

... is that you would need to add two function object entries instead of just one, e.g.:
Code:

pressuretools1
{
//...
}

pressuretools2
{
//...
}

Only then will your be able to get the two types of results calculations.

Best regards,
Bruno

canopus December 17, 2015 07:12

Is it possible to write an areaAverage pressure along an axis as asked here using pressure tools?
Thanks

wyldckat March 28, 2016 16:15

Quote:

Originally Posted by canopus (Post 577903)
Is it possible to write an areaAverage pressure along an axis as asked here using pressure tools?

Quick (late) answer: "pressureTools" currently only calculates for the whole pressure field. You could then use one of the resulting fields to be averaged instead of the "p" field.

arieljeds April 8, 2016 09:23

Hi there,

Is it possible to use pressureTools as a sample instead of functionObject? I added this piece of code to my controlDict:

Code:

functions
  {
      pressureTools1
      {
                type        pressureTools;
                functionObjectLibs ("libutilityFunctionObjects.so");
                source                wall;
                sourceName        cylinder;
               
                log                yes;
               
                outputControl        timeStep;
                outputInterval        1;
               
                //enabled        yes;
                calcTotal        no;
                calcCoeff        yes;
                pRef                0;
                rhoInf                1.0;
                pInf                101325;
                UInf                (0.4208 0 0);               
      }
     

  }

Which did something really weird on running... data was written to more time steps and the velocity field was not saved except at the written time steps, so I couldn't properly postprocess anything (or view the simulation in paraview or paraFoam).

Two questions:
1) Can I set this up in my sampleDict instead?
2) I really just want to calculate the total pressure at probes on the cylinder to calculate the drag from that.... is this the best way to do it?

wyldckat April 10, 2016 14:09

Quick answers:
Quote:

Originally Posted by arieljeds (Post 594108)
Code:

outputControl    timeStep;
outputInterval    1;


Try changing to this:
Code:

outputControl    outputTime;
For more details:

Quote:

Originally Posted by arieljeds (Post 594108)
1) Can I set this up in my sampleDict instead?

After the function object has done its job, either while the solver was running or by running execFlowFunctionObjects, these pressure fields will have been written to the time folder(s).
Then you can use sample to sample over the data in the written fields.

Quote:

Originally Posted by arieljeds (Post 594108)
2) I really just want to calculate the total pressure at probes on the cylinder to calculate the drag from that.... is this the best way to do it?

Another alternative I can think of is the tutorial "incompressible/simpleFoam/motorBike/", which in file "system/forceCoeffs" has an example of a function object for calculating the Cd and Cl, if I remember correctly. This file is included by the file "system/controlDict", which is why it will be executed while the solver is running.

arieljeds April 11, 2016 06:30

Hi wyldckat,

Thank you for your very thorough response... I have two follow up questions/issues now:

1) I am trying to run execFlowFunctionObjects, which is giving the error that the keyword transport properties is undefined..However, here is my transportProperties file:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

phases (water air);

water
{
    transportModel  Newtonian;
    nu              nu [ 0 2 -1 0 0 0 0 ] 0.0631;        // Re = 40
    rho            rho [ 1 -3 0 0 0 0 0 ] 1028;
   
    CrossPowerLawCoeffs
    {
        nu0            nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
        nuInf          nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
        m              m [ 0 0 1 0 0 0 0 ] 1;
        n              n [ 0 0 0 0 0 0 0 ] 0;
    }

    BirdCarreauCoeffs
    {
        nu0            nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515;
        nuInf          nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
        k              k [ 0 0 1 0 0 0 0 ] 99.6;
        n              n [ 0 0 0 0 0 0 0 ] 0.1003;
    }
   
}

air
{
    transportModel  Newtonian;
    nu              nu [ 0 2 -1 0 0 0 0 ] 1.568e-05; //1.48e-05;  --> current measurement for kinematic viscosity found at engineeringtoolbox.com
    rho            rho [ 1 -3 0 0 0 0 0 ] 1;
   
    CrossPowerLawCoeffs
    {
        nu0            nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
        nuInf          nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
        m              m [ 0 0 1 0 0 0 0 ] 1;
        n              n [ 0 0 0 0 0 0 0 ] 0;
    }

    BirdCarreauCoeffs
    {
        nu0            nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515;
        nuInf          nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
        k              k [ 0 0 1 0 0 0 0 ] 99.6;
        n              n [ 0 0 0 0 0 0 0 ] 0.1003;
    }
   
}

sigma          sigma [ 1 0 -2 0 0 0 0 ] 0.07;


// ************************************************************************* //

In this, because the transportModel is Newtonian, I have assumed that the CrossPowerLaw and BirdCarreau stuff is ignored. Is this correct?

2) I am trying to really understand what the pressure I am getting is because I was having issues implementing the calculating for dragForce, and so I want to calculate it from the pressures instead so I can better understand it. In waveFoam, I am calculating two pressures: p_rgh and p. I am understanding that p_rgh is a reference pressure that is calculated and p would then be p = p_rgh + rho*g*h, which would mean then that the total pressure, and then pressures used in the calculation for pressure coefficient, Cp, would be: p + 0.5*rho*Uinf^2 (where I've been taking Uinf from a probe near the inlet). I'll say now that doing it this way has not been yielding results for the Cp that I'm expecting (as in, the value that I'm calculating for Cp is far too high). Is there something I am misunderstanding about the pressures?

Thanks again for your help,
Ariel

amdk136 November 30, 2018 04:46

1 Attachment(s)
Quote:

Originally Posted by wyldckat (Post 434184)
Hi Ehsan,

Took me a while to get to here, but here goes:
  1. You told me through an email that if you used swak4Foam, you only needed 1 function instead of 3.
  2. Guess what!? swak4Foam 0.2.4 is already available, at least through SVN and at my GitHub account https://github.com/wyldckat/swak4foam (look for the big ZIP button).
    (Side note: Bernhard was at the OFW8 these past days and I think he hasn't had the time to do the final announcements, but he has already provided these news over Twitter.
    ... edit: never mind, he's on top of things :): http://www.cfd-online.com/Forums/ope...tml#post433484 post #29)
  3. With this version of swak4Foam, which builds without problems with OpenFOAM 2.2.0, the following additional code for the function object should work as expected:
    Code:

    outputControlMode outputTime;
    outputInterval 1;



__________________


As for the original issue on the previous post, I'll quote what I've already sent you through emails - The following function objects worked well together:
Code:

functions
{
    writeMissingFields
    {
        type writeRegisteredObject;
        functionObjectLibs ( "libIOFunctionObjects.so" );
        objectNames ("phi");
        outputControl    outputTime;
    }
//................................................................................
    totalP    // user-defined name of function object entry
    {
        type            pressureTools;
        libs            ("libutilityFunctionObjects.so");
        //region          defaultRegion;
        enabled        yes;
        //timeStart      0;
        //timeEnd        10;
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
        calcTotal  yes;
        calcCoeff  no;
        pRef 0;
    }


    Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            yes;
        valueOutput    false;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            //phi // surface fields not supported for sampledSurface
            T
            rho
            h
            U
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }
      reloadTotalP
      {
          type        readFields;
          functionObjectLibs ("libfieldFunctionObjects.so");
          //region          defaultRegion;
          enabled        yes;
          //timeStart      0;
          //timeEnd        10;
          outputControl timeStep;//outputTime;//
          outputInterval 1; // 5000;
          fields
          (
              "total(p)"
          );
      }
      totalPressure_left
      {
        $Average_left;
        operation      weightedAverage;
        weightField    rho;
       
        fields
        (
          total(p)
        );
      }
}

Notes:
  • The function object "readFields" was needed for reloading back into memory the field "total(p)".
  • As for time folders that only have the field "total(p)": it's because of how the function object was created. It only calculates when it has to write the field to file and it is not registered into memory, which is why we have to use "readFields" for loading it back.
  • For this function object to always calculate the field and save it only occasionally, this would require to edit the original source code for the "pressureTools" function object.
Best regards,
Bruno


Hi,



Can anyone help with the running of this code through chtMultiRegionFoam? (I am using OpenFOAM 6)



I have copied the above into my controlDict folder and I have tried running the following:


chtMultiRegionFoam -postProcess -func writeMissingFields

chtMultiRegionFoam -postProcess -func totalP
chtMultiRegionFoam -postProcess -func Average_left
chtMultiRegionFoam -postProcess -func reloadTotalP

chtMultiRegionFoam -postProcess -func totalPressure_left

in that order.

-I've also tried it without the inclusion of chtMultiRegionFoam in the above order.
-I've also tried running each part seperately as well, but it still doesn't work - I don't get a postProcessing folder, or any sort of results.

I have changed the patch name to the one I require - cyclicFluidInlet. I am completely at a loss, if anyone could help then I would be very greatful.


I have included my controlDict as well (I had to zip it to upload), any other information can be supplied.


Thanks,
Arthur

wyldckat December 22, 2018 11:06

Quick answer: I see that you later on have gotten an answer to your question here: https://www.cfd-online.com/Forums/op...egionfoam.html

Essentially there were two issues:
  1. "-region regionName" was a missing argument in the command, where "regionName" is the name of the region you wanted to process.
  2. "-func" is not meant to be used with each individual entry inside the controlDict. You could execute without the "-func name" and it would run all of those function objects that were indicated in the controlDict.

amdk136 December 22, 2018 11:15

Quote:

Originally Posted by wyldckat (Post 719910)
Quick answer: I see that you later on have gotten an answer to your question here: https://www.cfd-online.com/Forums/op...egionfoam.html

Essentially there were two issues:
  1. "-region regionName" was a missing argument in the command, where "regionName" is the name of the region you wanted to process.
  2. "-func" is not meant to be used with each individual entry inside the controlDict. You could execute without the "-func name" and it would run all of those function objects that were indicated in the controlDict.

Yeah, it was a general mix up of about 4 different solutions combined which wasn't the best way to go about it. I ended up taking the function object out of the control dict and just made a script to run post processing with the required functions (- func <function>) within that instead which worked a treat!


All times are GMT -4. The time now is 17:29.