CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

udf to give temperature profile for a plane

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 31, 2018, 06:13
Default udf to give temperature profile for a plane
  #1
Member
 
Sai Krishna
Join Date: May 2018
Posts: 37
Rep Power: 8
Sai Krishna is on a distinguished road
i have tried one code to give temperature variation from 500 to 800 kelvin along z direction for a wall in XZ plane. interpretation and compilation were done without errors but during post processing the temperature results, i didn't observe any variation and its showing 500K all over the plane. presently iam using ansys 18.2 version.
code is as follows.

#include"udf.h"
DEFINE_PROFILE(temperature,thread,position)
{
real x[ND_ND]; //defining position vector//
real z;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread)
z=x[2];
F_PROFILE(f,thread,position)=500+3*(z);
}
end_f_loop(f,thread)
}

my doubts are:
1. is there anything wrong in the code....?
2. does the way of defining the position vector is same for 2D and 3D
models?
3. during interpretation do i need to use command name as "cpp" or "cc -E"?
4. does this code works for 3D cases, since i have seen many examples
where 2D cases have used this code...

any help will be greatly appreciated....

thanks...
Sai Krishna is offline   Reply With Quote

Old   June 1, 2018, 11:05
Default
  #2
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi Sai Krishna,

1. You need a semicolon at the end of the line containing F_CENTROID. I am surprised that this compiled without errors.
2. Yes, the F_CENTROID command (and many others) are the same in 2D and 3D. It would not be safe to access x[2] in 2D, but this is correct in 3D.
3. I would not recommend interpretation at all.
4. This should be OK in 3D.

One issue with your code is probably the formula "500+3*(z)". The units of z are [metre], so you would need a domain size of 100m to reach 800K. This is possible, but you should check whether this is correct for your case.

Good luck!
Ed
obscureed is offline   Reply With Quote

Reply

Tags
fluent - udf


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
Using a Plane id in Fluent UDF cdf_user Fluent UDF and Scheme Programming 13 October 17, 2023 01:06
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 08:15
Read profile file from UDF DonQuijote Fluent UDF and Scheme Programming 0 February 18, 2013 12:56
Inlet won't apply UDF and has temperature at 0K! tccruise Fluent UDF and Scheme Programming 2 September 14, 2012 07:08
Associating profile files for the UDS though a UDF Bharath FLUENT 0 December 1, 2006 16:58


All times are GMT -4. The time now is 21:49.