CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Question about field defintion (http://www.cfd-online.com/Forums/openfoam-solving/65933-question-about-field-defintion.html)

titio July 1, 2009 10:12

Question about field defintion
 
I have a question concerning the definition of fields, either vectorial or tensorial, for CFD calculations. In
particular, during my calculations I have to calculate the gradient of velocity field, by defintion a volVectorField,
using the formula

DU = fvc :: grad (U);

Both DU and U are defined in the file createFields.H, in the following form

// Reading the velocity field

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

Info<< "Creating Velocity Gradient Tensorial Field\n" << endl;
volTensorField DU
(
IOobject
(
"DU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::grad(U)
);

This way, I ensure that in each mesh point I calculate correctly DU, right?

Other form could be doing the following

volTensorField DU = fvc :: grad ( U() );

I believe the first form is correct, although the second may work. Can anybody help me out?

Regards,

Titio

henrik July 6, 2009 06:39

Dear Titio,

Both forms are possible and the second will work if you delete the brackets on U.

volTensorField DU = fvc::grad (U);

Henrik


All times are GMT -4. The time now is 16:00.