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

Natural Convection with icoFoam

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 23, 2012, 17:03
Default Natural Convection with icoFoam
  #1
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Hey Foamers

I have added energy equation to icoFoam, and I am solving natural convection in cavity. The problem is that as I am using smaller and smaller time steps, the velocities become smaller and smaller, and I can not get a results which is independent of time step.

So do you have any ideas to help me getting time step independent results?
hawkeye321 is offline   Reply With Quote

Old   July 24, 2012, 04:23
Default
  #2
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
dear mahdi
do you add temperature truly?
it seams that your solver has a problem.
you should attach your solver. it is hard to make decision without looking to your solver
niaz is offline   Reply With Quote

Old   July 24, 2012, 10:43
Default
  #3
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Dear Niyaz

this is my solver

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

Application
icoFoam

Description
Transient solver for incompressible, laminar flow of Newtonian fluids.

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"

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

int main(int argc, char *argv[])
{
#include "setRootCase.H"

#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"

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

Info<< "\nStarting time loop\n" << endl;

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

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

fvVectorMatrix UEqn
(
(Density)*fvm::ddt(U)
+ (Density)*fvm::div(phi, U)
- (Visc)*(fvm::laplacian(U))
);

solve(UEqn == GravityVector*g*Density*(BetaT*(T-TNot)) - (fvc::grad(p)));
//solve(UEqn == -fvc::grad(p));
// --- PISO loop

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

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

adjustPhi(phi, U, p);

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"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
}
fvScalarMatrix TEqn
(
Density*Cp*fvm::ddt(T)
+ Density*Cp*fvm::div(phi, T)
- Cond*(fvm::laplacian(T))
);
TEqn.solve();

//F = Gravity*(1-Beta*(T-TemAmb));
///////////
fvScalarMatrix CEqn
(
fvm::ddt(C)
+ fvm::div(phi, C)
);
CEqn.solve();
///////////

// forAll( h, celli)
// {
// T[celli] = (h[celli] - 1)/Ste.value();
//T[celli] = (h[celli] - L.value())/Cp.value();
// h[celli] = 1 + (Ste.value()*T[celli]);
// h[celli] = (Cp.value()*T[celli]) + L.value();

// }
///////////
//F = (GravityVector*Pr*T)-(GravityVector*Le*C);
//F = gl*GravityVector*g*Density*(1-BetaT*(T-TNot));
F = GravityVector*g*Density*(BetaT*(T-TNot));
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************** *********************** //
hawkeye321 is offline   Reply With Quote

Old   July 24, 2012, 11:26
Default
  #4
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
your changes are strange.
for U:
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
==
-beta*(T - T0)*g
);
for T:
solve
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
);

where nu is viscosity and DT is conductivity
your equation seems have a problem.
niaz is offline   Reply With Quote

Old   July 24, 2012, 13:01
Default
  #5
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Hi niaz
Thanks for your comments. I tried with the new equations, but still have problem with dt. any more comments?
hawkeye321 is offline   Reply With Quote

Old   July 24, 2012, 15:41
Default
  #6
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
solve(UEqn == GravityVector*g*Density*(BetaT*(T-TNot)) - (fvc::grad(p)));
I think that before the GravityVector, you should have (-)
niaz is offline   Reply With Quote

Old   July 24, 2012, 15:45
Default
  #7
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Thank you. But it will not fix the problem. It will only change the direction of U and V.
hawkeye321 is offline   Reply With Quote

Old   July 24, 2012, 16:09
Default
  #8
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
Can you show a contour of two results?
your case is a bit strange.
niaz is offline   Reply With Quote

Old   July 24, 2012, 16:10
Default
  #9
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
at first, I suggest you to solve a forced convection to prove the exactness of the solver then add boussinesqe term to equation.
niaz is offline   Reply With Quote

Old   July 26, 2012, 14:07
Default
  #10
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
I fixed the problem.
The key is
in order to get a proper behavior of velocity-pressure coupling in PISO algorithm, I should include the source term inside the velocity equation such that

fvVectorMatrix UEqn
(

fvm::ddt(U)

+fvm::div(phi,U)

-fvm::laplacian(ModifVisc,U)

==

GravityVector*betaT*(T-Tnot)

);

solve(UEqn == -fvc::grad(p) );
hawkeye321 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
natural convection problem with radiation jorien CFX 0 October 14, 2011 09:26
Natural Convection Problem - Helium marzoa STAR-CCM+ 0 April 18, 2011 14:12
Coupled vs Seg - Natural vs. Forced Convection Alex CD-adapco 5 December 12, 2007 05:58
Mixing By Natural Convection Processes Greg Perkins FLUENT 0 February 12, 2003 19:40
natural convection in a sealed enclosure James Main CFD Forum 4 April 2, 2001 15:48


All times are GMT -4. The time now is 21:36.