CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Running, Solving & CFD

Diagonal elements of a volTensorField

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   September 22, 2010, 05:47
Default Diagonal elements of a volTensorField
New Member
Join Date: Sep 2010
Posts: 3
Rep Power: 9
CpCaniggia is on a distinguished road
Dear All,

I need to compute the diagonal elements of a volTensorField. The tensor field has the form,

volTensorField tmp ("tmp", fvc::grad(U));

It seems OpenFoam 1.6 doesn't have a function like diag(tmp). Does OpenFoam 1.7 have such kinds of function? Do any people know how to compute the diagonal elements?

Many thanks,
Y. J.
CpCaniggia is offline   Reply With Quote

Old   September 23, 2010, 11:06
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 14
eugene is on a distinguished road
If you want the sum of the diagonal elements then:

volScalarField trTmp = tr(tmp);

If you just want the diagonal components, then


will provide the individual fields.
eugene is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Low Mach number Compressible jet flow using LES ankgupta8um OpenFOAM Running, Solving & CFD 7 January 15, 2011 14:38
Error while running rhoPisoFoam.. nileshjrane OpenFOAM Running, Solving & CFD 8 August 26, 2010 12:50
How to get the Diagonal elements of volTensorField su_junwei OpenFOAM Running, Solving & CFD 0 December 1, 2008 11:29
Penetrating elements in extruded mesh Michael P CFX 2 May 20, 2005 08:06
CFX4.3 -build analysis form Chie Min CFX 5 July 12, 2001 23:19

All times are GMT -4. The time now is 07:42.