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

UDF for Temperature Dependent Energy Source

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 10, 2012, 02:20
Default UDF for Temperature Dependent Energy Source
  #1
New Member
 
Mukesh
Join Date: Sep 2012
Posts: 28
Rep Power: 14
er.mkumar is on a distinguished road
Hello All,

I am solving a problem wherein there is an energy source term with two parts:
1) Part dependent on Temperature [i.e. T*(Cp_g - Cp_s) ]
2) Part independent of Temperature

Can anybody suggest how to include temperature dependent source term in the UDF as we know Energy equation solves for Temperature.

Thanks a lot
Mukesh
er.mkumar is offline   Reply With Quote

Old   January 11, 2013, 05:28
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 125
Rep Power: 17
mactech001 is on a distinguished road
Hi Mukesh,

did you get any response or help in this please? i'm also having the same problem.

i was thinking using DEFINE_SOURCE and C_T macro, but not yet sure how to relate them.
__________________
Thank you for your kind attention.

Kind regards,
mactech001
Currently using: ANSYS v13
mactech001 is offline   Reply With Quote

Old   January 18, 2013, 05:32
Default problem on UDF returned parameters
  #3
Senior Member
 
Join Date: Nov 2009
Posts: 125
Rep Power: 17
mactech001 is on a distinguished road
Dear all,

i've the following UDF code that attempts to apply a temperature-dependent source term to a solid cell.

#include "udf.h"
#include "mem.h"

DEFINE_SOURCE(cell_x_source,cell,thread,dS,eqn)
{
real source;
int Ro=12e-3; /*12mOhm at 20C*/
int To=20; /*temperature 20C*/
int Iphase=20; /*Arms*/

source=Iphase*Iphase*Ro*((C_T(cell,thread)-273)/To)/C_VOLUME(cell,thread);
Message("C_T output: %g\n",C_T(cell,thread));
Message("source output: %g\n",source);
Message("C_VOLUME output: %g\n",C_VOLUME(cell,thread));

return source;
}


While running 100 iterations, i observe in the Message output that the C_VOLUME of the solid cell is changing rather than keeping at a constant value as expected. why is this happening please?

The final outcome of the run was:
Error: Divergence detected in AMG solver: temperature
Error Object: #f

Hope to receive any comments/ideas you may have.
__________________
Thank you for your kind attention.

Kind regards,
mactech001
Currently using: ANSYS v13
mactech001 is offline   Reply With Quote

Old   January 18, 2013, 10:49
Default
  #4
New Member
 
Mukesh
Join Date: Sep 2012
Posts: 28
Rep Power: 14
er.mkumar is on a distinguished road
Hello,

Though I'm not sure if we could use the MACRO C_T(c,t) for SOURCE term in Energy equation, still I suggest you remove that C_VOLUME(c,t) as we must define source term as per unit volume to correctly solve the Energy eqn in FLUENT.

Hope that works.

All The Best,
Mukesh
er.mkumar is offline   Reply With Quote

Old   January 18, 2013, 11:56
Default
  #5
Senior Member
 
Join Date: Nov 2009
Posts: 125
Rep Power: 17
mactech001 is on a distinguished road
Dear Mukesh,
thank you for your response.

The C_VOLUME in my equation is to obtain the volume of the solid cell, and use it to divide my energy/power in order to express the source in per volume. Note that in the source equation, i've divided by C_VOLUME.

My only query is: Why the C_VOLUME value is changing from one iteration to the next?
__________________
Thank you for your kind attention.

Kind regards,
mactech001
Currently using: ANSYS v13
mactech001 is offline   Reply With Quote

Old   January 19, 2013, 06:07
Default
  #6
New Member
 
Mukesh
Join Date: Sep 2012
Posts: 28
Rep Power: 14
er.mkumar is on a distinguished road
Could you please send in your energy equation so as to check the units. FLUENT solves equations with source in Unit/volume terms only. So please check the units.

Best of Luck......Mukesh

Quote:
Originally Posted by mactech001 View Post
Dear Mukesh,
thank you for your response.

The C_VOLUME in my equation is to obtain the volume of the solid cell, and use it to divide my energy/power in order to express the source in per volume. Note that in the source equation, i've divided by C_VOLUME.

My only query is: Why the C_VOLUME value is changing from one iteration to the next?
er.mkumar is offline   Reply With Quote

Old   January 19, 2013, 09:31
Default
  #7
Senior Member
 
Join Date: Nov 2009
Posts: 125
Rep Power: 17
mactech001 is on a distinguished road
Dear Mukesh,

In my application, my source term:

source=Iphase*Iphase*Ro*((C_T(cell,thread)-273)/To)/C_VOLUME(cell,thread);

where,
Iphase*Iphase*Ro*((C_T(cell,thread)-273)/To) is in units of Watts

C_VOLUME(cell,thread) is in units of cubic meters;
__________________
Thank you for your kind attention.

Kind regards,
mactech001
Currently using: ANSYS v13
mactech001 is offline   Reply With Quote

Old   September 15, 2017, 11:27
Default
  #8
New Member
 
maziyar ghanikolahloo
Join Date: Jan 2017
Posts: 5
Rep Power: 9
maziyarghani is on a distinguished road
Dear machtech001,
I want to write a UDF in which there is a constant term and also a negative term which is related to temperature.
I am new to UDF how can I accomplish that?
I want to use Average Temp of the solid zone and
source term should be used just in solid zone.

#include "udf.h"

DEFINE_SOURCE(source_term,cell,thread,dS,eqn)
{
real source;
real temp=C_T(cell,thread);
int a=0.5546;
int b=1.84*10^-4;
int I=700;
int SCR=1000;
int A=373.83;
source=261682243-(a*(1-b)*temp)*I*SCR*A
return source
}
maziyarghani is offline   Reply With Quote

Old   September 17, 2018, 15:14
Default
  #9
New Member
 
Join Date: Sep 2018
Posts: 6
Rep Power: 8
Farsys is on a distinguished road
I have the same problem as you do,,did you get any response or solution to your case?
Farsys is offline   Reply With Quote

Old   March 14, 2024, 05:01
Default
  #10
New Member
 
ABHISHEK KUMAR
Join Date: Feb 2021
Posts: 2
Rep Power: 0
Abhishek8171 is on a distinguished road
I am looking your support to write a udf for ansys fluent dry iron thermal analysis.

In the first cycle of dry iron the energy source will be ON till the mid-point of iron reach at 170 °C then after energy source will OFF till the midpoint of iron cool down to 135 °C . When the mid point of iron will less than 135 °C then energy source will ON again till the mid-point of iron reach at 170 °C. This cycle will...
Abhishek8171 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
wmake compiling new solver mksca OpenFOAM Programming & Development 14 June 22, 2018 07:29
time dependent energy source term kevinz FLUENT 0 December 12, 2011 17:45
UDF for energy source term Muhammad Aamir Khan FLUENT 1 July 25, 2007 03:08
Time dependent Energy source Nitesh Main CFD Forum 0 July 17, 2006 14:19
Why FVM for high-Re flows? Zhong Lei Main CFD Forum 23 May 14, 1999 14:22


All times are GMT -4. The time now is 15:27.