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

IOobject returns constant value

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 28, 2020, 18:25
Default IOobject returns constant value
  #1
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Hi,


I am trying to create a new IOobject (Reynoldsnumber). Therefore I have added the following lines in my createFields.H and compiled it without errors. Unfortunately only a const value is returned (for Re and nu):


Code:
volScalarField nu
    (
    IOobject
        (
            "nu",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
         thermo.mu()/rho
     );


volScalarField L
(
    IOobject
    (
        "L",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh,dimensionedScalar("L", dimensionSet(0,1,0,0,0,0,0),1 )
);

    volScalarField Re
    (
    IOobject
        (
            "Re",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
           
        ),
         mag(U)*0.00095*L/nu
     );

Any idea what I am doing wrong?
shock77 is offline   Reply With Quote

Old   November 29, 2020, 02:54
Default
  #2
New Member
 
Wenyuan Fan
Join Date: Mar 2017
Posts: 27
Rep Power: 9
Wenyuan is on a distinguished road
Hi,

You need to update such volScalarFields in the time loop. Otherwise, they will always take the initial values defined in createFields.H.
Wenyuan is offline   Reply With Quote

Old   November 29, 2020, 05:58
Default
  #3
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Thank you very much, it seems to work now!


As you said, I have added the lines in the time loop of my solver:


Code:
nu = thermo.mu()/rho;
L = dimensionedScalar("L", dimensionSet(0,1,0,0,0,0,0),1 );
Re = mag(U)*0.00095*L/nu;
shock77 is offline   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
Warning message C4133 while compiling Arminius Fluent UDF and Scheme Programming 0 October 2, 2017 11:44
LESModel returns constant field syavash OpenFOAM Programming & Development 2 December 19, 2016 06:20
Constant Volume Combustion with reactingFoam Alish1984 OpenFOAM Running, Solving & CFD 2 May 8, 2011 08:51
Fluent RPvar list for molar-weight pilou FLUENT 6 February 21, 2011 03:08
Really big problems when creating own materials da Jop FLUENT 0 June 28, 2007 11:15


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