CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to plot a gradient. (http://www.cfd-online.com/Forums/openfoam-programming-development/66145-how-plot-gradient.html)

Bedotto July 7, 2009 05:17

How to plot a gradient.
 
Hi all,

in my study about a turbulent couette flow (including the energy equation for an incompressible flow) I would like to plot the heat flux in paraFoam (like U for instance). That's equivalent to plot the gradient of the temperature T. That's why I've tried to create a new field I call "gradT" which is a Volume vector Field and I've tried to solve the equation "gradT"=fvc::grad(T). But it doesn't work(It nevers works the first time ;)) and I receive the following error mesage:

Beta.C: In function ‘int main(int, char**)’:
Beta.C:140: error: no matching function for call to ‘Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::tmp<Foam::GeometricField<Foam::V ector<double>, Foam::fvPatchField, Foam::volMesh> >)’

And I want to solve the following equation:
fvVectorMatrix gradTEqn
(
gradT
- fvc::grad(T)
);

gradTEqn.solve();

Maybe is there a better way to plot the gradient? I hope you will have some hints concerning my operator error message.

My regards
Quentin

P.S: I'm not sure if that's the good section of the forum.

santos July 7, 2009 09:48

Hi,

Try this:

Code:

volVectorField gradT
(
  IOobject
  (
    "gradT",
    runTime.timeName(),
    mesh,
    IOobject::NO_READ,
    IOobject::AUTO_WRITE
  ),
  fvc::grad(T)
);

Regards,
Jose Santos

Bedotto July 8, 2009 03:57

Thanks Santos that was the command I required.


All times are GMT -4. The time now is 19:29.