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/)
-   -   air flux through a boundary with air-water mixture (https://www.cfd-online.com/Forums/openfoam-post-processing/120489-air-flux-through-boundary-air-water-mixture.html)

Hale July 8, 2013 09:12

air flux through a boundary with air-water mixture
 
Hi,

I have calculated the total flux through boundaries of my model but I further need to calculate the fraction of air flux through the boundaries with air-water mixture. Is there any way to find the air fraction?

Thanks a lot
Hale

cutter July 8, 2013 09:19

Hi,

which solver do you use and how is you processing done (calculation within solver or via function objects)? You probably need to account for the alpha/alpha1 values.

Cutter

Hale July 8, 2013 09:30

Quote:

Originally Posted by cutter (Post 438453)
Hi,

which solver do you use and how is you processing done (calculation within solver or via function objects)? You probably need to account for the alpha/alpha1 values.

Cutter

Thanks for your reply.

I'm using InterFoam and the calculation is done via a function object (calcMassFlow that uses the phi file to calculate the fluxes through boundaries; http://www.cfd-online.com/Forums/ope...-boundary.html)

You are definitely right. I have to multiply the total mass flux (at each boundary and time step) with the corresponding alpha1 values but is it possible to do it after the calculation is performed? How can I distinguish the alpha1 values for different boundaries?

cutter July 8, 2013 09:44

This should be possible by using the faceSource function object:

Code:

    myFuncObj
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        outputControl  timeStep;
        log            true;
        // Output field values as well
        valueOutput    false;
        source          patch;
        sourceName      outlet; // replace patch name!!!
        operation      sum;

        fields
        (
            rho*phi*alpha // maybe fix eqn. for your purpose!!!
        );
    }

Feedback welcome!

Cutter

Hale July 8, 2013 09:54

Quote:

Originally Posted by cutter (Post 438459)
This should be possible by using the faceSource function object:

Code:

    myFuncObj
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        outputControl  timeStep;
        log            true;
        // Output field values as well
        valueOutput    false;
        source          patch;
        sourceName      outlet; // replace patch name!!!
        operation      sum;

        fields
        (
            rho*phi*alpha // maybe fix eqn. for your purpose!!!
        );
    }

Feedback welcome!

Cutter

Sorry for asking simple questions, I'm very new to OpenFOAM. Where should I place this code? and do I need the log file from the calculation in order to use this function? I didn't restore the data in a log file when I ran the simulations.

cutter July 8, 2013 10:20

Function objects are registered within a subdict called 'functions' in $CASE/system/controlDict.

See http://foam.sourceforge.net/docs/cpp/a00002.html and https://www.hpc.ntnu.no/display/hpc/...Postprocessing for example.

Hale July 8, 2013 10:59

Quote:

Originally Posted by cutter (Post 438472)
Function objects are registered within a subdict called 'functions' in $CASE/system/controlDict.

See http://foam.sourceforge.net/docs/cpp/a00002.html and https://www.hpc.ntnu.no/display/hpc/...Postprocessing for example.

Thanks a lot. I ran the simulations for several seconds now (by having the code you gave in the system/controlDict). But how can I access the results? I mean the air fluxes?

cutter July 8, 2013 11:13

It should be written to the solver's text output at the end of each time step.

Hale July 8, 2013 11:46

1 Attachment(s)
Quote:

Originally Posted by cutter (Post 438482)
It should be written to the solver's text output at the end of each time step.

I'm really sorry but nothing is written to the log file. I have attached my controlDict file to this message. I will really be grateful if you could tell me what I have done wrong.

Hale July 9, 2013 04:06

I have now fixed the problem with getting output from the solver. When I set rho*phi in the faceSource object function it gives the total flux at each time step but when I add the alpha1 (i.e. rho*phi*alpha1) it gives nothing in the output file. How can this problem be fixed?

Thanks
\Hale

cutter December 15, 2014 04:05

Hi,

sorry for the really late reply. Maybe it still helps you or any other reader of this thread.

Have a look at https://github.com/OpenFOAM/OpenFOAM...em/controlDict for a working example for OpenFOAM 2.3.x (there are tutorial cases for other versions of OF as well)!

The data will be written into ASCII text files (simple CSV format, with file extension *.dat) in a directory called postProcessing within the root directory of your case.

Feel free to ask follow up questions if necessary, hopefully the answer will come faster next time.

Cutter

mgdenno January 6, 2015 12:56

I have been playing around with this myself and I haven't been able to multiply rho*phi by alpha using faceSource.

One solution is to use swak4foam instead of faceSource. I found this somewhere on the forums, but I can't remember which post it came from.

https://openfoamwiki.net/index.php/Contrib/swak4Foam

Code:

    inlet
    {
        type                swakExpression;
        valueType          patch;
        patchName          c_inlet;
        aliases{alpha alpha.water;}
        verbose            true;
        expression          "alpha*U&Sf()";
        accumulations      ( sum );
        outputControlMode outputTime;
        outputInterval 1;
    }



All times are GMT -4. The time now is 07:25.