|
[Sponsors] |
UDF for a time varying temperature boundary condition |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 11, 2013, 04:12 |
UDF for a time varying temperature boundary condition
|
#1 |
New Member
Sam
Join Date: Sep 2013
Posts: 4
Rep Power: 13 |
Hello,
I'm VERY new to Fluent and I'm attempting to write a UDF that will make the temperature at a wall a function of time. I've never programmed in C before either so I'm having some trouble getting the correct sytax. Here's my UDF: #include "udf.h" DEFINE_PROFILE(HC_temp_BC,thread,i) { face_t f; begin_f_loop(f,thread) { time=CURRENT_TIME; F_PROFILE(f,thread,i)=(-4*10^(-17))*t^5 + (1*10^(-12))*t^4 - (1*10^(-8))*t^3 + (5*10^(-2))*t^2 - (0.0357*t)+304.5; } end_f_loop(f,thread) } I didn't compile it. I've been trying to use Fluent's interpreter but every time I try to interpret it I get this error: "Error: /home/aero/Desktop/HC_temp.c: line 2: syntax error" I'm sure the solution is very simple, but I'm a complete noob so I could use some help. Thanks! |
|
October 11, 2013, 12:18 |
|
#2 | |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
Quote:
try this: Code:
#include "udf.h" DEFINE_PROFILE(HC_temp_BC,thread,i) { face_t f; begin_f_loop(f,thread) { time=CURRENT_TIME; F_PROFILE(f,thread,i)=(-4*pow(10,-17))*pow(t,5)+pow(10,-12)*pow(t,4)-pow(10,-8)*pow(t,3)+5*pow(10,-2)*pow(t,2)-0.0357*t+304.5; } end_f_loop(f,thread) } |
||
October 11, 2013, 12:25 |
|
#3 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
But you have error on line 2?
Make sure you are writing in txt file, then rename .txt to .c and that there aren't "hidden" characters in line 2. Daniele |
|
October 16, 2013, 02:05 |
|
#4 |
New Member
Sam
Join Date: Sep 2013
Posts: 4
Rep Power: 13 |
Thank you Ghost82. I've never coded in C before so I'd written the equation as if I were coding it in MATLAB. Thanks for correcting me!
I finally figured out why I was getting a sytax error on line 2. I had written the function on my PC (Windows), and then sent it to one of the university's computers (Linux) to run it in Fluent. I just rewrote the function on the Linux computer and it worked perfectly. |
|
Tags |
ansys, fluent, temperature, transient bc, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 06:45 |
mesh file for flow over a circular cylinder | Ardalan | Main CFD Forum | 7 | December 15, 2020 14:06 |
How to get free stream temperature in boundary condition | saharesobh | FLUENT | 0 | October 9, 2012 18:12 |
vorticity boundary condition | bearcharge | Main CFD Forum | 0 | May 14, 2010 12:32 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |