How to do UDF for temperature profile on a semi-disc?

 Register Blogs Members List Search Today's Posts Mark Forums Read

March 25, 2015, 16:13
How to do UDF for temperature profile on a semi-disc?
#1
New Member

Xavier
Join Date: Mar 2015
Posts: 4
Rep Power: 11
Hello everyone,
I'm new in the world of CFD, started it for a school project and I'm struggling with UDFs right now. I've been through the Ansys Fluent UDF Manual (release 14.5 from October 2012) and I still don't get how it works.

Here's my problem:
I've got this model ; a fluid enter by the inlet and exit by the outlet, the other faces are walls except for the back which is defined as a symmetry.

The upside Wall is set to a temperature of 700K and 270K for the downside.
What I want to do is to apply a linear variation of the temperature to the front face following the radii. So whichever radius you chose the variation will be the same.

I've seen there are define_profile function examples in the manual and managed to use one of theme for a simpler case, but I don't know how to adapt it to my present case.
I was thinking of something like : for each point, measure the distance to the origin, using this value to find the equivalent point on a lane for wich I can easily write the temperature profile (for example y=0) and apply the same temperature. But I don't know how to proceed.

Does anyone can help me ?

Note
Here the UDF I adapted from the manual for this geometry

Quote:
 #include "udf.h" DEFINE_PROFILE (gradient_temp1,t,i) { real x[ND_ND]; real y; face_t f; begin_f_loop (f,t) { F_CENTROID(x,f,t); y = x[0]; F_PROFILE(f,t,i) = -150*y - 200; } end_f_loop (f,t) }

 March 25, 2015, 16:32 #2 Senior Member   Join Date: Mar 2015 Posts: 892 Rep Power: 18 The DEFINE_PROFILE macro is for defining custom boundary conditions, not initialising your domain. It sounds like you're trying to input the expected result into Fluent, whereas Fluent computes the temperature with the energy equation! Set the inner and outer faces with constant temperatures (270 K and 700 K, respectively, as you've stated) and initialise the domain with the average temperature (485 K). Next, enable the energy equation and solve. If you're having convergence issues and/or really want to initialise the domain with the expected temperature profile, then look into patching.

 March 25, 2015, 16:39 #3 New Member   Xavier Join Date: Mar 2015 Posts: 4 Rep Power: 11 Hi, thank you for your reply. Actually I'm asked by my professor to set up a linear variation of the temperature as an input parameter. I know it's possible since I've done it in the simple case I talked about in my previous post but I don't know how to write properly the UDF for the present model.

 March 25, 2015, 16:58 #4 Senior Member   Join Date: Mar 2015 Posts: 892 Rep Power: 18 Well I suppose if you must initialise the temperature within the domain then you could use the DEFINE_INIT macro (set the temperature as you loop through all cells). Furthermore, if you want to force this temperature field at every iteration, then you could use the DEFINE_ADJUST macro (although forcing this temperature field could cause convergence issues).

 March 26, 2015, 04:39 #5 Senior Member   Join Date: Nov 2013 Posts: 1,965 Rep Power: 26 The way I read Reivax' question, it is not an initialization problem, but he really wants a boundary condition. This is possible, and conceptually not so difficult: instead of Code: `y = x[0];` which gives "y" the value of the x-coordinate, you need to calculate the distance to the center of your disc, something like Code: `y = sqrt(x[0]*x[0]+x[1]*x[1]);` But, although it is possible to implement it, I think it is smarter to take a step back. Why does your professor ask you to do this? Is it really a boundary condition that the temperature is linear? Or is it more an expected result? Ask your professor about this. Try to understand why he asks you to do things. In your case, I would say it is much better to put a adiabatic boundary condition on the front wall. So that there is no heat flux through the wall. The outcome will be that the temperature profile is (nearly) linear. And it is much more logical to assume an adiabatic wall than to assume a linear temperature profile.

 April 7, 2015, 22:54 #6 New Member   Xavier Join Date: Mar 2015 Posts: 4 Rep Power: 11 Thank you Pakk, your anwser help me solve the problem. To anwser your question, we simulate a linear variation of the temperature on the to observe its impact on the fluid flow and the htc.

 Tags define profile, help needed, udf, udf and programming