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

Mean Age of Air

Register Blogs Community New Posts Updated Threads Search

Like Tree24Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 20, 2012, 17:20
Default
  #21
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

same solutions with simple and pimple.
Attachements
Attached Images
File Type: jpg TimePimpleFoam.jpg (13.3 KB, 92 views)
File Type: jpg TimeSimpleFoam.jpg (13.4 KB, 80 views)
Tobi is offline   Reply With Quote

Old   July 23, 2012, 06:55
Default
  #22
Member
 
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17
Toorop is on a distinguished road
Hi,

unfortunately I have mixed up the correct solver with an old one with errors. A thunder storm killed the hard disk with the new, correct version and I posted my obsolete one - always back up, and correct old stuff as well ...

So the correct scalar equation with sources:
Code:
tmp<fvScalarMatrix> TEqn
    (
        fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(DTEff, T) == sources(T)
    );
One have to add one more line to the solver:
Code:
sources.constrain(TEqn());
This function can be applied to set values in given cells - it has no effect on our setup, though, I added it for completeness.

Add sourcesProperties folder to your constant folder with entries:
Code:
age
{
    type            scalarExplicitSource;
    active          on;
    timeStart       0.0;
    duration        1.0;
    selectionMode   all;

    scalarExplicitSourceCoeffs
    {
        volumeMode        specific;
        injectionRate
        {
            T            1;
        }
    }
}
So the solver updates the T field, the value of time step is given to every cell. Check the release notes about field sources to get more information about this feature.

I double-checked this solution, and it gives the exact values of the solver that Andrew King has attached a while back. Andrew, thanks for your solution, quite useful!

About the term in the laplacian, I "borrowed" the idea from Daniel C, here's what he said about the issue. I set DT to zero since I don't want additional diffusion.

I don't know if this method can be used in a steady-state case since there's no explicit time stepping. But if the solution matches the transient version more or less than it can be valid.

WARNING: I don't validated any result to real world tests. Feel free to correct the solver, add your thoughts, thank you!

About your question:
if the flow is laminar, incompressible and you now the inlet properties (velocity / flow rate), I think it's just some basic calculations and it depends on the geometry of the diffusor. When the flow is turbulent I don't know how to calculate it, maybe there's some good approximations out there.
Attached Files
File Type: gz ageScalarFoam.tar.gz (2.5 KB, 56 views)
File Type: gz pitzDailyPimpleAge.tar.gz (3.6 KB, 35 views)
Tobi likes this.
Toorop is offline   Reply With Quote

Old   April 23, 2013, 14:07
Default
  #23
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
Hi
also it seems a dead thread.but I hope not and propound my question!
I have a inflow patch and need a lot to know if the inflowing fluid has reached to outflow patch or not.
preferably by rhoPimpleFoam.
both the fluid that rest in the channel at first(internalField) and the fluid is entering are the same (air) but entering air has more pressure and temperature.
is it possible to track entering air particles through the unsteady case I have?
to give more information if is important to answer the case is a rectangular tube with one inflow and one outflow patch.
how to modify the files in this thread in my case?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 23, 2013, 14:36
Default
  #24
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by immortality View Post
Hi
also it seems a dead thread.but I hope not and propound my question!
I have a inflow patch and need a lot to know if the inflowing fluid has reached to outflow patch or not.
preferably by rhoPimpleFoam.
both the fluid that rest in the channel at first(internalField) and the fluid is entering are the same (air) but entering air has more pressure and temperature.
is it possible to track entering air particles through the unsteady case I have?
to give more information if is important to answer the case is a rectangular tube with one inflow and one outflow patch.
how to modify the files in this thread in my case?
Hi,

you can use implement a conserved scalar transport equation for that!
At the beginning your scalar is 1 at the inlet and the rest is zero.

While simulating your scalar is transported through the domain. In your case you should only use the transport due to convection and so you can have a look when the scalar reaches the outlet!

Hope its helpful.
Tobi
immortality likes this.
Tobi is offline   Reply With Quote

Old   April 23, 2013, 14:44
Default
  #25
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
Hi Tobias
thanks for rapid reply!
I haven't modified a solver to solve for a new equation.
then could you please guide me.
I've added this in createFields:
Code:
volScalarField age
    (
        IOobject
        (
            "age",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
is this the only change should I do in createFiels.H or some other lines?

in the folder of solver I have to add this:
Code:
// --- Scalar Transport
	volScalarField DTEff = DT+turbulence->muEff()/0.7;
	tmp<fvScalarMatrix> AgeEqn
	(
	 fvm::ddt(rho,Age) + fvm::div(phi, Age)   == dimensionedScalar("AgeSource", Age.dimensions()*dimensionSet(1,-3,-1,0,0), 1) //- fvm::laplacian(DTEff, Age)
	);
	
	AgeEqn().relax();
	
	sources.constrain(AgeEqn());
	
	AgeEqn().solve();
I changed all T's to Age.and as you said to me should delete the laplacian term also,correct?
and what should be assign for DT?and also change nut to mut(since my case is compressible,unsteady) correct?
(does it work if I switch to a turbulent case too?)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; April 23, 2013 at 15:47.
immortality is offline   Reply With Quote

Old   April 23, 2013, 17:40
Default
  #26
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,
have a look at my solver: https://github.com/shor-ty/scalarRhoSimpleFoam

Then use the scalarEqn.H and the entry in the createFields.H for your own pimple solver!

If there are any problems ask me!

Have a nice evening,
Tobi
Tobi is offline   Reply With Quote

Old   April 24, 2013, 08:23
Default
  #27
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
thanks.
1)I can't download.this error occurs:
Code:
https://github.com/shor-ty/scalarRhoSimpleFoam.git
bash: https://github.com/shor-ty/scalarRhoSimpleFoam.git: No such file or directory
2)and also why ddt isn't there in equation?
Code:
    // --- Scalar transport


    tmp<fvScalarMatrix> SEqn
    (
       (
            fvm::div(phi, S) 
          - fvm::Sp(fvc::div(phi), S)
              - fvm::laplacian(turbulence->muEff(), S)
          )
    );


    SEqn().relax();    
    SEqn().solve(mesh.solver("S"));
3)how should I modify it to my unsteady compressible problem you know?
should I delete laplacian term totally?why you have not done this to delete laplacian term?then how can account for
turbulence?
4)what does this term is added?what does do?
Code:
- fvm::Sp(fvc::div(phi), S)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; April 24, 2013 at 10:17.
immortality is offline   Reply With Quote

Old   April 24, 2013, 14:47
Default
  #28
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
hi
could you please help me with questions?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 24, 2013, 15:22
Default
  #29
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by immortality View Post
hi
could you please help me with questions?
Hi,

i was at work till now.

1. on my computer the github link is working!
2. you have to set ddt into that equation; in my case I used the SIMPLE algo (steady-state; ddt = 0)
3. let the diffusion term in your case
4. thats a numerical trick for stabilisation
Tobi is offline   Reply With Quote

Old   April 24, 2013, 15:26
Default
  #30
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
git clone https://github.com/shor-ty/scalarRhoSimpleFoam.git
Tobi is offline   Reply With Quote

Old   April 24, 2013, 18:30
Default
  #31
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
thanks.then can you please give me a more description (or there is a source and internet link for that) about the term you has added for more stability.because may it be necessary to give some description in my thesis about each of terms in equations.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 25, 2013, 01:42
Default
  #32
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by immortality View Post
thanks.then can you please give me a more description (or there is a source and internet link for that) about the term you has added for more stability.because may it be necessary to give some description in my thesis about each of terms in equations.
I wrote a PDF and posted it here ... but no time for searching at the moment.
Tobi is offline   Reply With Quote

Old   April 25, 2013, 03:01
Default
  #33
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
ok.thank you.that would be nice.then i wait untill you come back.
and what does that expression argument in parenthesis in solve() function mean?is that for cases we have moving mesh?
Code:
SEqn().solve(mesh.solver("S"));
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; April 25, 2013 at 08:27.
immortality is offline   Reply With Quote

Old   April 25, 2013, 08:43
Default
  #34
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
and also in rhoPimpleFoam solver below is the position of gasEquation.H suitable(several times it solves) or it is better to be after pimple.loop() to solve one time each time step?
Code:
int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"

    pimpleControl pimple(mesh);

    #include "createFields.H"
    #include "createFvOptions.H"
    #include "initContinuityErrs.H"

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

    Info<< "\nStarting time loop\n" << endl;

    while (runTime.run())
    {
        #include "readTimeControls.H"
        #include "compressibleCourantNo.H"
        #include "setDeltaT.H"

        runTime++;

        Info<< "Time = " << runTime.timeName() << nl << endl;

        if (pimple.nCorrPIMPLE() <= 1)
        {
            #include "rhoEqn.H"
        }

        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            #include "UEqn.H"
            #include "EEqn.H"

            // --- Pressure corrector loop
            while (pimple.correct())
            {
                #include "pEqn.H"
            }

            if (pimple.turbCorr())
            {
                turbulence->correct();
            }

              #include "gasEqn.H"
        }
        //Cp.write();
        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }

    Info<< "End\n" << endl;

    return 0;
}
thanks.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 25, 2013, 11:12
Default
  #35
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
hello again
excuse me for questions.
I run the case but gas(scalar value) is not between 0 and 1 as the snapshot.
how to resolve?
thanks.
Attached Images
File Type: jpg gas_value.jpg (12.7 KB, 64 views)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 25, 2013, 12:17
Default
  #36
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by immortality View Post
hello again
excuse me for questions.
I run the case but gas(scalar value) is not between 0 and 1 as the snapshot.
how to resolve?
thanks.
i dont know what you mean with gas. Is that your new scalar?

http://www.cfd-online.com/Forums/ope...tml#post407482
Tobi is offline   Reply With Quote

Old   April 25, 2013, 12:57
Default
  #37
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
yes.at last i put the name gas in return of S.because air flowing in has a higher pressure and temperature than air in domain.shouln't it be between 0 and 1
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 25, 2013, 13:24
Default
  #38
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
The value of your scalar depend on yuor BC settings!
Tobi is offline   Reply With Quote

Old   April 25, 2013, 13:32
Default
  #39
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
i have set it 1 for inflow and 0 for initial condition as you told.
Maybe because my case is compressible a change should be done.
The dimension is zero[0 0 0 0 0 0].is it correct?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 25, 2013, 14:41
Default
  #40
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
I am a bit confused couse the tutorial added in my git repo is not the one i build for that. Its the CO/H2/N2 mesh

well maybe I have time to resolve that mesh but first I reset my computer for Arch Linux
Tobi is offline   Reply With Quote

Reply


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
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 08:59
local age of air in starccm+ Mike23 Siemens 3 September 20, 2008 12:16
[Indoor Air Quality]How do I calcauate "Age of Air Young CFX 6 April 29, 2008 00:14
age of air teddy Siemens 3 February 9, 2007 10:41
Age of Air In Star-CD Ted Crilly Siemens 1 February 19, 2005 20:50


All times are GMT -4. The time now is 23:34.