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

Create GeometricField without IOobject

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 14, 2008, 10: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, 15: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, 07:13
Default GeometricField.H has all the c
  #3
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
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, 09: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

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
IOobject r2d2 OpenFOAM Running, Solving & CFD 19 July 31, 2009 12:48
How to convert from GeometricField to fvMatrix waynezw0618 OpenFOAM Running, Solving & CFD 1 January 22, 2009 12:12
Manipulation of cellvalue of a geometricField ivan_cozza OpenFOAM Running, Solving & CFD 2 September 25, 2008 13:58
Duplicate GeometricField reimund OpenFOAM Running, Solving & CFD 9 June 9, 2008 13:47
Accessing data of geometricField bird OpenFOAM Running, Solving & CFD 1 August 28, 2007 18:21


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