CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Howto create runtime variable for internal field

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

Like Tree1Likes
  • 1 Post By rhythm

LinkBack Thread Tools Search this Thread Display Modes
Old   December 26, 2016, 20:28
Default Howto create runtime variable for internal field
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9
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:

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!
PositronCascade is offline   Reply With Quote

Old   January 5, 2017, 07:33
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12
rhythm is on a distinguished road

You have to initialise your volScalarField with IOobject as follows:

volScalarField DT
    a*T + b
Hope this helps.

sabrinacarson likes this.
rhythm is offline   Reply With Quote


openfoam, runtime modifiable, variable definition

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
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 00:41.