|
[Sponsors] |
November 29, 2016, 11:58 |
User Field Functions
|
#1 |
New Member
Join Date: Oct 2016
Posts: 19
Rep Power: 10 |
Hi All,
I have never programmed in C before and thus am struggling with writing a user field function. I would like to write a function to determine spray penetration length. Something like: "If (Volume fraction < X), return the max position in Z where this occurs" I have so far: (${LagrangianVolumeFractionPhase 1} < 0.75) ? max($${Position}[2]) However I get syntax errors and generally have no idea how to write it. Could anyone help me out? Thank you. |
|
November 29, 2016, 13:36 |
|
#2 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 25 |
You don't use field functions for this. Field functions make 1 value for each cell in the entire field, hence the term field function. You want to return just 1 value. That's a report.
You want to make a threshold of volume fraction < 0.75. Then make a maximum report on that threshold of position in Z. Run the report and you get your value. |
|
November 30, 2016, 10:28 |
|
#3 | |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
Quote:
|
||
December 6, 2016, 10:37 |
|
#4 | ||
New Member
Join Date: Oct 2016
Posts: 19
Rep Power: 10 |
Quote:
Quote:
I do have a couple of questions with regards to volume fraction, if you wouldn't mind? I does the "volume" refer to the mesh cell size at that location? Other than the cell size, are there any key contributors to such a low (~0.0008) volume fraction, when I was expecting something in the order of 75%? Thanks. |
|||
December 6, 2016, 12:06 |
|
#5 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 25 |
Volume does refer to the volume of the cell. There are only two components to the volume fraction - the volume and the phase. If your volume is an expected size then whatever is producing the phase is the problem.
|
|
Tags |
syntax, user code, user field function |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to calculate pressure forces using custom field functions? | tsagaro | FLUENT | 7 | June 23, 2017 16:45 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL | AndoniBM | OpenFOAM Running, Solving & CFD | 2 | March 25, 2015 19:44 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
Custom field functions | sivakumar | FLUENT | 1 | October 12, 2001 07:36 |