CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

volScalarField for cell volumes and face surfaces

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By MartinB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2010, 13:41
Default volScalarField for cell volumes and face surfaces
  #1
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
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, 17:33
Default
  #2
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hey Rob,

ad 1)
Code:
volScalarField cellVolume
(
    IOobject
    (
        "cellVolume",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh,
    dimensionedScalar("zero",dimVolume,0.0)
);
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?

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

Old   December 13, 2010, 06:24
Default
  #3
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
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

Reply

Tags
interfoam, surface, volscalarfield, volume


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 19:25
Hydrostatic Pressure and Gravity miliante OpenFOAM Running, Solving & CFD 132 October 7, 2012 23:50
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 06:50
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


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