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/)
-   -   volVolumeField from volSurfaceField (http://www.cfd-online.com/Forums/openfoam-programming-development/87197-volvolumefield-volsurfacefield.html)

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.

Code:

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 14:57.