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/)
-   -   Mean Age of Air (https://www.cfd-online.com/Forums/openfoam-post-processing/68300-mean-age-air.html)

Tobi December 7, 2015 07:36

Of course you can use this as a post-processing too.
Just use the velocity field U of your steady-state simulation and calculate your fluxes. Then just solve the equation of AoA. Finished (:

kingjewel1 December 7, 2015 07:50

Quote:

Originally Posted by Tobi (Post 576601)
Of course you can use this as a post-processing too.
Just use the velocity field U of your steady-state simulation and calculate your fluxes. Then just solve the equation of AoA. Finished (:

Hmm I have the AoA set as a
HTML Code:

functionObject
in my
HTML Code:

controlDict
, like this:

HTML Code:

functions
{

Tracer
    {
        type    scalarTransport;
        functionObjectLibs ("libutilityFunctionObjects.so");
        outputControl outputTime;
        active          true;
        autoSchemes    false;
        nCorr          0;
        resetOnStartUp false;
       

        fvOptions
        {
            IncrementTime
            {
            type            scalarSemiImplicitSource;
            active          true;
            selectionMode  all;
            cellZone        Layers;
                scalarSemiImplicitSourceCoeffs
                {
                    volumeMode  specific;
                    injectionRateSuSp
                    {
                        Tracer      (1 0);
                    }
                }
            }
        }
    }
}

So how could I run it independently of
HTML Code:

pimpleFoam
?

Tobi December 7, 2015 07:59

Hi,

you have to make a new solver which solves this equation.
Just modify the scalarTransportFoam.

Mojtaba.a June 13, 2016 17:26

Quote:

Originally Posted by Tobi (Post 576607)
Hi,

you have to make a new solver which solves this equation.
Just modify the scalarTransportFoam.

Dear Tobi,

Is there any reason that one has to make a new solver and not to use the function object?
Using FO seems easier and I see no difference. Is there anything I am missing?

Best.

Tobi June 13, 2016 18:09

It should work too :)
The problem is a bit older. When I made the first solver there was no possibility to do it with functions. Hence, I never tried it.

a_habib January 23, 2017 15:58

Hello foamers.

I recently switched my working field to the thermal comfort analyses and I when I searched about that in OpenFOAM I find this code:
https://sourceforge.net/projects/openfoamadd-ons/
And by reading the code I noticed that it can calculate the mean age of air and the ventilating efficiency and some other thermal comfort indicators (PMV, PPD, etc).

But I didn't found any example of using it or weather it could be used in the steady state cases or what, so if any one used it or have any knowledge about something similar it would be great to share that with us

Regards.

tian January 27, 2017 13:12

Hi,

here is a link for the download: comfortFoam

https://bitbucket.org/shor-ty/comfor...AM-4.x#commits

Bye
Tian


Sent from my iPhone using CFD Online Forum mobile app

a_habib January 28, 2017 14:08

Hi Mr Tain

Please bear with me because I have a lot of questions.

I'm using OpenFOAM 2.3.0 on Ubuntu 14.04 and after pasting the cloning code into my terminal inside the openFOAM directory, a new folder named "comfortFoam" created containing only a readme file with the same containing of the web site.

Now the web site says:

NOT IMPLEMENTED TILL NOW (so we can't use it ?, if so, when we can use it?)

How to compile it
- use git for cloning (and I think that I did that, correct?)
- change to the branch (is that means to select 2.3.x ?, if so, how I can do that?, if not, what is that means ?)
- compile with wmake (so it is not a dynamic library, correct?, so how we can use it? is it calculates the AoA, PMV, ... etc for the calculated results so I should use it after the simulation is finished? is this simulation is a steady state or transient one?

And thanks for your time

Regards

Ahmad

tian January 31, 2017 08:46

Hi,

That is correct. This is a post processing tool. You run it after your solution. Age of Air can run during your simulation via controlDict. No need to do it in comfortFoam.

I think comfortFoam is running under 4 version and 16+, too.

Bye ä
Thomas


Sent from my iPhone using CFD Online Forum mobile app

tian January 31, 2017 08:47

Hi,

You download via website or git. Than only run: wmake. It create a new tool: comfortFoam.

Bye
Thomas


Sent from my iPhone using CFD Online Forum mobile app

a_habib February 16, 2017 03:12

Compile error
 
Dear tian

I copied the files from the site and I got this error when I tried to compile it,

Code:

a-habib@ahmad-PC:~/OpenFOAM/a-habib-4.x/comfortfoam$ wmake
Making dependency list for source file comfortFoam.C
g++ -std=c++0x -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3  -DNoRepository -ftemplate-depth-100 -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/TurbulenceModels/incompressible/lnInclude -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/transportModels -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/transportModels/incompressible/singlePhaseTransportModel -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/thermophysicalModels/radiation/lnInclude -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/finiteVolume/lnInclude -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/meshTools/lnInclude  -IlnInclude -I. -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude -I/home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OSspecific/POSIX/lnInclude  -fPIC -c comfortFoam.C -o Make/linux64Gcc48DPInt32Opt/comfortFoam.o
In file included from /usr/include/stdint.h:25:0,
                from /home/a-habib/OpenFOAM/ThirdParty-4.x/platforms/linux64/gcc-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/include/stdint.h:9,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/int32.H:40,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/int.H:38,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/label.H:39,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/labelList.H:47,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/UPstream.H:42,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/Pstream.H:42,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/parRun.H:35,
                from /home/a-habib/OpenFOAM/OpenFOAM-4.x/src/finiteVolume/lnInclude/fvCFD.H:4,
                from comfortFoam.C:52:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
 #  include <sys/cdefs.h>
                        ^
compilation terminated.
make: *** [Make/linux64Gcc48DPInt32Opt/comfortFoam.o] Error 1
a-habib@ahmad-PC:~/OpenFOAM/a-habib-4.x/comfortfoam$

Any clue about that I how I can fix it
Thanks in advance

floquation February 16, 2017 03:16

Quick random guess:
What is your gcc version?

Tobi February 16, 2017 03:22

Dear Habib,

it seems that you installed OpenFOAM either you compiled it yourself, right? The message of the compiler is not related to the application you try to compile it is an essential packaged that is missing on your system for c++. It is a standard library that you need to compile the application. I am too lazy to search for your but »here we go« ... It is not really polite, I know, but as a supporter I want that the questioner thinks about the problem :P. Good luck.

PS: By the way it is TIAN not TAIN.

PPS: In addition, you have to switch to the branch for your OpenFOAM version. That is my fault because I have no time to update the readme till now.
Code:

git checkout

tian February 16, 2017 03:59

Hi, install libc6 and libc6-dev . Bye Thomas


Sent from my iPhone using CFD Online Forum mobile app

a_habib February 16, 2017 05:07

I'm really sorry for my mistake, I corrected it
I'm using a precompiled OP from http://rheologic.net and i know that i needed some packages to complete but my experience is not enough to figure it out

PS I don't have any experience in git that's why I rely on others in that
I'll try again
Thanks a lot

Tobi February 16, 2017 05:45

For git you need to do the following:

Code:

git checkout <tab><tab>
HEAD                    OpenFOAM-4.x            origin/OpenFOAM-2.3.x
master                  origin/HEAD            origin/OpenFOAM-4.x
OpenFOAM-2.3.x          origin/master

Then check out what you need. Honestly I only have it for 2.3.x and 4.x:
Code:

git checkout OpenFOAM-4.x
And then you can compile it. However if the compilation fails, do that:
Code:

sudo apt-get install build-essential flex bison git-core cmake zlib1g-dev libboost-system-dev libboost-thread-dev libopenmpi-dev openmpi-bin gnuplot libreadline-dev libncurses-dev libxt-dev
I totally understand that not everybody is familiar with git and programming but however, I am trying to force people to think about the questions they ask in order to improve their skills. E.g. your first error message was just related to a missing header. Searching in google will lead you directly to the missing packages :)

a_habib February 16, 2017 14:15

It worked
 
Dear Tobias

Thanks a lot for your effort and I'm really sorry for being such a lazy one

I had to install a lot of things after some updating

Code:

sudo apt-get update

sudo apt-get install build-essential flex bison git-core cmake zlib1g-dev libboost-system-dev libboost-thread-dev libopenmpi-dev openmpi-bin gnuplot libreadline-dev libncurses-dev libxt-dev

and to compile 32 on 64

Code:

sudo apt-get install libx32gcc-4.8-dev

sudo apt-get install libc6-dev-i386

LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/usr/lib32:$LIBRARY_PATH
export LIBRARY_PATH

Thanks again

a_habib February 20, 2017 15:02

Some Questions
 
Dear Tobi,

I tried to use the comfortFoam tool on the hotRoom tutorial using buoyantBoussinesqPimpleFoam (as a rough start) and -thanks to you- it worked as it says in its description, and in the end i got this message (No AoA file found in last time dictionary Skip calculation of AoA) when the { if (AoAHeader.headerOk())} wasn't satisfied, so, as it's obvious I need the AOA filed in the case files. could it be like this? (not in the hotRoom case, I mean generally)

Code:

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

dimensions      [0 0 -1 0 0 0 0]; // or [0 0 1 0 0 0 0 ];

internalField  uniform 0;

boundaryField
{

    inlet
    {
        type            fixedValue;
        value          uniform 0;
    }
    outlet
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }
}


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

And while I was reading the source file (comfortFoam.c) I noticed a few things that I want to ask about if you don't mind.

Does it calculate the AOA only in the last time step? because I saw that it is reading the AOAHeader and creating the volScalarField nut and solving the AOAEqn only if (i+1==endTime)

Code:

        //- If last time, calcualte AoA
        if (i+1 == endTime)
        {
            Info << "Read header of AoA file if available" << endl;

            IOobject AoAHeader
            (
                "AoA",
                runTime.timeName(),
                mesh,
                IOobject::READ_IF_PRESENT
            );

            if (AoAHeader.headerOk())
            {
                Info<< "Create field AoA\n" << endl;

                volScalarField AoA(AoAHeader, mesh);

                Info<< "Backup original AoA file to AoA.old\n" << endl;

                mvBak(AoA.objectPath(), "old");

                #include "createPhi.H"

                Info<< "Create field nut\n" << endl;

                const volScalarField nut
                (
                    IOobject
                    (
                        "nut",
                        runTime.timeName(),
                        mesh,
                        IOobject::MUST_READ,
                        IOobject::AUTO_WRITE
                    ),
                    mesh
                );

                int count = 0;

                while (true)
                {
                    fvScalarMatrix AoAEqn
                    (
                       
                        fvm::ddt(AoA)
                      + fvm::div(phi, AoA)
                      - fvm::laplacian(nut, AoA)
                      ==
                        dimensionedScalar
                        (
                            "ageSource",
                            AoA.dimensions()*dimensionSet(0,0,-1,0,0,0,0),
                            scalar(1)
                        )
                    );

                    AoAEqn.relax();

                    AoAEqn.solve();

                    count++;
.
.
.

Also I saw that the AOA won't be written unless the count > 500, what is this means?

At last, I noticed that you had uncommented the calculation of the mid, max AOA and the AE, so if I recommented these lines back it should work, correct? or you'r blanning to modify some thing?

Code:

if (count > 500)
                    {
                        AoA.write();
//
//                        scalar cellsum(0);
//                        scalar midAoA(0);
//                        scalar volume(0);
//           
//                        forAll(mesh.cells(), cellI)
//                        {
//                            midAoA += AoA[cellI] * mesh.V()[cellI];
//                            volume += mesh.V()[cellI];
//                            cellsum++;
//                        };
//           
//                        scalar maxValue = max(AoA).value();
//           
//                        Info<< "Average age of air "
//                            << (midAoA/volume) << " s\n"
//                            << "Maximum age of air "
//                            << maxValue << " s\n";
//           
//                        // AE = (Tn/2TM) x 100 %
//                        Info<< "Room volume "
//                            << gSum(mesh.V()) << " m3\n";
//                            << "Ventilation efficiency AE = "
//                            << (gSum(mesh.V())/sumZuluft)/(2*(maxValue/3600))
//                            << " %" << endl;

                        break;
                    }

Thanks a lot for your great effort.

Regards,

Ahmad.

Tobi February 23, 2017 03:52

Dear Ahmad,

first of all thank you for the feedback but the fruits should go more to Thomas Tian because he programmed it and asked me if I can extend it and or host it. Till now I just changed a few things like:
  • Formatting
  • Cleaning
  • Hosting
  • Rebuild for different FOAM-Versions
  • An extreme speedup based on a wrong build of an large array
  • Optimization to the code

You are right, if you want to calculate the mean time of the air you have to put a file to the last time step which looks like you had. The 500 times is like that we calculate the matrix 500 times in order to get an accurate solution. This implementation is stupid and I wanted to change it some when but no time. Now, I even think the whole calculation of AoA is not correct because it does not make sense for me at the moment :P. I will not work on that code till a new version is out and I have to re-build it for the new FOAM-version (if necessary). In addition, I should split the code into more files.


PS: If you think about the equation AoAEqn, you will understand that it should be definitely wrong, right? But I have to check.

a_habib February 23, 2017 08:16

Ok dear Tobi
Thanks for the response and I'll keep looking into it and waiting for the update [emoji4]


Sent from my iPhone using CFD Online Forum mobile app


All times are GMT -4. The time now is 19:04.