|
[Sponsors] |
July 7, 2020, 04:06 |
Field function for defining "pressure oulet"
|
#1 |
New Member
Jonathan Thilo
Join Date: Jul 2020
Posts: 4
Rep Power: 5 |
Hi all,
I'm looking for explanation of the syntax in the field functions. i need a field function to modify my pressure outlet for each 5000 iteration fx. an example could be: 0-1000 iteration -> Pressure = 1bar 1000-1500 iteration -> pressure = 2bar 1500-2000 iteration -> pressure = 3bar ... currently i'm at: (${Iteration} >= 1000) ? ${P_INLET} = 10e5 but i'm sure it is wrong. Thanks in advance |
|
July 7, 2020, 22:06 |
|
#2 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
you have the syntax wrong and the result is output to your input menu, scene etc and not within the equation:
(${Iteration} < 1000) ? 1e5 : (( ${Iteration} < 1500) ? 2e5 : (( ${Iteration} < 2000) ? 3e5 : 4e5 )) your stepping of the pressure might cause instability and so you could consider a simple linear ramp with something like this: (${Iteration} < 2000) ? ${Iteration} * 400.0 : 4e5 (both assume you want the pressure to be get to 4e5 at 2000 iterations - you did not specify what happens after 2000. |
|
July 8, 2020, 07:34 |
|
#3 |
New Member
Jonathan Thilo
Join Date: Jul 2020
Posts: 4
Rep Power: 5 |
Hi Ping,
Thank you, very helpful. |
|
July 8, 2020, 08:56 |
|
#4 |
Senior Member
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 435
Rep Power: 17 |
Instead of crazy syntax-based nested conditions - I'd suggest external .csv-table (Iteration-Pressure) and interpolateTable() function with LINEAR option.
|
|
July 9, 2020, 02:50 |
|
#5 |
New Member
Jonathan Thilo
Join Date: Jul 2020
Posts: 4
Rep Power: 5 |
cwl, could you explain the external .csv method?
|
|
July 10, 2020, 08:40 |
|
#6 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
anyone who has got to this level in their studies should be encouraged to learn the wonderful power of field functions and equations in star since it opens up so much potential.
tables will do this task well too but is painful if you decide to change a setting since a new table is required to be created and imported - better suited to importing a long time series of data and then interpolating. you can read about it in tools, tables. |
|
July 11, 2020, 09:43 |
|
#7 | ||
Senior Member
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 435
Rep Power: 17 |
Create a .csv-file table with contents like following
Quote:
Then - you can use it in Field Functions like: Quote:
|
|||
July 11, 2020, 09:47 |
|
#8 | ||
Senior Member
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 435
Rep Power: 17 |
Quote:
- arguments; - loops; - calling other functions; - something more handy for dealing with ranges than inhuman ternary operator. Quote:
Again, I would not call using tables painful in such case - compared to multiple nested (...) ? ... : ... conditions. No doubt that tables were intended to be used fpr dealing with data series, but given current limitations of capabilities - I'd use them in this case. |
|||
Tags |
fieldfunction:iteration |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 91 | December 21, 2022 04:50 |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 04:49 |
[snappyHexMesh] How to define to right point for locationInMesh | Mirage12 | OpenFOAM Meshing & Mesh Conversion | 7 | March 13, 2016 14:07 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 04:37 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 17:51 |