CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

User Field Functions

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By me3840

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 29, 2016, 10:58
Default User Field Functions
  #1
New Member
 
Join Date: Oct 2016
Posts: 19
Rep Power: 9
Goldenballs is on a distinguished road
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.
Goldenballs is offline   Reply With Quote

Old   November 29, 2016, 12:36
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
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.
kirrer likes this.
me3840 is offline   Reply With Quote

Old   November 30, 2016, 09:28
Default
  #3
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Quote:
Originally Posted by me3840 View Post
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.
I concur. Don't use a field function, unless you're trying to define a field.
LuckyTran is offline   Reply With Quote

Old   December 6, 2016, 09:37
Default
  #4
New Member
 
Join Date: Oct 2016
Posts: 19
Rep Power: 9
Goldenballs is on a distinguished road
Quote:
Originally Posted by me3840 View Post
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.
Quote:
Originally Posted by LuckyTran View Post
I concur. Don't use a field function, unless you're trying to define a field.
Thank you both, threshold worked, all be it a bit crude.

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.
Goldenballs is offline   Reply With Quote

Old   December 6, 2016, 11:06
Default
  #5
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
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.
me3840 is offline   Reply With Quote

Reply

Tags
syntax, user code, user field function


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 calculate pressure forces using custom field functions? tsagaro FLUENT 7 June 23, 2017 15:45
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL AndoniBM OpenFOAM Running, Solving & CFD 2 March 25, 2015 18:44
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Custom field functions sivakumar FLUENT 1 October 12, 2001 06:36


All times are GMT -4. The time now is 20:24.