|
[Sponsors] |
May 24, 2018, 10:33 |
[OF 5.0] - declaring single variables
|
#1 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
Howdy folks:
I am wondering if there is a way to create individual variables at the beginning of solving, and let the solver change it through out. In my solver, there are a number of solution domain independent variables (think g, but changes in value through time) and I would like to be able to update their values at the start of each iteration while allowing the solver variables (U, p, T, etc) to access them in the inner iteration. Since the value will be identifical to all cells, so I don't want to create an extra scalar to save space and computational effort. How could this be done? Thanks in advance, GK. |
|
May 28, 2018, 17:07 |
Turns out it wasn't so bad afterall
|
#2 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
So it was more straightforward than I thought. As I am still at the prototyping stage, I don't want to be too fancy with my code, but it looks like I can declare variables (scalars, bool, what not) at the solver level and have them accessible later. So for now my problem is solved.
But again, once my solver works, I should think about packaging these variables nicely (in a class, for instance). Gerry. |
|
May 29, 2018, 09:46 |
|
#3 |
New Member
Marius Bünker
Join Date: Oct 2017
Posts: 13
Rep Power: 8 |
Declare them as Fields (for example VolScalarField)
OpenFoam recognizes that they are uniform for your domain and converts them to uniformField, which is saved as one Value and your BC. |
|
May 29, 2018, 10:39 |
|
#4 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29 |
Why on earth would you run all the machinery to create a uniform field with boundaries, when all you need is a scalar?
__________________
*On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer. |
|
May 30, 2018, 01:43 |
|
#5 |
New Member
Marius Bünker
Join Date: Oct 2017
Posts: 13
Rep Power: 8 |
You are right. I somehow thought, he wanted to save them and then he would have needed IOObjects.
|
|
May 30, 2018, 16:52 |
|
#6 | |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
Quote:
VG, Gerry. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] How to define boundary condition variables by using previosly defined variables? | pawlo | OpenFOAM Community Contributions | 8 | September 13, 2020 11:37 |
Single v.s. double precision | Confused | CFX | 15 | November 10, 2016 04:42 |
How to export single variable of a single surface? | zeitistgeld | CFX | 6 | September 26, 2009 06:37 |
PHI file structure | Eugene | Phoenics | 9 | November 2, 2001 22:00 |
P4 1.5 or Dual P3 800EB on Gibabyte board | Danial | FLUENT | 4 | September 12, 2001 11:44 |