CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Implementation of Temperature Eqn in InterPhaseChangeFoam (http://www.cfd-online.com/Forums/openfoam-solving/111945-implementation-temperature-eqn-interphasechangefoam.html)

Jibran January 18, 2013 08:22

Implementation of Temperature Eqn in InterPhaseChangeFoam
 
Dear All,

Has anyone sucessfully implemented the temperature equation in interphaseChangeFoam?? I followed 'A interphasechangeFoam tutorial by Martin Andersen' but the results seem to be quite inaccurate. I have attached the relevant files below.

ALPHA1
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "0";
    object      alpha;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 0 0 0 0 0 0];
internalField  uniform 0;
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
   
    right_wall
    {
        type            constantAlphaContactAngle;
        theta0          10;
        limit  gradient;
        value          uniform 0;
    }
   
    lower_wall
    {
        type            zeroGradient;
    }
   
    atmosphere
    {
        type  zeroGradient;   
    }
   
    default_faces
    {
        type            empty;
    }
}



P_RGH
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "0";
    object      p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [1 -1 -2 0 0];
internalField  uniform 100000;
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
   
    right_wall
    {
        type            fixedFluxPressure;
        adjoint        no;
    }
   
    lower_wall
    {
        type            buoyantPressure;
    }
   
    atmosphere
    {
        type            fixedValue;
        value          uniform 100000;
    }
   
    default_faces
    {
        type            empty;
    }
}


T
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "0";
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 0 0 1 0]; // [K]
internalField  uniform 280.15;
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
   
    right_wall
    {
        type            fixedValue;
        value        uniform 300.15;
    }
   
    lower_wall
    {
        type            fixedValue;
        value        uniform 300.15;
    }
   
    atmosphere
    {
        type            fixedValue; 
        value        uniform 280.15;
    }
    default_faces
    {
        type            empty;
    }
}


U
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 1 -1 0 0];
internalField  uniform (0 0 0);
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
    right_wall
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
    lower_wall
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
    atmosphere
    {
        type            fixedValue;       
        value          uniform (0 0 0);
    }
   
    default_faces
    {
        type            empty;
    }
}


TRANSPORT PROPERTIES
Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phaseChange on;
 
phaseChangeTwoPhaseMixture Kunz;
 
sigma          sigma  [1 0 -2 0 0 0 0] 0.07;
 
DT  DT  [0 2 -1 0 0 0 0] 0.02; // [m^2/s]
 
phase1
{
    transportModel Newtonian;
    nu              nu [0 2 -1 0 0 0 0] 5.5e-07;
    rho            rho [1 -3 0 0 0 0 0] 988;
}
 
phase2
{
    transportModel Newtonian;
    nu              nu [0 2 -1 0 0 0 0] 4.273e-04;
    rho            rho [1 -3 0 0 0 0 0] 0.02308;
}
KunzCoeffs
{
    UInf            UInf  [0 1 -1 0 0 0 0]    5.0;
    tInf            tInf  [0 0 1 0 0 0 0]      0.016; // L = 0.08 m
    Cc              Cc    [0 0 0 0 0 0 0]      100;
    Cv              Cv    [0 0 0 0 0 0 0]      100;
}
MerkleCoeffs
{
    UInf            UInf  [0 1 -1 0 0 0 0]    5.0;
    tInf            tInf  [0 0 1 0 0 0 0]      0.016;  // L = 0.08 m
    Cc              Cc    [0 0 0 0 0 0 0]      1;
    Cv              Cv    [0 0 0 0 0 0 0]      1;
}
SchnerrSauerCoeffs
{
    n                n      [0 -3 0 0 0 0 0]    1.6e+13;
    dNuc          dNuc  [0 1 0 0 0 0 0]    2.0e-06;
    Cc              Cc    [0 0 0 0 0 0 0]      1;
    Cv              Cv    [0 0 0 0 0 0 0]      1;
}

In my results the temperature is going to a maximum of 370K when a value of 300.15K is specified on the right and bottom walls. Any idea where the error is???

abe April 8, 2013 07:38

Which version of openfoam do you use?
Have you been able to get good results from new versions of OF (i.e. 2.1 or 2.2)?

ABE

Jibran April 10, 2013 05:52

I am using 2.1 however compressibleInterFoam of 2.2 might be a good starting point as it solves for energy equation.

abe April 10, 2013 05:56

Hi Jibran,

do you simulate cavitation?

Jibran April 10, 2013 06:36

Hi. I am working on interfacial evaporation and condensation. Are you doing something similar?

abe April 10, 2013 07:37

I think, the method used in interPhasechange solver is a relatively different. In this case evaporation or condensation can occur anywhere which has pressure lower than saturation pressure. While in the interfacial method, phase change just occur in the interface of the two phases (am I right?)

Jibran April 10, 2013 09:17

Yes that is correct. Therefore I am using a modified phase change model. By including terms such as "alpha1*(1-alpha1)" in the phase change equations one can ensure that the evaporation and condensation takes place just at the interface.

abe April 10, 2013 09:26

Do you have get any results?
are the both phases considered compressible or just the vapor phase?

Jibran April 15, 2013 05:29

I have some results which seem to be reasonable.
However, I need to validate them.
Yes both phases are compressible.

mecman September 19, 2013 00:48

Quote:

Originally Posted by Jibran (Post 402643)
Dear All,

Has anyone sucessfully implemented the temperature equation in interphaseChangeFoam?? I followed 'A interphasechangeFoam tutorial by Martin Andersen' but the results seem to be quite inaccurate. I have attached the relevant files below.

ALPHA1
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "0";
    object      alpha;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 0 0 0 0 0 0];
internalField  uniform 0;
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
   
    right_wall
    {
        type            constantAlphaContactAngle;
        theta0          10;
        limit  gradient;
        value          uniform 0;
    }
   
    lower_wall
    {
        type            zeroGradient;
    }
   
    atmosphere
    {
        type  zeroGradient;   
    }
   
    default_faces
    {
        type            empty;
    }
}



P_RGH
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "0";
    object      p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [1 -1 -2 0 0];
internalField  uniform 100000;
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
   
    right_wall
    {
        type            fixedFluxPressure;
        adjoint        no;
    }
   
    lower_wall
    {
        type            buoyantPressure;
    }
   
    atmosphere
    {
        type            fixedValue;
        value          uniform 100000;
    }
   
    default_faces
    {
        type            empty;
    }
}


T
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "0";
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 0 0 1 0]; // [K]
internalField  uniform 280.15;
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
   
    right_wall
    {
        type            fixedValue;
        value        uniform 300.15;
    }
   
    lower_wall
    {
        type            fixedValue;
        value        uniform 300.15;
    }
   
    atmosphere
    {
        type            fixedValue; 
        value        uniform 280.15;
    }
    default_faces
    {
        type            empty;
    }
}


U
Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 1 -1 0 0];
internalField  uniform (0 0 0);
boundaryField
{
    axis
    {
        type            symmetryPlane;
    }
    right_wall
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
    lower_wall
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
    atmosphere
    {
        type            fixedValue;       
        value          uniform (0 0 0);
    }
   
    default_faces
    {
        type            empty;
    }
}


TRANSPORT PROPERTIES
Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phaseChange on;
 
phaseChangeTwoPhaseMixture Kunz;
 
sigma          sigma  [1 0 -2 0 0 0 0] 0.07;
 
DT  DT  [0 2 -1 0 0 0 0] 0.02; // [m^2/s]
 
phase1
{
    transportModel Newtonian;
    nu              nu [0 2 -1 0 0 0 0] 5.5e-07;
    rho            rho [1 -3 0 0 0 0 0] 988;
}
 
phase2
{
    transportModel Newtonian;
    nu              nu [0 2 -1 0 0 0 0] 4.273e-04;
    rho            rho [1 -3 0 0 0 0 0] 0.02308;
}
KunzCoeffs
{
    UInf            UInf  [0 1 -1 0 0 0 0]    5.0;
    tInf            tInf  [0 0 1 0 0 0 0]      0.016; // L = 0.08 m
    Cc              Cc    [0 0 0 0 0 0 0]      100;
    Cv              Cv    [0 0 0 0 0 0 0]      100;
}
MerkleCoeffs
{
    UInf            UInf  [0 1 -1 0 0 0 0]    5.0;
    tInf            tInf  [0 0 1 0 0 0 0]      0.016;  // L = 0.08 m
    Cc              Cc    [0 0 0 0 0 0 0]      1;
    Cv              Cv    [0 0 0 0 0 0 0]      1;
}
SchnerrSauerCoeffs
{
    n                n      [0 -3 0 0 0 0 0]    1.6e+13;
    dNuc          dNuc  [0 1 0 0 0 0 0]    2.0e-06;
    Cc              Cc    [0 0 0 0 0 0 0]      1;
    Cv              Cv    [0 0 0 0 0 0 0]      1;
}

In my results the temperature is going to a maximum of 370K when a value of 300.15K is specified on the right and bottom walls. Any idea where the error is???

Hi Jibran and abe
Do you modified youre solver (interPhasechangrFoam) by adding T.eqn and source term?i want simulate evaporation and condensation and i use interPhasechangeFoam solver.i implemented the temperature equation( A interphasechangeFoam tutorial by Martin Andersen) but i dnt know how modified the solver by source term and T.eqn for phase change with increasing Temperature.

Kanarya June 2, 2015 07:52

Hi All,

I am trying to simulate condensation with interPhaseChangeFoam by adding scalar T. But it gives me the following error:
PHP Code:

time step continuity errors sum local 1.15855e-05, global = -1.19144e-16cumulative = -1.19144e-16
GAMG
:  Solving for pcorrInitial residual 1, Final residual 3.48266e+19No Iterations 50
GAMG
:  Solving for pcorrInitial residual 0.965555, Final residual 1.08509e+21No Iterations 50
time step continuity errors 
sum local 4.51124e+35, global = -1.41141e+28cumulative = -1.41141e+28
Courant Number mean
3.09991e+35 max5.41686e+38

Starting time loop

Courant Number mean
0.00057227 max1
deltaT 
1.84609e-47
Time 
1.84609e-47

#0  Foam::error::printStack(Foam::Ostream&) in "/usr/local/OpenFOAM/OpenFOAM-2.1.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/usr/local/OpenFOAM/OpenFOAM-2.1.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  
 
at sigaction.c:0
#3  
 
in "/home/links/rek209/OpenFOAM/rek209-2.1.0/platforms/linux64GccDPOpt/bin/myInterPhaseChangeFoam"
#4  
 
in "/home/links/rek209/OpenFOAM/rek209-2.1.0/platforms/linux64GccDPOpt/bin/myInterPhaseChangeFoam"
#5  
 
in "/home/links/rek209/OpenFOAM/rek209-2.1.0/platforms/linux64GccDPOpt/bin/myInterPhaseChangeFoam"
#6  __libc_start_main in "/lib64/libc.so.6"
#7  
 
in "/home/links/rek209/OpenFOAM/rek209-2.1.0/platforms/linux64GccDPOpt/bin/myInterPhaseChangeFoam"
Floating point exception 

I am using following BC:
for p_rhg:
PHP Code:

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

dimensions      [--2 0 0 0 0];

internalField   uniform 1e5;

boundaryField
{
    
inlet
    
        
{
         
type            zeroGradient;
    }
    

   
outlet
    
{
        
type            fixedValue;
        
value           $internalField;
    }

    
  
hot_wall
    
{
         
type           fixedFluxPressure;
adjoint no;
    }
    
ocold_wall
   
{
         
type           fixedFluxPressure;
adjoint no;
    }
    
icold_wall
    

        
type           fixedFluxPressure;
adjoint no;
    }

}

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

for alpha1:
PHP Code:

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

dimensions      [0 0 0 0 0];

internalField   uniform 0.00001;

boundaryField
{
    
inlet
    
{
         
type            fixedValue;
        
value           $internalField;
    }

    
outlet
    
{
        
type            inletOutlet;
        
inletValue      $internalField;
    }

    
    
hot_wall
    
{
        
type            zeroGradient;
    }
    
icold_wall
    
{
        
type            zeroGradient;
    }
    
ocold_wall
    
{
        
type            zeroGradient;
    }

}

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

and for U
PHP Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    
version     2.0;
    
format      ascii;
    class       
volVectorField;
    
object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 5.199);

boundaryField
{
    
inlet
    
{
        
type            fixedValue;
        
value           $internalField;
    }

    
outlet
{
        
type            pressureInletOutletVelocity;
        
phi             phi;
        
value           $internalField;
}
    
hot_wall
    
{
        
type            fixedValue;
        
value           uniform (0 0 0);
    }

 
ocold_wall
    
{
        
type            fixedValue;
        
value           uniform (0 0 0);
    }
icold_wall
    
{
        
type            fixedValue;
        
value           uniform (0 0 0);
    }

}

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

and fr T

PHP Code:

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

dimensions      [0 0 0 1 0 0 0];

internalField   uniform 366.85;

boundaryField
{
    
hot_wall
    
{
         
type            fixedValue;
        
value           uniform 293.15;
    }
   
ocold_wall
    
{
         
type            zeroGradient;
        
    }
icold_wall
    
{
         
type            zeroGradient;

    }

    
inlet
    
{
        
type            fixedValue;
        
value           uniform 366.85;
    }
    
outlet
    
{
        
type            zeroGradient;
    }
}

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

I am using version 2.1.0 for it...
can you hep me to fix the problem?

thanks!

Kanarya June 2, 2015 09:33

Hi Jibran,

Did you add this term (alpha1*(1-alpha1)) to alphaEqn.H?
Did you get the results?

Thanks

Quote:

Originally Posted by Jibran (Post 419631)
Yes that is correct. Therefore I am using a modified phase change model. By including terms such as "alpha1*(1-alpha1)" in the phase change equations one can ensure that the evaporation and condensation takes place just at the interface.


gaza June 17, 2015 05:10

Hi Kanaraya
It would be better to use OF2.3.
You can try to decrease Courant number. If you use model from Andersen tutorial it give you wrong results. I try to do use his model for condensation on vertical wall and solver always crashed. It is due to bad model for mass flux.

Kanarya June 17, 2015 05:19

Hi Gaza,
thanks for your reply!
Did you manage to get another model?
Or how did you solve your problem?

thanks!

Quote:

Originally Posted by gaza (Post 550715)
Hi Kanaraya
It would be better to use OF2.3.
You can try to decrease Courant number. If you use model from Andersen tutorial it give you wrong results. I try to do use his model for condensation on vertical wall and solver always crashed. It is due to bad model for mass flux.


gaza June 17, 2015 10:47

Hi Kanarya,
I did not solve my problem. I only know that interPhaseChangeFoam is good for cavitation mass transfer models. For heat transfer one has to change the main code a bit and write own functions
for mDotAlphal and mDotP.
Solver is constructed in that way that in alpha equation (alphaEqn.H) condensation mass flux is multiplied by (1 - alpha) and evaporation mass flux is multiplied by alpha. So you have to: 1) adjust your implementation for mass fluxes to the solver or 2) implement them as they should be and change the solver (alpha eqn. and lines in MULES where vDot variables are used).
The same is true about mDotP function.

I think that it would be better to implement model based on TSat not for pSat.


All times are GMT -4. The time now is 03:58.