CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   volVolumeField from volSurfaceField (

Zato_Ichi April 13, 2011 13:53

volVolumeField from volSurfaceField
Greetings !

To make a volVolumeField consisting of 3 volScalarField i tried this code? but it doesn't work.


volTensorField gradq = fvc::grad(q);

volScalarField qx = gradq.component(vector::X);
volScalarField qy = gradq.component(vector::Y);
volScalarField qz = gradq.component(vector::Z);

diaggradq.internalField() = vectorField(qx,qy,qz) ;

there q is volVectorField and diaggradq is volVectorField too.

The main goal is to make a vector (dq/dx , dq/dy , dq/dz), and I can't think how to do it without extracting diagonal elements from grad(q) tensor.

Thanks for helping, best regards.

All times are GMT -4. The time now is 20:26.