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

adding gravity term in pisoFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 3, 2015, 01:41
Question adding gravity term in pisoFoam
  #1
New Member
 
Chaewoong Ban
Join Date: Jun 2013
Posts: 18
Rep Power: 12
blue8803 is on a distinguished road
Hi

I'm being set up the LES model for the channel flows.

At first, I refer to channelFoam. However, in its driving force for the flows is pressure gradients. but I would like to consider the gravity term for the driving force.

So, I added a new term to the original pisoFoam. But I'm not sure my attempt.
My code is as follows. I'll thank you any advice.

## pisoFoam.c
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

#include "readPISOControls.H"
#include "CourantNo.H"

// Pressure-velocity PISO corrector
{
// Momentum predictor

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
// ==
// Gravity
);

UEqn.relax();

if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p)+Gravity2); //corrected
}

// --- PISO loop

for (int corr=0; corr<nCorr; corr++)
{
volScalarField rAU(1.0/UEqn.A());

volVectorField HbyA("HbyA", U);
HbyA = rAU*(UEqn.H()+Gravity2); //corrected
surfaceScalarField phiHbyA
(
"phiHbyA",
(fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
);

adjustPhi(phiHbyA, U, p);

// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
// Pressure corrector

fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);

if
(
corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver("pFinal"));
}
else
{
pEqn.solve();
}

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

// #include "continuityErrs.H"

U = HbyA - rAU*(fvc::grad(p));
U.correctBoundaryConditions();
}
}


##createFiedls.H

volVectorField Gravity2
(
IOobject
(
"Gravity2",
runTime.constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh,
dimensionedVector("Gravity2", dimensionSet(0,1,-2,0,0,0,0),vector(0,-9.81,0))
);
blue8803 is offline   Reply With Quote

Reply

Tags
channel flows, gravity force, source term


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
Boundary condition setting for adding gravity in simpleFoam norkistar OpenFOAM Programming & Development 3 June 15, 2022 04:20
Adding an energy source term to a phase with reactions lxlxlxt Fluent Multiphase 0 February 10, 2014 20:42
Gravity source term in PisoFoam DanM OpenFOAM Running, Solving & CFD 4 May 24, 2013 11:30
Gravity source term in PisoFoam DanM Main CFD Forum 0 November 28, 2012 12:59
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45


All times are GMT -4. The time now is 23:44.