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

Solving rho instead of p

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2018, 03:49
Default Solving rho instead of p
  #1
Member
 
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 8
Benben is on a distinguished road
Hello, i am trying to modify reactingFoam in openFoam 6.0 in order to solve rho, then calculate p=f(rho,T).

I want to make a compressible solver with gravity and species transport (+ some annoying specific things). As I am not very comfortable with the pressure equation (to add a mass source term is painfull), i want to solve rho, and calculate p with the perfect gas equation.

I modified the main loop as follow:

Code:
while (pimple.loop())
{
    while (pimple.correct())
    {
        #include "./rhoEqn.H"
        Info << rho << endl;//display for debug
        scalar M = thermo.composition().W(0);//The molar mass of the mixture
        p = rho/(psi*M);//P = rho*R*T/M = C*R*T = n*R*T/V
        p.correctBoundaryConditions();
        #include "./UEqn.H"
    }
    #include "compressibleContinuityErrs.H"
    #include "./YEqn.H"
    #include "./EEqn.H"
    if (pimple.turbCorr())
    {
        turbulence->correct();
    }
}
Here are my two problems:
  • I have no boundary condition on rho (they are defined for p only), what happens when i solve rho ? Can i correct rho at the boundary using the boundary conditions applied to p ?
  • Why is my rho value reseted ? During the pimple.correct loop, rho is calculated, bu on paraview rho is always the same. Is it due to the thermo.correct() in EEqn.H ?
Benben is offline   Reply With Quote

Old   December 11, 2018, 05:53
Default
  #2
Member
 
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 8
Benben is on a distinguished road
Actually the pressure should be calculated as:
Code:
p = rho/psi
Because psi seems to be M/(R*T).

I tried to solve rho without applying any boundary conditions, and then correcting the density at the boundary using the value of the pressure at the boundary. But this obviously didnt work, for example i have flows through walls.
Benben is offline   Reply With Quote

Old   December 11, 2018, 07:50
Default
  #3
Member
 
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 8
Benben is on a distinguished road
It seems that to solve this correctly i would have to use some boundary conditions on rho instead of p, which is very unpractical. (fixed pressure outlet needs a conversion using ideal gas law for example).
I will stick to presure based equations.
Benben 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
Segmentation fault when using reactingFOAM for Fluids Tommy Floessner OpenFOAM Running, Solving & CFD 4 April 22, 2018 12:30
chtMultiRegionSimpleFoam turbulent case Aditya Patil OpenFOAM Running, Solving & CFD 6 April 24, 2017 22:13
HeatSource BC to the whole region in chtMultiRegionHeater xsa OpenFOAM Running, Solving & CFD 3 November 7, 2016 05:07
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 13:12
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 06:37


All times are GMT -4. The time now is 19:46.