# volScalarField for cell volumes and face surfaces

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

 December 11, 2010, 13:41 volScalarField for cell volumes and face surfaces #1 Senior Member   Robert Sawko Join Date: Mar 2009 Posts: 117 Rep Power: 15 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.

 December 11, 2010, 17:33 #2 Senior Member   Martin Join Date: Oct 2009 Location: Aachen, Germany Posts: 253 Rep Power: 14 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.

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

 Tags interfoam, surface, volscalarfield, volume

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post anger OpenFOAM Native Meshers: blockMesh 22 December 15, 2015 03:06 miliante OpenFOAM Running, Solving & CFD 132 October 7, 2012 22:50 hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50 AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06 SSL FLUENT 2 January 26, 2008 12:55

All times are GMT -4. The time now is 09:13.