CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Conservative form of Navier Stokes equation.

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 23, 2012, 01:43
Default Conservative form of Navier Stokes equation.
  #1
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 122
Rep Power: 8
balkrishna is on a distinguished road
Hi,

I wish to modify the pimpleFoam solver for varying density. As a first step, I decided to change the momentum equation to the conservative form. To do so I changed the momentum equation to
Code:
    fvVectorMatrix UEqn
    (
     fvm::ddt(rho, U) + 
     fvm::div(phi, U)
     - fvm::laplacian(mu, U)
     - fvc::div(mu*dev2(fvc::grad(U)().T()))
    );
here rho is declared as a volScalarField. The pressure equation is coded in the following way :
Code:
{

    Info<<" In the most dreaded pEqn "<<endl;
    volScalarField rUA = 1.0/UEqn.A();
    surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));

    U = rUA*UEqn.H();

    phi = fvc::interpolate(rho)*
    (
        (fvc::interpolate(U) & mesh.Sf())
      + fvc::ddtPhiCorr(rUA, rho, U, phi)
    );

    surfaceScalarField buoyancyPhi = -rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
    phi += buoyancyPhi;


    for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
    {
        fvScalarMatrix p_rghEqn
        (
            fvc::ddt(rho) +                                                                                                       
           fvc::div(phi)
          - fvm::laplacian(rhorUAf, p_rgh)
        );

        p_rghEqn.solve
        (
            mesh.solver
            (
                p_rgh.select
                (
                    (
                        finalIter
                     && corr == nCorr-1
                     && nonOrth == nNonOrthCorr
                    )
                )
            )
        );

        if (nonOrth == nNonOrthCorr)
        {
            // Calculate the conservative fluxes                                                                                                                                   
            phi += p_rghEqn.flux();

            // Explicitly relax pressure for momentum corrector                                                                                                                    
            p_rgh.relax();

            // Correct the momentum source with the pressure gradient flux                                                                                                         
            // calculated from the relaxed pressure                                                                                                                                
            U += rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf);
        }                                                                                                                                                                          
    }                                                                                                                                                                              
                                                                                                                                                                                   
    p = p_rgh + rho*gh;                                                                                                                                                            
                                                                                                                                                                                   
                                                                                                                                  

    DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
As a first test I decided to simulate for a case of non changing density for a pipe flow.My rho is specified in the following manner.
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.7.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 1000;

boundaryField
{
    outlet
    {
        type            fixedValue;
        value           uniform 1000;
    }
    inlet
    {
        type            fixedValue;
        value           uniform 1000;
    }
    wall
    {
      type            fixedValue;
      value           uniform 1000;
    }
    frontBack
    {
        type            empty;
    }
}


// ************************************************************************* //
0/rho (END)
This gives highly unphysical results as far as the velocity profiles are concerned. Could someone tell me where I might be going wrong in the momentum equation or pressure equation ?
balkrishna is offline   Reply With Quote

Old   January 24, 2012, 12:22
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
Take a look at rhoPimpleFoam, and for a solver using p_rgh, you could take a look at buoyantPimpleFoam.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   January 25, 2012, 09:33
Default Solved.
  #3
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 122
Rep Power: 8
balkrishna is on a distinguished road
thanks for d help.
balkrishna is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a term to Navier Stokes Equation ashtonJ CFX 3 January 15, 2011 07:32
coupling KE equation with navier stokes equation prashant FLUENT 0 March 7, 2008 08:05
Full navier stokes Equation descretized form rawin Main CFD Forum 1 September 21, 2005 12:42
Newbie:Viscoelasticity and Navier stokes equation Rajil Saraswat Main CFD Forum 2 June 9, 2003 07:21
1-d navier stokes equation Robert Main CFD Forum 0 December 20, 2002 03:14


All times are GMT -4. The time now is 00:15.