CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for Temperature Dependent Energy Source (http://www.cfd-online.com/Forums/fluent-udf/110371-udf-temperature-dependent-energy-source.html)

er.mkumar December 10, 2012 01:20

UDF for Temperature Dependent Energy Source
 
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

mactech001 January 11, 2013 04:28

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.

mactech001 January 18, 2013 04:32

problem on UDF returned parameters
 
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.

er.mkumar January 18, 2013 09:49

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

mactech001 January 18, 2013 10:56

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 January 19, 2013 05:07

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 (Post 402697)
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?


mactech001 January 19, 2013 08:31

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;


All times are GMT -4. The time now is 09:18.