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

User Defined Field Function Syntax

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By olesen
  • 1 Post By sabrina

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2014, 13:34
Default User Defined Field Function Syntax
  #1
New Member
 
Dylan
Join Date: Mar 2012
Posts: 25
Rep Power: 14
Dyls is on a distinguished road
Hi

I have created a user defined function and am unable to figure why it will not compile.

What is wrong with my syntax?

(($time > 16560) && ($time < 79200)) ? 0.00003*($time/3600)^5 - 0.0018*($time/3600)^4 + 0.044*($time/3600)^3 - 0.4912*($time/3600)^2 + 2.727*($time/3600) - 4.9577 : 0

Also, what is a good resource on learning the syntax for these functions? I checked the star-ccm+ documentation but it looks like only a few examples are given. I couldn't find anything else.

Thanks

Dylan
Dyls is offline   Reply With Quote

Old   December 1, 2014, 23:18
Default
  #2
Member
 
kris
Join Date: May 2014
Posts: 73
Rep Power: 11
kguntur is on a distinguished road
starccm+ does not recognise "^". use pow(x,y) to represent x^y. that should work.
kguntur is offline   Reply With Quote

Old   December 2, 2014, 03:24
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Dyls View Post
Hi

I have created a user defined function and am unable to figure why it will not compile.

What is wrong with my syntax?

(($time > 16560) && ($time < 79200)) ? 0.00003*($time/3600)^5 - 0.0018*($time/3600)^4 + 0.044*($time/3600)^3 - 0.4912*($time/3600)^2 + 2.727*($time/3600) - 4.9577 : 0

Also, what is a good resource on learning the syntax for these functions? I checked the star-ccm+ documentation but it looks like only a few examples are given. I couldn't find anything else.

Thanks

Dylan
As was mentioned, use pow() for these functions - this is consistent with standard C/Java syntax. For polynomials, however, you can avoid pow() and just do it directly. This should be slightly more efficient.

Eg,
Code:
c0 + x*(c1 + x*(c2 + x*(c3 + x*(c4 + x*(c5)))))
Also note that the ternary operator is not extremely robust. You might consider placing things within brackets or splitting it into a separate functions.
crevoise, kguntur and sabrina like this.
olesen is offline   Reply With Quote

Old   February 4, 2015, 05:03
Default
  #4
New Member
 
sabrina bina
Join Date: Jan 2015
Location: Algeria
Posts: 10
Rep Power: 11
sabrina is on a distinguished road
Quote:
Originally Posted by olesen View Post
As was mentioned, use pow() for these functions - this is consistent with standard C/Java syntax. For polynomials, however, you can avoid pow() and just do it directly. This should be slightly more efficient.

Eg,
Code:
c0 + x*(c1 + x*(c2 + x*(c3 + x*(c4 + x*(c5)))))
Also note that the ternary operator is not extremely robust. You might consider placing things within brackets or splitting it into a separate functions.
thanks for these informations, I have a problem if you have any idea, in star CCM+ we can calculate or define the derivative of function ?, like the derivative of the temperature or of the velocity (du/dy) or (dt/dy), I want calculate temperature jump and slip velocity
skkumar likes this.
sabrina is offline   Reply With Quote

Old   February 25, 2021, 11:21
Default Cannot evaluate field function Centroid.
  #5
New Member
 
Prit K
Join Date: Jul 2020
Posts: 3
Rep Power: 5
Pkanugov is on a distinguished road
Hello everyone,

I am trying to create a variable density ( varying with height ) profile in a rectangular domain and the equation I'm using is:

0.2257*(pow($$Centroid[1],3))-0.4868*(pow($$Centroid[1],2))+0.06016*(pow($$Centroid[1],1))+1.301

I'm first generating a report using the expression and when I try to run the report ( after initialization ) I get an error saying:

Cannot evaluate field function Centroid.

Can someone please help me with this.

Thank you in advance.
Pkanugov is offline   Reply With Quote

Old   July 22, 2021, 23:39
Default It seems that the pressure field cannot be changed and can only be set as a function
  #6
New Member
 
Alisdair
Join Date: Jun 2021
Posts: 1
Rep Power: 0
278780870 is on a distinguished road
Does anyone know how to change the pressure field to field function definition in starccm +? I define a static pressure, but I find that the system always reports an error: "unable to compute field function 'name' on 'region'. Please check that the function is defined here"It seems that the pressure field cannot be changed and can only be set as a function
278780870 is offline   Reply With Quote

Old   August 6, 2021, 08:30
Default
  #7
Member
 
mCiFlDk's Avatar
 
mCiFlDk
Join Date: Feb 2020
Posts: 56
Rep Power: 6
mCiFlDk is on a distinguished road
Quote:
Originally Posted by Pkanugov View Post
Hello everyone,

I am trying to create a variable density ( varying with height ) profile in a rectangular domain and the equation I'm using is:

0.2257*(pow($$Centroid[1],3))-0.4868*(pow($$Centroid[1],2))+0.06016*(pow($$Centroid[1],1))+1.301

I'm first generating a report using the expression and when I try to run the report ( after initialization ) I get an error saying:

Cannot evaluate field function Centroid.

Can someone please help me with this.

Thank you in advance.
Dear Pkanugov,


Have you found the solution to your problem?


Thank you!
mCiFlDk is offline   Reply With Quote

Reply


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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
Transient User Defined Function in CFX Niru CFX 0 November 12, 2013 17:07
using METIS functions in fortran dokeun Main CFD Forum 7 January 29, 2013 04:06
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 06:42


All times are GMT -4. The time now is 22:37.