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

Field Function

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 25, 2019, 23:38
Default Field Function
  #1
New Member
 
Trần Văn Quang
Join Date: Aug 2019
Location: Ho Chi Minh city
Posts: 5
Rep Power: 7
Tran Quang is on a distinguished road
Send a message via Skype™ to Tran Quang
Hi everybody, Previous I used ANSYS Fluent to simulate but now, I'm using Star CCM+ software to simulate for the HVAC project. because I just used this software in a few weeks. So I have a problem. I hope that everybody helps me.

I want to hook C language code (similar ANSYS Fluent) into STAR CCM+ to wind speed calculate. I don't know how to do. This is my code. Please help me.

Can you help me how to create field function according to this formula

My formula V2=3.7*log(z/0.6)/log(10.0/0.6)

Thank you so much

This my codel from fluent

#include "udf.h"


DEFINE_PROFILE(log_velocity,thread,index)
{
real y[ND_ND];
real z;
face_t f;


begin_f_loop(f,thread)
{
F_CENTROID(y,f,thread);
z = y[1];
F_PROFILE(f,thread,index) = 3.7*log(z/0.6)/log(10.0/0.6);
}
end_f_loop(f,thread)
}
Tran Quang is offline   Reply With Quote

Old   August 26, 2019, 06:55
Default
  #2
cwl
Senior Member
 
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 437
Rep Power: 18
cwl is on a distinguished road
cwl is offline   Reply With Quote

Old   August 26, 2019, 11:21
Default
  #3
Senior Member
 
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18
fluid23 is on a distinguished road
This should be easy. I haven't worked with Fluent much so forgive me if I miss something, but you should not need to do a loop to define this field function.

Simply go to tools and right click 'field functions' and select 'create new'. Rename it whatever you want and then set the definition as follows. Also, note that I am assuming this is a log 10 and not log e function you have defined. (For log e just use log() instead of log10().

3.7*log10($$Position[2]/0.6)/log10(10/0.6)

That should define that function at the centriod of each cell based on the z coordinate ($$Position[2]).
fluid23 is offline   Reply With Quote

Old   August 26, 2019, 22:27
Default
  #4
New Member
 
Trần Văn Quang
Join Date: Aug 2019
Location: Ho Chi Minh city
Posts: 5
Rep Power: 7
Tran Quang is on a distinguished road
Send a message via Skype™ to Tran Quang
Thank you so much for your help. I was sending messenge on Skype to you

Last edited by Tran Quang; August 27, 2019 at 01:19.
Tran Quang is offline   Reply With Quote

Old   August 27, 2019, 01:18
Default
  #5
New Member
 
Trần Văn Quang
Join Date: Aug 2019
Location: Ho Chi Minh city
Posts: 5
Rep Power: 7
Tran Quang is on a distinguished road
Send a message via Skype™ to Tran Quang
Quote:
Originally Posted by fluid23 View Post
This should be easy. I haven't worked with Fluent much so forgive me if I miss something, but you should not need to do a loop to define this field function.

Simply go to tools and right click 'field functions' and select 'create new'. Rename it whatever you want and then set the definition as follows. Also, note that I am assuming this is a log 10 and not log e function you have defined. (For log e just use log() instead of log10().

3.7*log10($$Position[2]/0.6)/log10(10/0.6)

That should define that function at the centriod of each cell based on the z coordinate ($$Position[2]).
Hello Sir.
Thank you so much for your help. But when I have imported your formula into STAR CCM+ I have met a problem " A Floating point exception has occurred: floating point exception {Invalid operation}.

Thank you so much
Tran Quang is offline   Reply With Quote

Old   August 27, 2019, 06:07
Default
  #6
Senior Member
 
Joern Beilke
Join Date: Mar 2009
Location: Dresden
Posts: 523
Rep Power: 20
JBeilke is on a distinguished road
Just think a moment about the logarithmus of zero.
JBeilke is offline   Reply With Quote

Old   August 27, 2019, 12:06
Default
  #7
Senior Member
 
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18
fluid23 is on a distinguished road
Quote:
Originally Posted by Tran Quang View Post
Hello Sir.
Thank you so much for your help. But when I have imported your formula into STAR CCM+ I have met a problem " A Floating point exception has occurred: floating point exception {Invalid operation}.

Thank you so much
Wait... are you trying to assign boundary conditions or a value in every cell of your domain?

Also, as Joern pointed out. The equation you defined blows up (goes to negative infinity) when z=0. That is probably the source of your floating point error.

If you are simply trying to apply a velocity profile to your boundary there are better ways to go about it.
fluid23 is offline   Reply With Quote

Old   August 29, 2019, 08:05
Default
  #8
New Member
 
Trần Văn Quang
Join Date: Aug 2019
Location: Ho Chi Minh city
Posts: 5
Rep Power: 7
Tran Quang is on a distinguished road
Send a message via Skype™ to Tran Quang
Quote:
Originally Posted by fluid23 View Post
This should be easy. I haven't worked with Fluent much so forgive me if I miss something, but you should not need to do a loop to define this field function.

Simply go to tools and right click 'field functions' and select 'create new'. Rename it whatever you want and then set the definition as follows. Also, note that I am assuming this is a log 10 and not log e function you have defined. (For log e just use log() instead of log10().

3.7*log10($$Position[2]/0.6)/log10(10/0.6)

That should define that function at the centriod of each cell based on the z coordinate ($$Position[2]).
.

Hello sir.

If I can calculate my model based on the y coordinate. How to changed [2]?
Tran Quang is offline   Reply With Quote

Old   August 29, 2019, 08:13
Default
  #9
Senior Member
 
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18
fluid23 is on a distinguished road
The Cartesian coordinates are specified by the $$Position vector, where $$ denotes a vector quantity. X is $$Position[0], Y is $$Position[1] and Z is $$Position[2].
fluid23 is offline   Reply With Quote

Old   August 29, 2019, 21:53
Default
  #10
New Member
 
Trần Văn Quang
Join Date: Aug 2019
Location: Ho Chi Minh city
Posts: 5
Rep Power: 7
Tran Quang is on a distinguished road
Send a message via Skype™ to Tran Quang
Quote:
Originally Posted by fluid23 View Post
The Cartesian coordinates are specified by the $$Position vector, where $$ denotes a vector quantity. X is $$Position[0], Y is $$Position[1] and Z is $$Position[2].
I very much appreciate your help
Tran Quang 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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 92 May 21, 2024 08:56
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 05:49
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 13:21
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37


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