|
[Sponsors] | |||||
|
|
|
#1 |
|
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 |
|
|
||
|
|
|
#2 |
|
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 |
|
|
||
|
|
|
#3 |
|
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 22 ![]() |
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. |
|
|
|
|
|
|
|
|
#4 |
|
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 |
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |