|
[Sponsors] |
August 25, 2019, 23:38 |
Field Function
|
#1 |
New Member
|
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) } |
|
August 26, 2019, 06:55 |
|
#2 |
Senior Member
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 437
Rep Power: 18 |
||
August 26, 2019, 11:21 |
|
#3 |
Senior Member
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18 |
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]). |
|
August 26, 2019, 22:27 |
|
#4 |
New Member
|
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. |
|
August 27, 2019, 01:18 |
|
#5 | |
New Member
|
Quote:
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 |
||
August 27, 2019, 06:07 |
|
#6 |
Senior Member
Joern Beilke
Join Date: Mar 2009
Location: Dresden
Posts: 523
Rep Power: 20 |
Just think a moment about the logarithmus of zero.
|
|
August 27, 2019, 12:06 |
|
#7 | |
Senior Member
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18 |
Quote:
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. |
||
August 29, 2019, 08:05 |
|
#8 | |
New Member
|
Quote:
Hello sir. If I can calculate my model based on the y coordinate. How to changed [2]? |
||
August 29, 2019, 08:13 |
|
#9 |
Senior Member
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18 |
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].
|
|
August 29, 2019, 21:53 |
|
#10 |
New Member
|
||
|
|
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 |