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

Where are correct () and update() functions defined ?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By dkxls

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2013, 11:14
Default Where are correct () and update() functions defined ?
  #1
Senior Member
 
Sasan Ghomi
Join Date: Sep 2012
Location: Denmark
Posts: 292
Rep Power: 15
sasanghomi is on a distinguished road
Hi Foamers,

I am focusing the codes of sonicTurbDyMEngineFoam these days.
Do you know where is the correct() function defined in below code ?
Code:
 thermo.correct();
And where is update() function defined in below code ?
Code:
 bool meshChanged = mesh.update();
I appreciate your help.
Thanks and best regards,
Sasan.

P.S. correct function declared as a pure virtual function in basicThermo class.
sasanghomi is offline   Reply With Quote

Old   July 24, 2013, 12:00
Default
  #2
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 59
Rep Power: 14
yhaomin2007 is on a distinguished road
For the first question "thermo.correct();"
It depends on what thermo model you are using. Take hPsiThermo as an example.
It is define in
/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C

For the second question. This is used dynamic meshing.It also depends on what dynamic meshing utility you are using. If you use dynamicRefineFvMesh
It is defined in
/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
yhaomin2007 is offline   Reply With Quote

Old   July 24, 2013, 12:44
Default
  #3
Senior Member
 
Sasan Ghomi
Join Date: Sep 2012
Location: Denmark
Posts: 292
Rep Power: 15
sasanghomi is on a distinguished road
Dear Haomin

Thank you very much.

Best regards
Sasan.
sasanghomi is offline   Reply With Quote

Old   August 15, 2013, 16:04
Default
  #4
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 Sasan,Haomin and other dears
what does correct() do on thermo type?
I can't find thermo.correct() in the library below:
Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "hePsiThermo.H"

// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //

template<class BasicPsiThermo, class MixtureType>
void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate()
{
    const scalarField& hCells = this->he_.internalField();
    const scalarField& pCells = this->p_.internalField();

    scalarField& TCells = this->T_.internalField();
    scalarField& psiCells = this->psi_.internalField();
    scalarField& muCells = this->mu_.internalField();
    scalarField& alphaCells = this->alpha_.internalField();

    forAll(TCells, celli)
    {
        const typename MixtureType::thermoType& mixture_ =
            this->cellMixture(celli);

        TCells[celli] = mixture_.THE
        (
            hCells[celli],
            pCells[celli],
            TCells[celli]
        );

        psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);

        muCells[celli] = mixture_.mu(pCells[celli], TCells[celli]);
        alphaCells[celli] = mixture_.alphah(pCells[celli], TCells[celli]);
    }

    forAll(this->T_.boundaryField(), patchi)
    {
        fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
        fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
        fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];

        fvPatchScalarField& ph = this->he_.boundaryField()[patchi];

        fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
        fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];

        if (pT.fixesValue())
        {
            forAll(pT, facei)
            {
                const typename MixtureType::thermoType& mixture_ =
                    this->patchFaceMixture(patchi, facei);

                ph[facei] = mixture_.HE(pp[facei], pT[facei]);

                ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
                pmu[facei] = mixture_.mu(pp[facei], pT[facei]);
                palpha[facei] = mixture_.alphah(pp[facei], pT[facei]);
            }
        }
        else
        {
            forAll(pT, facei)
            {
                const typename MixtureType::thermoType& mixture_ =
                    this->patchFaceMixture(patchi, facei);

                pT[facei] = mixture_.THE(ph[facei], pp[facei], pT[facei]);

                ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
                pmu[facei] = mixture_.mu(pp[facei], pT[facei]);
                palpha[facei] = mixture_.alphah(pp[facei], pT[facei]);
            }
        }
    }
}


// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

template<class BasicPsiThermo, class MixtureType>
Foam::hePsiThermo<BasicPsiThermo, MixtureType>::hePsiThermo
(
    const fvMesh& mesh,
    const word& phaseName
)
:
    heThermo<BasicPsiThermo, MixtureType>(mesh, phaseName)
{
    calculate();

    // Switch on saving old time
    this->psi_.oldTime();
}


// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //

template<class BasicPsiThermo, class MixtureType>
Foam::hePsiThermo<BasicPsiThermo, MixtureType>::~hePsiThermo()
{}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

template<class BasicPsiThermo, class MixtureType>
void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::correct()
{
    if (debug)
    {
        Info<< "entering hePsiThermo<BasicPsiThermo, MixtureType>::correct()"
            << endl;
    }

    // force the saving of the old-time values
    this->psi_.oldTime();

    calculate();

    if (debug)
    {
        Info<< "exiting hePsiThermo<BasicPsiThermo, MixtureType>::correct()"
            << endl;
    }
}
__________________
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   August 15, 2013, 16:06
Default
  #5
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 59
Rep Power: 14
yhaomin2007 is on a distinguished road
It calculate other properties from pressure and h or e.
yhaomin2007 is offline   Reply With Quote

Old   August 16, 2013, 10:49
Default
  #6
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
thermo.correct() is just a wrapper for thermo.calculate(). See the code below for an example.

This has been discussed here already some time ago, search the forum and you will find more information.


Code:
template<class BasicPsiThermo, class MixtureType>
void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::correct()
{
    if (debug)
    {
        Info<< "entering hePsiThermo<BasicPsiThermo, MixtureType>::correct()"
            << endl;
    }

    // force the saving of the old-time values
    this->psi_.oldTime();

    calculate();

    if (debug)
    {
        Info<< "exiting hePsiThermo<BasicPsiThermo, MixtureType>::correct()"
            << endl;
    }
}
mikulo likes this.
dkxls 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
Is my Dynamic mesh setup correct? cfd seeker FLUENT 16 October 30, 2020 07:16
Update of the variables after dynamic mesh motion. gtg258f OpenFOAM Programming & Development 9 January 18, 2014 11:08
apt-get update Duplicate lists of OpenFOAM Xulia OpenFOAM Installation 2 June 20, 2013 11:13
Using Workbench, CFX-Pre doesn't update mesh from upstream data Shawn_A CFX 2 November 25, 2012 14:06
how can I correct the udf? happyrabbit FLUENT 9 January 28, 2011 10:50


All times are GMT -4. The time now is 20:26.