CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM

volScalarField for cell volumes and face surfaces

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

Like Tree3Likes
  • 3 Post By MartinB

LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2010, 12:41
Default volScalarField for cell volumes and face surfaces
Senior Member
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 21
AlmostSurelyRob will become famous soon enough
Dear OpenFOAM Programmers,

I would appreciate your advice on two issues I am facing.

1) Is it possible to obtain cell volumes as volScalarField object?
2) Assume that for a given direction d and every cell I pick an adjacent surface that lies in direction of d. Is it possible to obtain cell surfaces as volScalarField object of a set defined this way?

I am fairly new to development of openFOAM but I do have some programming experience in C++. I am working with a copy of interFoam code OF. 1.7.1.

For question 1) I have found that I can get mesh.V() to obtain Volume but it is not of volScalarField type. How can I make a conversion?

Please, let me tell you that I am highly impressed by an objective nature of this CFD code. I am sure that if I had more time I would find the answer to questions in documentation. It's just I am pressed by time at the moment as I am struggling to supply a proof of concept.
AlmostSurelyRob is offline   Reply With Quote

Old   December 11, 2010, 16:33
Senior Member
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 20
MartinB will become famous soon enough
Hey Rob,

ad 1)
volScalarField cellVolume
cellVolume.internalField() = mesh.V();
ad 2.)
What shall the volScalarField contain? The face number (an integer)? Or the face areas?
With the direction of d, do you want to start at the cell center of each cell?
Why do you need it as a volScalarField, can't you just loop over each cell and do calculations with the appropriate surface found?

nimasam, lourencosm and mj.foamer like this.
MartinB is offline   Reply With Quote

Old   December 13, 2010, 05:24
Senior Member
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 21
AlmostSurelyRob will become famous soon enough
Thanks Martin for your prompt reply! It worked like a a charm.

As for my second question. I'd like to have an interFoam with cyclic boundaries that keeps the mass flow rates of both phases constant. Something akin to channelFoam, but channelFoam is incompressible and therefore you can just worry for the superficial or average velocity (denoted by Ubar in channelFoam).

To keep my mass flow rate constant in simulation with cyclic boundaries I need to be able to calculate it, so I was thinking of doing

\Sigma_f{rho_1 \alpha_f u_f * S_f) = M1

where rho_1 density, S_f surface area, u_f velocity, \alpha phase fraction. Subsript denote faces in a cross-section perpendicular to the flow direction.

I also thought I could calculate volume weighted average of the above expression for the whole domain and hence my question.

Anyway having the above as an additional condition I decompose my velocity into an old value and correction. After some manipulations the surfaces appear in the correction expression for the gradient.

Does it make more sense now? I will value any comments.

So answering your questions, VolScalarField must contain surface areas.
AlmostSurelyRob is offline   Reply With Quote


interfoam, surface, volscalarfield, volume

Thread Tools Search this Thread
Search this Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] Internal walls of zero thickness anger OpenFOAM Meshing & Mesh Conversion 23 February 6, 2020 18:25
Hydrostatic Pressure and Gravity miliante OpenFOAM Running, Solving & CFD 132 October 7, 2012 22:50
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55

All times are GMT -4. The time now is 11:21.