CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Measuring total pressure with simpleFunctionObjects (http://www.cfd-online.com/Forums/openfoam/72797-measuring-total-pressure-simplefunctionobjects.html)

CedricVH February 18, 2010 06:40

Measuring total pressure with simpleFunctionObjects
 
I want to monitor the mass flow rate and the total pressure every iteration at the outlet of my geometry. A good way to do this is using the simpleFunctionObjects (http://openfoamwiki.net/index.php/Co...unctionObjects).

Using simpleFoam, I am able to calculate the mass flow rate, but not the total pressure. My code in the controlDict file is given as:

Code:

functions
(
  massFlow
  {
    type patchMassFlow;
    functionObjectLibs
      (
        "libsimpleFunctionObjects.so"
      );
    verbose true;
    patches
      (
        outlet
      );
  }

  totPress
  {
    type patchAverage;
    functionObjectLibs
      (
        "libsimpleFunctionObjects.so"
      );
    verbose true;
    fields
      (
        ptot
      );
    patches
      (
        outlet
      );
  }
);

The mass flow is reported correctly, but the parameter ptot can not be used, because it has not been calculated by OpenFOAM.

In post-processing, I would first calculate the total pressure with the command "ptot" and then averaging it with the command "patchAverage ptot outlet"

Does anybody know how to implement this using simpleFunctionObjects?

CedricVH February 18, 2010 15:56

Solved: I have modified the simpleFoam solver so that it calculates ptot every iteration.

farbfilm February 19, 2010 03:11

Hi Cedric,

could you please explain me how you modified the solver that it calculates ptot every iteration???

CedricVH February 19, 2010 04:20

I've copied simpleFoam to another directory and renamed all files (mysimpleFoam)

In createFields.H, I changed this:

Code:

    Info << "Reading field U\n" << endl;
    volVectorField U
    (
        IOobject
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

// BEGIN ADD CODE
    Info<< "Reading field ptot\n" <<endl;
    volScalarField ptot
    (
        IOobject
        (
            "ptot",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE         
      ),
      p + 0.5*magSqr(U)
    );
// END ADD CODE

#  include "createPhi.H"

In mysimpleFoam.C, I've added this:

Code:

        {
            #include "UEqn.H"
            #include "pEqn.H"
        }

        turbulence->correct();
// BEGIN ADD CODE
        ptot = p + 0.5*magSqr(U);
// END ADD CODE

        runTime.write();

Take care! This formula of ptot is ONLY valid for incompressible cases. I don't know is this is a good way as I have never programmed for OpenFoam, but hey, it works!

RalphS October 12, 2010 10:07

Does anybody know how I can modified the rhoSimpleFoam solver so that it calculates ptot every iteration?

claco February 1, 2011 06:03

Quote:

Originally Posted by RalphS (Post 278820)
Does anybody know how I can modified the rhoSimpleFoam solver so that it calculates ptot every iteration?

Dear RalphS,

Have You heard any more about total pressure calculation in rhoSimpleFoam solver?

Best regards.

Claudio

RalphS February 1, 2011 10:43

Quote:

Originally Posted by claco (Post 293067)
Dear RalphS,

Have You heard any more about total pressure calculation in rhoSimpleFoam solver?

Best regards.

Claudio


Hello Claudio,


I have written a tool, which is able to calculate total pressure.
But i haven't integrated it into the solver. You can use it for post processing.
Are you interesting in this tool? I can also integrate it (after writing some tools and other stuff, i am able to programming on my own) into the solver, but then I need some time.


Regards

Ralph

claco February 1, 2011 11:37

Quote:

Originally Posted by RalphS (Post 293095)
Hello Claudio,


I have written a tool, which is able to calculate total pressure.
But i haven't integrated it into the solver. You can use it for post processing.
Are you interesting in this tool? I can also integrate it (after writing some tools and other stuff, i am able to programming on my own) into the solver, but then I need some time.


Regards

Ralph

Dear Ralph,

can I kindly have this tool in order to integrate it into the solver (by myself)?
Thank You in advance.

Best,

Claudio

RalphS February 1, 2011 11:59

1 Attachment(s)
Dear Claudio,

no problem, here is the tool.

my_ptot.C attach

folder Make:

options:

EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools



files:

my_ptot.C

EXE = $(FOAM_USER_APPBIN)/my_ptot

claco February 1, 2011 12:45

Quote:

Originally Posted by RalphS (Post 293106)
Dear Claudio,

no problem, here is the tool.

my_ptot.C attach

folder Make:

options:

EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools



files:

my_ptot.C

EXE = $(FOAM_USER_APPBIN)/my_ptot

Thank You very much Ralph.
Claudio


All times are GMT -4. The time now is 02:53.