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

Add Temperature to multiphaseInterFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 12, 2015, 17:47
Default Add Temperature to multiphaseInterFoam
  #1
New Member
 
Nicolas Thiers
Join Date: Mar 2015
Posts: 17
Rep Power: 11
nthiers is on a distinguished road
Hi everyone, am new with openfoam and for my thesis i have to study a 3-phase fluid (oil+water+air) so i'm using multiphaseInterFoam, but i need to add temperature to my solver, so i follow the tutorial avaible for the icoFoam solver but now i need to add the multiphase effect to this ecuation.

i figure that it can be done treating DT (Thermal diffusivity) in the same way that rho but im not really sure how do i have to change the code or where is calculated the rho field as a mean weight by the volumes fraction.

if anyone could help me i will be really appreciate

Nicolas
nthiers is offline   Reply With Quote

Old   March 13, 2015, 05:32
Default
  #2
New Member
 
Ramon
Join Date: Feb 2014
Location: Eindhoven
Posts: 25
Rep Power: 12
RjwV is on a distinguished road
Hello Nicolas,

Have you ever looked in the twoPhaseEulerFoam solver? It is for two phases, but it contains energy equations for both phases, heat exchange between them, etc... Perhaps it could inspire you?

Kind regards,
Ramon
RjwV is offline   Reply With Quote

Old   March 25, 2015, 09:18
Default
  #3
New Member
 
Nicolas Thiers
Join Date: Mar 2015
Posts: 17
Rep Power: 11
nthiers is on a distinguished road
hi RjwV thanks for your help, i was actually looking at compresiblemultiphaseinterfoam and it helps me a lot. Now i have another problem, how can i add a new propertie to each phase? i modified the phase.h and the phase.c to add a new propertie DT but i cant compile, here are my two files:

phase.h

Code:
#ifndef phase_H
#define phase_H

#include "volFields.H"
#include "dictionaryEntry.H"
#include "incompressible/viscosityModels/viscosityModel/viscosityModel.H"

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

namespace Foam
{

/*---------------------------------------------------------------------------*\
                           Class phase Declaration
\*---------------------------------------------------------------------------*/

class phase
:
    public volScalarField
{
    // Private data

        word name_;
        dictionary phaseDict_;
        autoPtr<viscosityModel> nuModel_;
        dimensionedScalar rho_;
        /*##################*/
        dimensionedScalar DT_;
        /*##################*/

public:

    // Constructors

        //- Construct from components
        phase
        (
            const word& name,
            const dictionary& phaseDict,
            const volVectorField& U,
            const surfaceScalarField& phi
        );

        //- Return clone
        autoPtr<phase> clone() const;

        //- Return a pointer to a new phase created on freestore
        //  from Istream
        class iNew
        {
            const volVectorField& U_;
            const surfaceScalarField& phi_;

        public:

            iNew
            (
                const volVectorField& U,
                const surfaceScalarField& phi
            )
            :
                U_(U),
                phi_(phi)
            {}

            autoPtr<phase> operator()(Istream& is) const
            {
                dictionaryEntry ent(dictionary::null, is);
                return autoPtr<phase>(new phase(ent.keyword(), ent, U_, phi_));
            }
        };


    // Member Functions

        const word& name() const
        {
            return name_;
        }

        const word& keyword() const
        {
            return name();
        }

        //- Return const-access to phase1 viscosityModel
        const viscosityModel& nuModel() const
        {
            return nuModel_();
        }

        //- Return the kinematic laminar viscosity
        tmp<volScalarField> nu() const
        {
            return nuModel_->nu();
        }

        //- Return the laminar viscosity for patch
        tmp<scalarField> nu(const label patchi) const
        {
            return nuModel_->nu(patchi);
        }

        //- Return const-access to phase1 density
        const dimensionedScalar& rho() const
        {
            return rho_;
        }

	/*###########################################*/
	//- Return const-access to phase1 DT
        const dimensionedScalar& DT() const
        {
            return DT_;
        }
	/*###########################################*/
		
		
        //- Correct the phase properties
        void correct();

        //- Read base transportProperties dictionary
        bool read(const dictionary& phaseDict);
};


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

} // End namespace Foam

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

#endif

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



phase.c


Code:
#include "phase.H"

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

Foam::phase::phase
(
    const word& phaseName,
    const dictionary& phaseDict,
    const volVectorField& U,
    const surfaceScalarField& phi
)
:
    volScalarField
    (
        IOobject
        (
            IOobject::groupName("alpha", phaseName),
            U.mesh().time().timeName(),
            U.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh()
    ),
    name_(phaseName),
    phaseDict_(phaseDict),
    nuModel_
    (
        viscosityModel::New
        (
            IOobject::groupName("nu", phaseName),
            phaseDict_,
            U,
            phi
        )
    ),
    rho_(phaseDict_.lookup("rho"))
      
    /*##########################*/
    DT_(phaseDict_.lookup("DT"))
    /*##########################*/

{}

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

Foam::autoPtr<Foam::phase> Foam::phase::clone() const
{
    notImplemented("phase::clone() const");
    return autoPtr<phase>(NULL);
}


void Foam::phase::correct()
{
    nuModel_->correct();
}


bool Foam::phase::read(const dictionary& phaseDict)
{
    phaseDict_ = phaseDict;

    if (nuModel_->read(phaseDict_))
    {
        phaseDict_.lookup("rho") >> rho_;
        /*##############################*/
        phaseDict_.lookup("DT") >> DT_;
        /*##############################*/

        return true;
    }
    else
    {
        return false;
    }
}

when i try to compile the library multiphaseMixture, it fails in the DT_(phaseDict_.lookup("DT")) line and shows the error:

Code:
wmake libso multiphaseMixture
Making dependency list for source file phase/phase.C
SOURCE=phase/phase.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -IalphaContactAngle -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/transportModels/incompressible/lnInclude -I/opt/openfoam230/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam230/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/phase.o
SOURCE=multiphaseMixture.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -IalphaContactAngle -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/transportModels/incompressible/lnInclude -I/opt/openfoam230/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam230/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/multiphaseMixture.o
phase/phase.C: En el constructor ‘Foam::phase::phase(const Foam::word&, const Foam::dictionary&, const volVectorField&, const surfaceScalarField&)’:
phase/phase.C:65:5: error: expected ‘{’ before ‘DT_’
phase/phase.C: En el ámbito global:
phase/phase.C:65:8: error: expected constructor, destructor, or type conversion before ‘(’ token
make: *** [Make/linux64GccDPOpt/phase.o] Error 1
make: *** Se espera a que terminen otras tareas....
i will appreciate your help

Nicolas
nthiers is offline   Reply With Quote

Old   March 25, 2015, 12:22
Default
  #4
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
Hello there,

Have you seen these
http://www.cfd-online.com/Forums/ope...interfoam.html
http://www.wolfdynamics.com/images/conf_and_publ/interTempFoam.pdf
http://www.wolfdynamics.com/images/conf_and_publ/source_interTempFoam.tar.gz

kebsiali is offline   Reply With Quote

Old   March 30, 2015, 17:02
Default
  #5
New Member
 
Nicolas Thiers
Join Date: Mar 2015
Posts: 17
Rep Power: 11
nthiers is on a distinguished road
hi kebsiali thx for your answer, yes am already see them and they didnt help me with my problem, speacialy because multiphaseinterfoam has many diferences with interfoam, specially in the library, i couldnt extend that example to multiphaseinterfoam.

have you read my last message? have any idea why its giving me that error when i try to compile te library?

Thanks for your time and help!
nthiers is offline   Reply With Quote

Old   March 30, 2015, 17:41
Default
  #6
New Member
 
Nicolas Thiers
Join Date: Mar 2015
Posts: 17
Rep Power: 11
nthiers is on a distinguished road
Thanks every one for your help, finally i could make it work, i found the error, forgot to put "," at the end of the rho_(phaseDict_.lookup("rho")) line.

Code:
    rho_(phaseDict_.lookup("rho")),
      
    /*##########################*/
    DT_(phaseDict_.lookup("DT"))
    /*##########################*/

{}

// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
nthiers is offline   Reply With Quote

Old   February 17, 2016, 09:42
Default multiphaseinterfoam with temperature and extra transport properties
  #7
Member
 
Thomas Flint
Join Date: Jan 2016
Posts: 60
Rep Power: 10
tom_flint2012 is on a distinguished road
Hi nthiers,

I am also attempting to add temperature to multiphaseinterfoam. I have modified the phase.h and phase.c files as you suggested. I have also modified the multiphasemixture . and .c files. Is this necessary? I cant even get the solver to read in an extra transport property at this time. I am defining a volscalarfield kappasolid and using mixture.kappasolid() bu getting an "undefined reference" call. Did you just modify the phase files and if so how did you call your DT variable in your code if you dont mind me asking

Best regards,

Tom
tom_flint2012 is offline   Reply With Quote

Reply

Tags
multiphaseinterfoam, temperature field

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Problem with zeroGradient wall BC for temperature - Total temperature loss cboss OpenFOAM 12 October 1, 2018 07:36
[PyFoam] and paraview eelcovv OpenFOAM Community Contributions 28 May 30, 2016 10:23
Ansys Structural Environmental Temperature zytra Structural Mechanics 0 October 31, 2014 15:32
Free stream temperature saharesobh FLUENT 1 October 11, 2012 21:52
chemical reaction - decompostition La S. Hyuck CFX 1 May 23, 2001 01:07


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