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

New Utilities

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 3, 2007, 21:33
Default Hi All, I am having a littl
  #1
Member
 
Shaun Cooper
Join Date: Mar 2009
Posts: 54
Rep Power: 17
coops is on a distinguished road
Hi All,

I am having a little trouble with the results that I am getting from my model at the moment. I would like to try and chase down which terms in the equations may be causing the issues, therefore I would like to post-process each of the term in the initial equations.

1) is it possible to do this?

I have played with some post-processing with the velocity field which was easy but now I am interested in the energy equation terms.

For example I would like to look at the value of the following term:

fvm::div(phi, e)

This is the code that I am using at the moment:



/*---------------------------------------------------------------------------*\
========= |
\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\ / O peration |
\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Application
Ucomponents

Description
Writes the three scalar fields, Ux, Uy and Uz, for each component of the
velocity field U for each time

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

#include "fvCFD.H"

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

int main(int argc, char *argv[])
{

# include "addTimeOptions.H"
# include "setRootCase.H"

# include "createTime.H"

// Get times list
instantList Times = runTime.times();

// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"

runTime.setTime(Times[startTime], startTime);

# include "createMesh.H"
# include "readThermodynamicProperties.H"
# include "readTransportProperties.H"

for (label i=startTime; i<endTime; i++)
{
runTime.setTime(Times[i], i);

Info<< "Time = " << runTime.timeName() << endl;

IOobject Theader
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);

IOobject Uheader
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);


IOobject rhoheader
(
"rho",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);

// Check U exists
if (Theader.headerOk() && Uheader.headerOk() )
{
mesh.readUpdate();

Info<< " Reading T" << endl;
volScalarField T(Theader, mesh);

Info << " Reading U" << endl;
volVectorField U(Uheader, mesh);

Info << " Reading rho" << endl;
volScalarField rho(rhoheader, mesh);

Info << " Calculating phi" << endl;
surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
linearInterpolate(rho*U) & mesh.Sf()
);

Info << " Calculating e" << endl;
volScalarField e
(
IOobject
(
"e",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
Cv*T
);

Info << " Calculating div(phi, e)" << endl;
volScalarField div_phi_e
(
IOobject
(
"div_phi_e",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
fvm::div(phi, e)
);

}
else
{
Info<< " No T" << endl;
}

Info<< endl;
}

return(0);
}


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

I am able to read in the various field and calcuate some of them but when I want to calculate div_phi_e I get an error.

I think it is because it is not a volScalarField becuase I am trying to take the divergence of a field that is not a volVectorField, but I don't know what else it should be, or if it is even possible to compute!!!

Many Thanks,

Shaun
coops is offline   Reply With Quote

Old   July 4, 2007, 05:21
Default Have a look at chapter 2.4 of
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Have a look at chapter 2.4 of the Programmer's Guide: Equation discretizations. What you're looking for is fvc::div. The explanation is found there.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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
How to make utilities Parallel aware philippose OpenFOAM 5 October 20, 2011 10:41
New proSTAR%2360OpenFOAM conversion utilities olesen OpenFOAM 18 June 22, 2010 04:07
Proposal for an extension for the timeoptions of Utilities gschaider OpenFOAM Bugs 5 August 26, 2008 20:13
Utilities to download for research/programmers For those who favor open-source Main CFD Forum 0 September 21, 2006 17:03
Running utilities for a given time step melanie OpenFOAM Running, Solving & CFD 2 March 10, 2006 08:28


All times are GMT -4. The time now is 10:34.