CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

how to create a volScalarField of mesh.V() ???

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

Like Tree2Likes
  • 1 Post By Fransje
  • 1 Post By kathrin_kissling

LinkBack Thread Tools Display Modes
Old   July 8, 2010, 11:36
Default how to create a volScalarField of mesh.V() ???
New Member
Join Date: Feb 2010
Posts: 9
Rep Power: 9
sebware is on a distinguished road
I use a volScalarField with the volume of cells.
It works with the cell center but not with cell volume.

- Why the following line works
volVectorField centres = Sj.mesh().C();

- Why the following line dosn't work
volScalarField volume= Sj.mesh().V();

Sj is a volVectorField defined as follow:

volVectorField Sj
),mesh, dimensionSet(1,-1,-3,0,0,-1,0)

sebware is offline   Reply With Quote

Old   June 13, 2011, 12:59
Join Date: Sep 2009
Location: Buenos Aires
Posts: 36
Rep Power: 10
lfbarcelo is on a distinguished road
Did you ever get to fix this? I have the exact same problem.
lfbarcelo is offline   Reply With Quote

Old   June 13, 2011, 17:20
Senior Member
Join Date: Mar 2009
Posts: 102
Rep Power: 10
pablodecastillo is on a distinguished road
I think that mesh.V() is a scalarField, not a volscalarField ..........
pablodecastillo is offline   Reply With Quote

Old   July 2, 2011, 07:48
Senior Member
Join Date: Jun 2010
Posts: 107
Rep Power: 10
Fransje is on a distinguished road
Looking at the doxygen documentation on the website, you can see that:

const DimensionedField< scalar, volMesh > & V () const - Return cell volumes.
Meaning that V() will return a DimensionedField.

Did you try using:
volScalarField volume= Sj.mesh().V().field();
Kind regards,

nimasam likes this.
Fransje is offline   Reply With Quote

Old   July 6, 2011, 10:17
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 10
kathrin_kissling is on a distinguished road
This is due that a volScalarField does store values on the boundary, what does not make a lot of sense for cell volumes.
So just the internalField of a volScalarField does have cell volumes

So I personally would not try to cast this into a volScalarField! What will you do on the boundaries? If you initialize the volScalarField with zero than there will be zero at the boundaries too. What happens if you divide at a point by these values?
I would just work on the internalField

volScalarField myWhatEverField =mag(U);
scalarField volumes = mesh.V();

volScalarField result(IOobject(...),mesh, 0);
result.internalField() = myWahateverField.internalField/volumes;

Do whatever you need to do on the boundaries


yanxiang likes this.
kathrin_kissling 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
Meshing a Sphere Ajay FLUENT 10 September 3, 2016 14:18
How to create initiate a volScalarField p without reading from disk NO_READ does not seem to work dbxmcf OpenFOAM Running, Solving & CFD 12 August 22, 2013 07:32
Actuator disk model audrich FLUENT 0 September 21, 2009 07:06
Where's the singularity/mesh flaw? audrich FLUENT 3 August 4, 2009 01:07
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 09:07.