|
[Sponsors] |
Extracting Data from a DEFINE PROPERTY macro for use in another macro |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 19, 2019, 02:22 |
Extracting Data from a DEFINE PROPERTY macro for use in another macro
|
#1 |
Member
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 8 |
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; } In the above code, I tried typecasting, but I am clearly missing something. Any help would be appreciated |
|
March 19, 2019, 22:09 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
problem is here
Code:
real rho = (real)cell_Density; //trying to get the values real c = (real)my_user_cp; Code:
real rho = C_R(c,t); //trying to get the values real c = C_CP(c,t); best regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
extracting data from simh history file? | jasbirdhanoa | STAR-CCM+ | 3 | June 3, 2017 14:20 |
[swak4Foam] Extracting data using swak4foam | manuc | OpenFOAM Community Contributions | 0 | April 19, 2017 04:42 |
Extract Data from Polyline in a Macro (Tecplot) | Joe | Main CFD Forum | 0 | September 5, 2008 04:46 |
Extract Data from Polyline in a Macro | Joe | Main CFD Forum | 0 | September 5, 2008 04:45 |
UDF FOR UNSTEADY TIME STEP | mayur | FLUENT | 3 | August 9, 2006 11:19 |