CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Extraction and Manipulation of div(U) Rank 1/2 Tensor (volTensorField) (

JFM September 11, 2013 23:56

Extraction and Manipulation of div(U) Rank 1/2 Tensor (volTensorField)
Good day everyone :)

I am using OpenFOAM to assess a hydraulic structure which is designed to operate at critical condition (Fr=1). Previously I had assessed this structure using two commercial 2D FVM model, however the results were not acceptable.

As a result I have created a 3D interFoam model of the structure and are aiming to prove that OpenFOAM is a suitable tool for designers. I need to determine the influence, if any, of the cross momentum terms from the convective velocity field, div (phi, U). The terms I am particularly interested in are:
x-direction: u.du/dx + v.du/dy + w.du/dz
y-direction: etc
z-direction: etc
(at this stage I am not interested in the RAS or LES stresses)

It appears that these components are indeed calculated and are stored as a tensor (volTensorField) with a NOWRITE command. However, I cannot find anyway (in the forum or other references) to write this tensor out from the model. Could someone provide some direction on how this could be achieved, please include file / dictionary names that may need to be amended.

I have been using OpenFOAM for around a year but still have limited confidence when it comes to manipulation of files therefore any assistance will be greatly appreciated - hopefully I can return the favour one day.


Bernhard September 12, 2013 01:54

As far as I know, you can force the writing of a field by


During run-time, you might only want to write it at the specific output time-steps, than you need something like


if (mesh.time().outputTime())

JFM September 13, 2013 20:26

Files to amend
Thank you Bernhard :)

Which source files create the interFoam div tensor and which files need to be amended :confused: . Or perhaps someone could provide a link to some references that may provide some guidance on tensors creation, storage and manipulation.

Kind regards

All times are GMT -4. The time now is 04:15.