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

energy equation for porousSimpleFoam

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 4, 2013, 10:42
Default energy equation for porousSimpleFoam
  #1
Member
 
mohsen kh
Join Date: Jan 2013
Posts: 85
Rep Power: 4
m5m5kh is on a distinguished road
Hi dear foamers
I wrote a TEqn for my solver.
the formula is something like thisA. Bejan Convection Heat Transfer,2nd edition, pages 571,575,576)

-dp/dx = [(mu/K) (u)] + [rho*beta*U^2] (darcy-forcheheimer)

and the energy equation is something like this

rho(fluid)*Cp(fluid)[sigma dT/dt + UdT/dx]=k d2T/dx2 + q'" + (mu/K) u^2

k and sigma are:

k= (porosity*kf) + (1- porosity)*ks

Sigma = [porosity(rho*cp)fluid+(1-porosity)*(rho)solid]/(rho*cp)f

for my case there is no heat generation and also I ignored the last term which shows viscous dissipation.
omitting Q"' and (mu/K) u^2, we have :

rho(fluid)*Cp(fluid)[sigma dT/dt + UdT/dx]=k d2T/dx2

dividing both sides of equation to rho(fluid)*Cp(fluid) we have:

[sigma dT/dt + UdT/dx]=alpha d2T/dx2

alpha= k / rho(fluid)*Cp(fluid)

I have all the properties of solid and fluid and porosity,so I can easily define alpha,sigma.I wrote my TEqn.H file like this


// Solve the Energy equation
{
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(alpha, T)
);
TEqn.solve();

}


I modified createFields.H file either.I defined alpha and sigma in transportProperties file and ask the code to read them from there.


Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

dimensionedScalar sigma
(
transportProperties.lookup("sigma")
);
dimensionedScalar alpha
(
transportProperties.lookup("alpha")
);

Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);



#include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);

singlePhaseTransportModel laminarTransport(U, phi);

autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
);

and finally my code is something like this,I used include TEqn.H out of simple loop.


/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ 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
porousSimpleFoam

Description
Steady-state solver for incompressible, turbulent flow with
implicit or explicit porosity treatment and support for multiple reference
frames (MRF)

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

#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "simpleControl.H"
#include "IOMRFZoneList.H"
#include "IOporosityModelList.H"
#include "fvIOoptionList.H"

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

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

simpleControl simple(mesh);

#include "createFields.H"
#include "createFvOptions.H"
#include "createZones.H"
#include "initContinuityErrs.H"

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

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

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

// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "pEqn.H"
}

turbulence->correct();

#include "TEqn.H"

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}


// ************************************************** *********************** //
I defined fvscheme and fvsolution file for T equation but I did not understand why this code give me wrong data.

would you please help me in this case,I'm really confused
every suggestion would be greatly appreciated.
if anyone has an experienced in this case please send me his/her email.

best regards
Mohsen
m5m5kh is offline   Reply With Quote

Old   September 4, 2013, 10:46
Default error after run
  #2
Member
 
mohsen kh
Join Date: Jan 2013
Posts: 85
Rep Power: 4
m5m5kh is on a distinguished road
this error happened after running the code




Time = 0.014

GAMG: Solving for p, Initial residual = 0.964789, Final residual = 0.0417207, No Iterations 17
time step continuity errors : sum local = 2.99708e+12, global = 2.90211e+11, cumulative = 2.90211e+11
DILUPBiCG: Solving for T, Initial residual = 0.994907, Final residual = 0.0487249, No Iterations 22
ExecutionTime = 5.1 s ClockTime = 5 s

Time = 0.015

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam220/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/opt/openfoam220/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 at tensorField.C:0
#4
in "/home/vaio/OpenFOAM/vaio-2.2.0/platforms/linux64GccDPOpt/bin/newPorousSimpleFoam"
#5
in "/home/vaio/OpenFOAM/vaio-2.2.0/platforms/linux64GccDPOpt/bin/newPorousSimpleFoam"
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7
in "/home/vaio/OpenFOAM/vaio-2.2.0/platforms/linux64GccDPOpt/bin/newPorousSimpleFoam"
Floating point exception (core dumped)
vaio@vaio-SVE14122CVW:~/OpenFOAM/vaio-2.2.0/run/m$
m5m5kh 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
energy equation in rhoCentralFoam nakul OpenFOAM 0 October 10, 2010 15:07
Pohlhausen energy equation MATLAB help abe_cooldude Main CFD Forum 2 May 3, 2010 16:58
SIMPLE and energy equation convergence Fabio Main CFD Forum 0 June 1, 2007 06:06
How to discretize of energy equation ?? Asghari FLUENT 0 October 12, 2006 08:09
energy equation formulation Pedro Phoenics 1 July 5, 2001 12:17


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