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

Create GeometricField without IOobject

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 14, 2008, 11:23
Default Hello, sounds trivial, but ho
  #1
nadine
Guest
 
Posts: n/a
Hello,
sounds trivial, but how do I create a volScalarField, if I have a Field<double> and a volMesh?

Here mesh.Sf() and U are two volVectorFields from which the operator& calculates the inner product, a scalar field:
Field<double> Phi=mesh.Sf() & U;

But later I need a volScalarField with the values of Phi, and I see no possibility to construct this volScalarField although all geometric information is available.

The problem is that every GeometricField<...> constructor requires an IOobject, and every IOobject constructor requires a filename, so that GeometricFields can never be generated on the fly (unless copied from another GeometricField), but must always be read from a file.

Is this true?

N. Blanc
  Reply With Quote

Old   August 14, 2008, 16:18
Default correction: 1) "Here mesh.
  #2
nadine
Guest
 
Posts: n/a
correction:

1)
"Here mesh.Sf() and U are two volVectorFields..."
should read
"Here mesh.Sf() and U are a surfaceScalarField and a volVectorField..."

2)
"But later I need a volScalarField with the values of Phi, and I see no possibility to construct this volScalarField..."
should read
"But later I need a surfaceScalarField with the values of Phi, and I see no possibility to construct this surfaceScalarField..."

Still the question is:
How can I create a GeometricField from a Field and a Mesh without reading from an IOobject/file?

Best,
N. Blanc
  Reply With Quote

Old   August 15, 2008, 08:13
Default GeometricField.H has all the c
  #3
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
GeometricField.H has all the constructors. There are many. For an example on how to create a field without reading, check this file:

src/finiteVolume/lnInclude/createPhi.H

To reconstruct a face field:

fvc::reconstruct(phi);

or

fvc::average(phi);

Depending on what you want to achieve.
eugene is offline   Reply With Quote

Old   August 15, 2008, 10:24
Default Thank you, Eugene! My mistake
  #4
nadine
Guest
 
Posts: n/a
Thank you, Eugene!
My mistake was that I thought an IOobject is always initialized from a file. The example createPhi.H made things clearer.

NB
  Reply With Quote

Reply


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
How to convert from GeometricField to fvMatrix waynezw0618 OpenFOAM Running, Solving & CFD 2 January 8, 2021 17:35
IOobject r2d2 OpenFOAM Running, Solving & CFD 20 May 5, 2016 09:16
Manipulation of cellvalue of a geometricField ivan_cozza OpenFOAM Running, Solving & CFD 2 September 25, 2008 14:58
Duplicate GeometricField reimund OpenFOAM Running, Solving & CFD 9 June 9, 2008 14:47
Accessing data of geometricField bird OpenFOAM Running, Solving & CFD 1 August 28, 2007 19:21


All times are GMT -4. The time now is 19:06.