|
[Sponsors] |
September 2, 2023, 04:54 |
Using setExprFields
|
#1 |
New Member
Join Date: Sep 2023
Posts: 3
Rep Power: 2 |
Hello,
I would like to better understand the setExprFields utility. I have tried to find information on this at www.openfoam.com but so far I have been unsuccessful. The dictionary is composed of: Code:
expressions ( name { field name; dimensions [0 0 0 0 0 0 0]; constants { } fieldMask #{ #}; variables ( ); expression #{ #}; } ); fieldMask is a condition defining where the utility is going to apply an expression Expression is the equation to apply constants are constant to the expression? variables. What are variables? From my limited understanding of this, I have seen constants and expressions in the variables sections. Here are a couple of examples. Code:
variables ( "x = pos().x()" "y = pos().y()" "z = pos().z()" ); expression #{ vector(x, y, z) #}; And here https://develop.openfoam.com/Develop...ExprFieldsDict Code:
variables ( "radius = 0.1" ); What are the roles of variables and constants? Is this a programing strategy where constants get stored in a single variable and variables get defined over the volume/surface? Afterwards, everything is put together in the expression? |
|
September 17, 2023, 03:48 |
|
#2 |
New Member
Join Date: Sep 2023
Posts: 3
Rep Power: 2 |
Anyone that can clarify this for me?
Where can I get more information? |
|
September 18, 2023, 03:29 |
|
#3 |
Senior Member
Join Date: Dec 2021
Posts: 209
Rep Power: 5 |
Hey
Have you looked for examples in the tutorials? I have found this one: Code:
expressions ( T { field T; dimensions [0 0 0 1 0 0 0]; constants { centre (0.21 0 0.01); } variables ( "radius = 0.1" ); fieldMask #{ // Within the radius (mag(pos() - $[(vector)constants.centre]) < radius) // but only +ve y! && pos((pos() - $[(vector)constants.centre]).y()) > 0 #}; expression #{ 300 + 200 * (1 - mag(pos() - $[(vector)constants.centre]) / radius) #}; } ); My guess about variables and constants is that variables are allowed to be modified using the expression and constants are not. Based on the example above, it might only be a way to make a distinction between fixed values and values you might want to try during different runs. I am not really helping but if you find out please update the thread, I have been looking into using setExprFields too. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
setExprFields | CallumG | OpenFOAM Pre-Processing | 12 | March 8, 2023 03:05 |
setExprFields example to generate an initial velocity field for LES of channel flow | fumiya | OpenFOAM Running, Solving & CFD | 6 | January 20, 2022 20:30 |
problem of using setExprFields | qi.yang@polimi.it | OpenFOAM Pre-Processing | 1 | May 25, 2021 15:15 |
Reading fields in setExprFields | aeroengprof | OpenFOAM Programming & Development | 6 | February 27, 2021 14:44 |