|
[Sponsors] |
July 12, 2011, 00:13 |
User Defined Property-Density
|
#1 |
New Member
Join Date: Jun 2011
Posts: 3
Rep Power: 15 |
Hello,
I am trying to create a user defined density, which is temperature dependent. Basically, I have the values for the density at different temperatures and am using the UDF to interpolate the temperature in the cell to give the value for what the density should be. Below is the UDF that I have written. FLUENT will compile the UDF, but when I try to set the reference values or initialize the solution I get the following error: Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: #f Here is what I have for the UDF: #include "udf.h" int ctr; /*loop counter*/ double temp_data[201] = {280.00, 280.25, 280.50, 280.75, 281.00, 281.25, 281.50, 281.75, 282.00, 282.25, 282.50,282.75, ...(I'll omit the middle values), 330.00}; double dens_data[201] = {971.0105, 969.3090, 967.6075, 965.8965, 964.1615, 962.4265, 960.6770, 958.9135, 957.1450, 955.3620, ...(Omitting middle values), 197.7790}; DEFINE_PROPERTY(cell_density, cell, thread) { double rho; /* kg/m^3 */ double rho_1; /* kg/m^3 */ double rho_2; /* kg/m^3 */ double temp_1; /* Kelvin */ double temp_2; /* Kelvin */ double temp = C_T(cell, thread); for (ctr=0; ctr < 210; ctr++) { if (temp >= temp_data[ctr] && temp <= temp_data[ctr+1]) { temp_1 = temp_data[ctr]; temp_2 = temp_data[ctr+1]; rho_1 = dens_data[ctr]; rho_1 = dens_data[ctr+1]; rho = rho_1+(temp-temp_1)*(rho_2-rho_1)/(temp_2-temp_1); } else if (temp < temp_data[1]) { rho = 971.011; } else if (temp > temp_data[210]) { rho = 197.779; } else break; } return rho; } Thank you in advance for your help! |
|
July 12, 2011, 00:17 |
|
#2 |
New Member
Join Date: Jun 2011
Posts: 3
Rep Power: 15 |
Also, the flow is at a constant pressure throughout the whole system.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Set_material_property: null user defined function | Albert Franco | FLUENT | 1 | April 4, 2016 09:12 |
[General] Paraview User defined view | prapanj | ParaView | 3 | January 3, 2014 21:54 |
Creating new user defined material | Vidya | FLUENT | 4 | August 26, 2013 10:26 |
user defined turbulence model | manuutin | STAR-CD | 5 | October 14, 2009 06:29 |
User defined functions | Tuomas Koiranen | FLUENT | 2 | December 29, 1999 08:41 |