HOW TO WRITE UDF FOR DENSITY OF WATER

  • 478 Views
  • Last Post 13 September 2019
  • Topic Is Solved
Devank12 posted this 31 August 2018

I want to define Density of  water that varies with temperature  I have  written a UDF based on the following polynomial equation. I donot know it is right . If anycorrection plz inform me. Thanks

#include "udf.h"

DEFINE_PROPERTY(cell_density,cell,thread)

{

real rho;

real T = C_T(c,t);

rho = 765.33+1.8142*T – 0.0035*pow(T,2.)

C_UDMI(c,t,0) = rho;

return rho;

}

 

Order By: Standard | Newest | Votes
abenhadj posted this 31 August 2018

Help your self by using debugging messages. You have started with writing into UDMI's that if fine. You need to use the cell pointer and cell thread pointer passed by Fluent. Actually you don't need an UDF as you can use the polynomial option there.

Best regards,

Amine

RagnorakMan posted this 10 September 2019

Hi Devank, 

While this post is a year old but I've recently tried out your udf but for a solid. Just remember to change the cell and thread to c & t eitherwise FLUENT wouldn't recognize the other variables.

 

#include "udf.h"

DEFINE_PROPERTY(cell_density, c, t)

{

real rho;

real T = C_T(c,t);

rho = 765.33+1.8142*T – 0.0035*pow(T,2.)

C_UDMI(c,t,0) = rho;

return rho;

}

abenhadj posted this 10 September 2019

Why using an UDF to do just a temperature dependent density. Just use polynomial law in Fluent.

 

Best regards,

Amine

RagnorakMan posted this 12 September 2019

Because I'm trying to model a phase change material but as a solid. The drop down menu does not provide me with a polynomial function. Only the specific heat capacity and the thermal conductivity

abenhadj posted this 13 September 2019

You need to define that solid as a fluid in order to use phase change models or any phase-change related UDF.

Best regards,

Amine

Close