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

having trouble reading from either const or 0 directory

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

Like Tree1Likes
  • 1 Post By Zeppo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2016, 16:20
Default having trouble reading from either const or 0 directory
  #1
Member
 
Join Date: Oct 2013
Posts: 85
Rep Power: 8
fedvasu is on a distinguished road
Hi folks,

I am (trying) to initializing my variable with file from 0.

the specific file being alphaPhi but for some reason the object isn't initialized by that object.


(alphaPhi is of type "volScalarField")

Here is my snippet.

Code:
alphaPhi_
    (
        volScalarField (IOobject
        (
            "alphaPhi",
            mesh.time().timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet(0, 0, 0, 0, 0)
    ))
(You can safely ignore the superfluous additional volScalarField temprorary object)

The (non-empty/symmetry) boundary conditions for this variable are totally different for the file defined in 0 and the one initialized ('uniform'/fixed vs calculated).

and I am getting this warning when I run my code (NO ERROR just this warning).

Code:
--> FOAM Warning : 
    From function GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
    in file /home/vasu/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/GeometricField.C at line 108
    read option IOobject::MUST_READ or MUST_READ_IF_MODIFIED suggests that a read constructor for field alphaPhi would be more appropriate.
So what I am I doing wrong, I suspect I am missing something basic here.

Last edited by fedvasu; October 25, 2016 at 19:18.
fedvasu is offline   Reply With Quote

Old   October 28, 2016, 16:27
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 232
Rep Power: 16
Zeppo will become famous soon enough
Hi
Actually, the signature of the volScalarField's constructor you are calling is
Code:
GeometricField (const IOobject &, const Mesh &, const dimensionSet &, const word &patchFieldType=PatchField< Type >::calculatedType())
See, the 4th parameter has a default value PatchField< Type >::calculatedType().
You didn't pass anything for this parameter so the default value was used.
You'd be better off calling the following constructor
Code:
GeometricField (const IOobject &, const Mesh &)
The dimensions can be safely specified directly in your alphaPhi file. If you do so that "strange" warning will disappear. I swear it!
fedvasu likes this.
Zeppo is offline   Reply With Quote

Old   January 4, 2017, 05:55
Default
  #3
Member
 
Join Date: Oct 2013
Posts: 85
Rep Power: 8
fedvasu is on a distinguished road
Quote:
Originally Posted by Zeppo View Post
Hi
Actually, the signature of the volScalarField's constructor you are calling is
Code:
GeometricField (const IOobject &, const Mesh &, const dimensionSet &, const word &patchFieldType=PatchField< Type >::calculatedType())
See, the 4th parameter has a default value PatchField< Type >::calculatedType().
You didn't pass anything for this parameter so the default value was used.
You'd be better off calling the following constructor
Code:
GeometricField (const IOobject &, const Mesh &)
The dimensions can be safely specified directly in your alphaPhi file. If you do so that "strange" warning will disappear. I swear it!
Sorry for the late reply.


You are right, one has to use appropriate constructors.

However I had to specify the read atrributes (for other reasons), I used READ_IF_PRESENT, attribute, It works for my case.

Thanks Zeppo.

Regards,
fedvasu is offline   Reply With Quote

Reply

Tags
initialization, thermophysical model, volscalarfield

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Viscoelastic Fluid Flows using OpenFOAM The solver viscoelasticFluidFoam jovani OpenFOAM Running, Solving & CFD 433 November 20, 2019 04:20
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
[snappyHexMesh] Error in SnappyHexMesh gooya_kabir OpenFOAM Meshing & Mesh Conversion 2 October 23, 2013 05:41
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 07:16
Compiling morfeus80 OpenFOAM Installation 18 March 16, 2008 02:21


All times are GMT -4. The time now is 16:03.