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

Why is my new variable constant in all time steps?

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   July 5, 2022, 09:13
Question Why is my new variable constant in all time steps?
  #1
New Member
 
Join Date: Sep 2020
Location: Germany
Posts: 17
Rep Power: 5
CharIie is on a distinguished road
I am working in OpenFoamV8 with buoyantPimpleFoam. I have created a new variable "Test" in the solver code. Test should be the sum of the current temperature and a user defined constant value "Tc". My solver compiles and I get results, but the variable Test does not change over time!

Only the first time step "Test" is calculated and stays constant for all time steps. Although T changes over time! How can that be?

The error must be in the following code:
I have added these lines to Ueqn.H:
Code:
const volScalarField& T = mesh.lookupObject<volScalarField>("T");
dimensionedScalar    Tc(magneticProperties.lookup("Tc"));
volScalarField Test = T + Tc;
Test and Tc are created in createFields.H like this:
Code:
Info<< "Reading magnetic properties\n" << endl;
IOdictionary magneticProperties
(
    IOobject
    (
        "magneticProperties",
        runTime.constant(),
        mesh,
        IOobject::MUST_READ_IF_MODIFIED,
        IOobject::NO_WRITE
    )
);
dimensionedScalar Tc(magneticProperties.lookup("Tc"));



Info<< "Reading field Test\n" <<endl;
volScalarField Test
(
    IOobject
    (
         "Test",
         runTime.timeName(),
         mesh,
         IOobject::MUST_READ,
         IOobject::AUTO_WRITE
     ),
     mesh
);
CharIie is offline   Reply With Quote

 


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
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 21:00
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 5 January 24, 2018 05:28
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 07:09
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 02:50


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