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

Howto create runtime variable for internal field

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By rhythm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 26, 2016, 20:28
Default Howto create runtime variable for internal field
  #1
Member
 
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 10
PositronCascade is on a distinguished road
Hello everyone. Assume that I have a variable like this:



And I want to change DT respect to T after every iteration and it should be like this, I need to get the value of that cell and evaluate DT equation, use it for iterations and write it to time folder and update it at next iteration step.

So I define it like this:

Code:
dimensionedScalar a (laminarTransport.lookup("a"));
dimensionedScalar b (laminarTransport.lookup("b"));
volScalarField DT = a*T+b
I compile it and run, everything seems okay but when I look into time folder, lets say 10, I can't get the value for each cell. Instead, it says for internal uniform 100, for instance but I want to see the distribution of DT inside the domain.

The way I am trying to calculate DT is not appropriate way? If not, call you tell me how can I define this kind of variable, please?

I hope you can help me to find my mistake!
Regards
PositronCascade is offline   Reply With Quote

Old   January 5, 2017, 07:33
Default
  #2
Member
 
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 13
rhythm is on a distinguished road
Hi,

You have to initialise your volScalarField with IOobject as follows:

Code:
volScalarField DT
(
    IOobject
    (
        "DT",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    a*T + b
);
Hope this helps.

Cheers,
Ben
sabrinacarson likes this.
rhythm is offline   Reply With Quote

Reply

Tags
openfoam, runtime modifiable, variable definition


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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
OpenFOAM floating point Error upuli OpenFOAM Programming & Development 5 June 20, 2016 04:19
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Variable Operating Pressure (field) Arturo FLUENT 0 April 30, 2008 16:22
Dynamic Gradient Adaption: Mulitple Field Variable Steve FLUENT 0 July 12, 2005 18:36


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