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

Adding of source term in momentum equation required any changes in PISO algorith

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2017, 04:25
Smile Adding of source term in momentum equation required any changes in PISO algorith
  #1
New Member
 
shadab ilahi
Join Date: Aug 2016
Posts: 11
Rep Power: 9
shadabdyn is on a distinguished road
Hello everyone,

I need to add the gravity settling effect delrho*g*phi to the existing self-made code. and I am using the Piso algorithm. so I added delrho*g*phi at the solve momentum predictor step. here I choose g as a volume vector defined in the create field properties simultaneously additional initial property in 0 folder of the case directory and density difference as constant transport properties ( dimensional scalar in create property.h file). when I compile the Source code it is running fine without any error..when I run twice it is showing up to date.
So I am asking that what I have done is correct or not. I am adding my source code also below. I am attaching a picture of my governing equation also.

// Pressure-velocity PISO corrector
for (int corr=0; corr<nCorr; corr++)
{
// Momentum predictor

tmp<fvVectorMatrix> UEqn
(

- fvm::laplacian(nu1, U) -fvc::div(nu1*dev(fvc::grad(U)().T())) -fvc::div(SigmaL)
);

UEqn().relax();

solve(UEqn() == -fvc::grad(p)+delrhog*c); //+delrhog*c

p.boundaryField().updateCoeffs();
volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H();
UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);

// Store pressure for under-relaxation
p.storePrevIter();

// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();

if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}

# include "continuityErrs.H"

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

// Momentum corrector
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
}


up to best of my knowledge we should'nt add I source term at momentum corrector step?
Thanks in advance.
shadabdyn is offline   Reply With Quote

Old   January 14, 2017, 22:39
Default
  #2
Senior Member
 
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13
pbachant is on a distinguished road
Looks like your image isn't showing up. Also, please put your code in the [CODE] blocks so it's in monospace font with indentation.
__________________
Home | Twitter | GitHub
pbachant is offline   Reply With Quote

Old   January 15, 2017, 01:16
Default
  #3
New Member
 
shadab ilahi
Join Date: Aug 2016
Posts: 11
Rep Power: 9
shadabdyn is on a distinguished road
Thank u pbachant for your reply. I hope now this image and code could help u to understand my problem.
Code:
        // Pressure-velocity SIMPLE corrector
        for (int corr=0; corr<nCorr; corr++)
        {



            // Momentum predictor

            tmp<fvVectorMatrix> UEqn
            (
    
               - fvm::laplacian(nu1, U) -fvc::div(nu1*dev(fvc::grad(U)().T())) -fvc::div(SigmaL)
            );

            UEqn().relax();

            solve(UEqn() == -fvc::grad(p)+delrhog*c);  //+delrhog*c

            p.boundaryField().updateCoeffs();
            volScalarField rUA = 1.0/UEqn().A();
            U = rUA*UEqn().H();
            UEqn.clear();
            phi = fvc::interpolate(U) & mesh.Sf();
            adjustPhi(phi, U, p);

            // Store pressure for under-relaxation
            p.storePrevIter();

            // Non-orthogonal pressure corrector loop
            for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
            {
                fvScalarMatrix pEqn
                (
                    fvm::laplacian(rUA, p) == fvc::div(phi)
                );

                pEqn.setReference(pRefCell, pRefValue);
                pEqn.solve();

                if (nonOrth == nNonOrthCorr)
                {
                    phi -= pEqn.flux();
                }
            }

#           include "continuityErrs.H"

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

            // Momentum corrector
            U -= rUA*fvc::grad(p);
            U.correctBoundaryConditions();
        }
Attached Images
File Type: png governing_eqn.PNG (6.7 KB, 72 views)
shadabdyn 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
Adding a Source Term to Pressure equation pEqn in SimpleFoam oscar_urri OpenFOAM 11 February 22, 2018 17:52
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 09:17
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44
Derivation of Momentum Equation in Integral Form Demonwolf Main CFD Forum 2 October 29, 2009 19:53


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