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

Error with UDF for Cp in terms of LIQF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2020, 12:44
Default Error with UDF for Cp in terms of LIQF
  #1
Senior Member
 
Join Date: Jan 2011
Posts: 339
Rep Power: 16
mariam.sara is on a distinguished road
Dear all
I tried to interpret the below UDF for specific heat Cp in terms of liquid fraction that used in Solidification/Melting model the UDF as below:

#include "udf.h"
DEFINE_SPECIFIC_HEAT(specificheat, T, Tref, h, yi)
{
#if !RP_HOST
real cpm,dt;
Tref=308;
real cps = 1800.0;
real cpl = 2400.0;
real lat = 160000.0;
real LIQF = C_T(cell, thread);
dt=exp(-T*(T-Tref)*(T-Tref)/4.0)/sqrt(4.0*3.14);
cpm =cps+(cpl-cps)*C_LIQF(c,t)+lat*dt;
*h = cpm*(T-Tref);
return cpm;
#endif
}

The problem I got the following errors with unknown reason:

Error: C:/Users/DELL/AppData/Local/Temp/cp.c.32836.11.c: line 7: parse error.
Error: C:/Users/DELL/AppData/Local/Temp/cp.c.32836.11.c: line 8: parse error.
Error: C:/Users/DELL/AppData/Local/Temp/cp.c.32836.11.c: line 9: parse error.
Error: C:/Users/DELL/AppData/Local/Temp/cp.c.32836.11.c: line 10: parse error.
Error: C:/Users/DELL/AppData/Local/Temp/cp.c.32836.11.c: line 12: cps: undeclared variable

Any suggestions, please?
Mariam
mariam.sara is offline   Reply With Quote

Old   May 29, 2020, 12:57
Default Specific Heat
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
DEFINE_SPECIFIC_HEAT is not executed at cell level like DEFINE_PROPERTY. That's why it requires a separate function while most of the other properties can be modeled using DEFINE_PROPERTY. It executes at material level and does not have access to cell and thread. C_T returns temperature of a cell but that is already available in form of T. If you are solving for species transport, then their mass fractions are available as yi. But you cannot access C_LIQF because its arguments are not available.

Lastly, you cannot interpret it. It must be compiled.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 13:01
Default
  #3
Senior Member
 
Join Date: Jan 2011
Posts: 339
Rep Power: 16
mariam.sara is on a distinguished road
Quote:
Originally Posted by vinerm View Post
DEFINE_SPECIFIC_HEAT is not executed at cell level like DEFINE_PROPERTY. That's why it requires a separate function while most of the other properties can be modeled using DEFINE_PROPERTY. It executes at material level and does not have access to cell and thread. C_T returns temperature of a cell but that is already available in form of T. If you are solving for species transport, then their mass fractions are available as yi. But you cannot access C_LIQF because its arguments are not available.

Lastly, you cannot interpret it. It must be compiled.
I do not use the species model just the solidification and melting model?
Do you mean I need to use compile to implement this UDF?

regards
mariam.sara is offline   Reply With Quote

Old   May 29, 2020, 13:28
Default Udf
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
You need to make changes to the UDF and then compile it. You cannot use C_T and C_LIQF. Those are not available within specific heat function.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 14:40
Default
  #5
Senior Member
 
Join Date: Jan 2011
Posts: 339
Rep Power: 16
mariam.sara is on a distinguished road
Actually I am not that familiar with UDF hence I have no idea what to do with C_T and LIQF? any suggestions are highly appreciated?

Regards
mariam.sara is offline   Reply With Quote

Old   May 29, 2020, 14:46
Default C_T and LIQF
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
C_T and C_LIQF are macros that return temperature and liquid fraction in a cell. However, cell temperature is already available as T, in case you need it to define specific heat. But you cannot access C_LIQF even if you need it. It all depends on the equation you have for specific heat. Does the equation require value of liquid fraction or temperature or not?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 15:08
Default
  #7
Senior Member
 
Join Date: Jan 2011
Posts: 339
Rep Power: 16
mariam.sara is on a distinguished road
Quote:
Originally Posted by vinerm View Post
C_T and C_LIQF are macros that return temperature and liquid fraction in a cell. However, cell temperature is already available as T, in case you need it to define specific heat. But you cannot access C_LIQF even if you need it. It all depends on the equation you have for specific heat. Does the equation require value of liquid fraction or temperature or not?
I think the equation function of both here is the equation attached
Attached Images
File Type: jpg 1.jpg (52.9 KB, 17 views)
mariam.sara is offline   Reply With Quote

Old   May 29, 2020, 15:15
Default Equation
  #8
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Rest is clear but what are f(T) and \Delta T?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 15:50
Default
  #9
Senior Member
 
Join Date: Jan 2011
Posts: 339
Rep Power: 16
mariam.sara is on a distinguished road
f(T) is the liquid fraction
deltaT is constant as 2 C
mariam.sara is offline   Reply With Quote

Old   May 29, 2020, 16:12
Default Liquid Fraction
  #10
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
That means f(T) = C_LIQF, however, you cannot access C_LIQF within DEFINE_SPECIFIC_HEAT. So, you have to define liquid fraction, somehow, in terms of T. Anyway, it is a function of T, that's why f(T).
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm 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
does Hyperthreading affect the application of UDF? SJSW Fluent UDF and Scheme Programming 11 October 10, 2018 22:28
Error code: 126 when loading parallel UDF Coop Fluent UDF and Scheme Programming 0 July 13, 2018 08:33
UDF source terms Andrew Garrard FLUENT 1 October 30, 2003 10:48
UDF for source terms Tom FLUENT 1 April 26, 2002 01:13
Convection Terms in UDF Jon Thorpe FLUENT 1 August 14, 2000 09:41


All times are GMT -4. The time now is 08:14.