CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Age of Air Function Object

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By b.simpson
  • 1 Post By Tobermory
  • 1 Post By b.simpson
  • 2 Post By HPE

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2020, 11:54
Default Age of Air Function Object
  #1
Member
 
Ben Simpson
Join Date: Dec 2019
Location: UK
Posts: 32
Rep Power: 7
b.simpson is on a distinguished road
Hi all,

I am trying to set up an Age of Air function object in OpenFOAM 8. I am running buoyantSimpleFoam in Ubuntu 18.04.

I have tried implementing a function object from older threads (mainly Age of air with function object).

My controlDict code is:
Code:
AoA
	{
		type    scalarTransport;
		libs 	("libutilityFunctionObjects.so");
		enabled true;
		writeControl writeTime;
		log yes;
		nCorr 1;

		field AoA;
		active          true;
		autoSchemes     false;
		resetOnStartUp false;
		DT              1e-5;

		fvOptions
		{
			IncrementTime
			{
				type            semiImplicitSource;
				active          true;
				selectionMode all;
				volumeMode  specific;
				sources
				{
					injectionRateSuSp
					{
						AoA       (1 0);
					}
				}
			}
		}
	}
I am now getting the following error:
Code:
Selecting finite volume options model type semiImplicitSource
    Source: IncrementTime
    - selecting all cells
    - selected 1119784 cell(s) with volume 158.70844
[0] 
[0] 
[0] --> FOAM FATAL ERROR: 
[0] 
    request for regIOobject injectionRateSuSp from objectRegistry region0 failed
    available objects of type regIOobject are
Does anyone know what I need to put in place of "injectionRateSuSp"?

Or if there is a better method for calculating age of air?

Thanks in advance for any support.

Kind regards,
Ben

My 0/AoA file is:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
	location    "0";
    object      AoA;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 1 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    "xmin|xmax|ymin|ymax|zmax_north|zmax_south"
    {
        type            fixedValue;
        value           uniform 0;
    }
	"zmin|Ceiling|Floor|East_Wall|North_Wall|South_Wall|West_Wall|Computer|Person|zmax_ceiling"
    {
        type            zeroGradient;
    }
	Inlet
    {
        type            fixedValue;
        value           uniform 0;
    }
	
	#includeEtc "caseDicts/setConstraintTypes"
}
fvSolutions:
Code:
AoA
    {
        solver           smoothSolver;
        smoother         GaussSeidel;
        tolerance        1e-08;
        relTol           0.1;
        nsweep           1;
    }
fvSchemes:
Code:
div(phi,AoA) bounded Gauss upwind;
Rojj likes this.
b.simpson is offline   Reply With Quote

Old   December 7, 2020, 17:46
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
There were some changes in v8 to the semiImplicit source term syntax. Check out https://openfoam.org/release/8/ and the example in https://github.com/OpenFOAM/OpenFOAM...7e9747fe696aeb. I am guessing that you need to change:
Code:
				sources
				{
					injectionRateSuSp
					{
						AoA       (1 0);
					}
				}
to something like:

Code:
				sources
				{
					AoA
					{
						explicit 1;
						implicit 0;
					}
				}
Good luck!
Rojj likes this.
Tobermory is offline   Reply With Quote

Old   December 10, 2020, 09:27
Default Thanks
  #3
Member
 
Ben Simpson
Join Date: Dec 2019
Location: UK
Posts: 32
Rep Power: 7
b.simpson is on a distinguished road
Thank you for your reply Tobermory.

The changes you suggested worked and my AoA is now working.

Many thanks.

Ben
Tobermory likes this.
b.simpson is offline   Reply With Quote

Old   February 7, 2021, 14:40
Default
  #4
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
In case of anyone's interest,


Function object definitions for the `local mean age of air` and `normalised local mean age of air` metrics (where zero-value means fresh air):

Code:
scalarTransport1
{
    type            scalarTransport;
    libs            (solverFunctionObjects);
    field           LMA;
    schemesField    k;    // bounded Gauss limitedLinear 1;
    bounded01       false;
    alphaD          1;    // viscous contribution
    alphaDt         0;    // turbulent contribution
    // Adding fvOption source for residence time
    fvOptions
    {
        unitySource
        {
            type            scalarSemiImplicitSource;
            enabled         true;
            scalarSemiImplicitSourceCoeffs
            {
                selectionMode   all;
                volumeMode      specific;
                injectionRateSuSp
                {
                    LMA           (1 0);
                }
            }
        }
    }
    resetOnStartUp  false;
    timeStart       <timeStart>;
    executeControl  timeStep;
    executeInterval 1;
    writeControl    writeTime;
}

normalisedLocalMeanAge1
{
    type            reference;
    libs            (fieldFunctionObjects);
    field           LMA;
    result          nLMA;
    // normT = T / (V/Q)
    // normT: normalised local mean age of air
    // T: local mean age of air (Bartak et al., 2001, Eq. 1)
    // V: volume of air in the room [m3]
    // Q: volumetric flow rate through the inlet [m3/s]
    // V/Q: (estimated) mean age of fluid through a reference area (e.g. outlet)
    // scale = 1/(V/Q) = Q/V [1/s]
    scale           <Q/V>;
    offset          0;
    timeStart       <timeStart>;
    executeControl  writeTime;
    writeControl    writeTime;
}
The field `LMA` needs the initial/boundary condition file (e.g. in `0.orig/LMA`) and a setup in `fvSolution`:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      LMA;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 0;
    }

    outlet
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value           uniform 0;
    }

    ".*"
    {
        type            zeroGradient;
    }

    #includeEtc "caseDicts/setConstraintTypes"
}


// ************************************************************************* //
Code:
solvers
{
    LMA
    {
        solver          PBiCGStab;
        preconditioner  DILU;
        tolerance       1e-8;
        relTol          0.01;
    }
}

relaxationFactors
{
    equations
    {
        LMA         0.7;
    }
}
mezomatic and Tobermory like this.
HPE is offline   Reply With Quote

Old   August 13, 2021, 02:38
Default
  #5
New Member
 
Toby
Join Date: Aug 2021
Posts: 1
Rep Power: 0
t2the0bi is on a distinguished road
@HPE:

Thanks for providing the code for the function object, I successfully implemented it into my case. However, analysing the results uncovered some unrealistic values where the LMA value was bigger than the timestep (e.g. after 40 s the LMA showed a value of 60). Any idea where this mistake might originate from?

I am simulating a box-shaped room with natural ventilation (inlet and outlet window).

Thanks in advance!
t2the0bi is offline   Reply With Quote

Old   July 10, 2024, 04:28
Default Age of Air Function Object
  #6
Senior Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 121
Rep Power: 16
kerim is on a distinguished road
Hi,
I followed to recommendation of HPE. But I got an error:Starting time loop

Selecting finite volume options type scalarSemiImplicitSource
Source: unitySource
- selecting all cells
- selected 499200 cell(s) with volume 45.36


--> FOAM FATAL IO ERROR: (openfoam-2012 patch=210618)
Wrong token type - expected scalar value, found on line 78: word '<timeStart>'

From Foam::Istream& Foam:perator>>(Foam::Istream&, Foam::doubleScalar&)
in file lnInclude/Scalar.C at line 154.

FOAM exiting.
Who knows what am I going to do with this situation?
I am using of2012 installed on the ubuntu 18.06LTS

Thank you.
Attached Files
File Type: txt controlDict.txt (2.7 KB, 2 views)
File Type: txt log.simpleFoam.txt (2.3 KB, 0 views)
kerim is offline   Reply With Quote

Old   August 12, 2024, 04:10
Default
  #7
New Member
 
Na
Join Date: Sep 2014
Posts: 6
Rep Power: 12
Eranho is on a distinguished road
Hi. I have error too:

"--> FOAM FATAL IO ERROR:
wrong token type - expected string, found on line 60 the word 'solverFunctionObjects'
"

I'm using OF4Win 20.09

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     simpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         2000;

deltaT          1;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

cacheTemporaryObjects
(
    kEpsilon:G
);

functions
{
    #includeFunc streamlines
    #includeFunc writeObjects(kEpsilon:G)
scalarTransport1
{
    type            scalarTransport;
    libs            (solverFunctionObjects);
    field           LMA;
    schemesField    k;    // bounded Gauss limitedLinear 1;
    bounded01       false;
    alphaD          1;    // viscous contribution
    alphaDt         0;    // turbulent contribution
    // Adding fvOption source for residence time
    fvOptions
    {
        unitySource
        {
            type            scalarSemiImplicitSource;
            enabled         true;
            scalarSemiImplicitSourceCoeffs
            {
                selectionMode   all;
                volumeMode      specific;
                injectionRateSuSp
                {
                    LMA           (1 0);
                }
            }
        }
    }
    resetOnStartUp  false;
    timeStart       <timeStart>;
    executeControl  timeStep;
    executeInterval 1;
    writeControl    writeTime;
}

normalisedLocalMeanAge1
{
    type            reference;
    libs            (fieldFunctionObjects);
    field           LMA;
    result          nLMA;
    // normT = T / (V/Q)
    // normT: normalised local mean age of air
    // T: local mean age of air (Bartak et al., 2001, Eq. 1)
    // V: volume of air in the room [m3]
    // Q: volumetric flow rate through the inlet [m3/s]
    // V/Q: (estimated) mean age of fluid through a reference area (e.g. outlet)
    // scale = 1/(V/Q) = Q/V [1/s]
    scale           <Q/V>;
    offset          0;
    timeStart       <timeStart>;
    executeControl  writeTime;
    writeControl    writeTime;
}
}

// ************************************************************************* //
Eranho is offline   Reply With Quote

Reply

Tags
age of air, buoyantsimplefoam, natural ventilation, openfoam 8


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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