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

Extracting Data from a DEFINE PROPERTY macro for use in another macro

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 19, 2019, 01:22
Default Extracting Data from a DEFINE PROPERTY macro for use in another macro
  #1
Member
 
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 7
Sorabh is on a distinguished road
Code:
DEFINE_PROPERTY(cell_Density,c,t) //density defined
{
	real density;
	real temp = C_T(c,t);
	if (temp < 273)
		density = 921;
	else
		density = 999;

	return density;
}

 DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi) //specific heat defined
 {
   real cp;
   if (T<265)
	   cp = 1800;
   else if (T >= 265 && T < 270)
	   cp = 1800 + 102.856*(T-265);
   else if (T>=270 && T <= 272)
	   cp = 3600 + 642.8*(T-272);
   else
	   cp = 3600;
   *h = cp*(T-Tref);
   return cp;
 }

DEFINE_SOURCE(perfusion_2,c,t,dS,eqn) //need to extract the value of the above macros for this
{
	real physical_dt,temp_old,temp_now,temp_older,T_derivative,source; //source_1
	real T_derivative_now,T_derivative_old,T_derivative_2;
	physical_dt = RP_Get_Real("physical-time-step");
	temp_older = C_T_M2(c,t);
	temp_old= C_T_M1(c,t);
	temp_now=C_T(c,t);
	T_derivative_now=(temp_now-temp_old)/physical_dt;	
	T_derivative_old = (temp_old-temp_older)/physical_dt;

	T_derivative_2 = (T_derivative_now-T_derivative_old)/physical_dt;
	
	real rho = (real)cell_Density; //trying to get the values
	real c = (real)my_user_cp;

	source = tq*rho*c*T_derivative_2;
	dS[eqn]=0;

	return source;
}
I intend to use the property off the 2 DEFINE_PROPERTY macros, and use it in the DEFINE_SOURCE macro. How should I do it?

In the above code, I tried typecasting, but I am clearly missing something.

Any help would be appreciated
Sorabh is offline   Reply With Quote

Old   March 19, 2019, 21:09
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
problem is here
Code:
	real rho = (real)cell_Density; //trying to get the values
	real c = (real)my_user_cp;
you've defined macros for density and specific heat so you should use macros to get that values

Code:
	real rho = C_R(c,t); //trying to get the values
	real c = C_CP(c,t);
for more information look into Ansys Fluent Customization manual

best regards
AlexanderZ 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
extracting data from simh history file? jasbirdhanoa STAR-CCM+ 3 June 3, 2017 13:20
[swak4Foam] Extracting data using swak4foam manuc OpenFOAM Community Contributions 0 April 19, 2017 03:42
Extract Data from Polyline in a Macro (Tecplot) Joe Main CFD Forum 0 September 5, 2008 03:46
Extract Data from Polyline in a Macro Joe Main CFD Forum 0 September 5, 2008 03:45
UDF FOR UNSTEADY TIME STEP mayur FLUENT 3 August 9, 2006 10:19


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