# UDF: Pointing Cell Pressure

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 May 2, 2013, 09:26 UDF: Pointing Cell Pressure #1 Member   Stephan Langenberg Join Date: Sep 2011 Location: Germany Posts: 73 Rep Power: 7 While writing an UDf for compressible Polymers, I'm blocked by this Error: line 43: Pres: undeclared variable The manual informs that the pointer for Cell Pressure should be: C_P(c,t) cell_t c, Thread *t pressure I'm not able to find the mistake. Maybe someone with more experience could look at this few lines. ************************************************** *************************/ #include "udf.h" DEFINE_PROPERTY(UDF_Cell_Density_Durethan,c,t) { /************************************************** ************************** Standard UDF Befehle ************************************************** ***************************/ /*Domain * d; Thread * t; cell_t c; oder face_t f; Node *v;*/ /************************************************** ************* Aktuelle Temperatur an jeder Zelle aufrufen ************************************************** *************/ temp = C_T(c,t); /************************************************** ************* Aktuellen Druck an jeder Zelle aufrufen ************************************************** *************/ Pres = C_P(c,t); // This is the definition of Cell-Pressure /************************************************** ***************** Definition der Variablen // Parameters ************************************************** ******************/ double P1 = 19598.341796875 double P2 = 22733.578125 double P3 = 2.76653862 double P4 = 5604.6762695 double P5 = 5.1758676 double P6 = 0.06848801 double P7 = 0.0017973196 /************************************************** ************* spez. Volumen in Abhaengigkeit von Druck und Temperatur nach Schmidt // Equation ************************************************** *************/ Rho = 1/SpezVolu; spezVolu = p1 / (p2 + Pres) + (p3 * temp) / (p4 + Pres) + p5 * pow (( 2.718281828, (p6 * temp + p7 * Pres)); /********************************* Ende der Define Property **********************************/ } Any hint would be much appreciated.

 May 2, 2013, 10:42 #2 Senior Member   Join Date: Aug 2011 Posts: 315 Rep Power: 13 You need to declare a variable before you can use it. Add a line to declare Pres in the begining of your UDF function, i.e., DEFINE_PROPERTY(UDF_Cell_Density_Durethan,c,t) { real Pres; real temp; ... You should also receive another error for the variable temp because it has not been declared, either.

 May 2, 2013, 14:54 #3 Member   Stephan Langenberg Join Date: Sep 2011 Location: Germany Posts: 73 Rep Power: 7 Hallo blackmask, I corrected the mistake, but the error is the same. It seems Irrelevant if I use double or real, the definition * = 0.0 or change the structure of the udf by placing the definition of temperature and pressure in front of the pointer. ************************************************** *************************/ #include "udf.h" DEFINE_PROPERTY(UDF_Cell_Density_Durethan,c,t) { /************************************************** ************************** Standard UDF Befehle ************************************************** ***************************/ /*Domain * d; Thread * t; cell_t c; oder face_t f; Node *v;*/ /************************************************** ************* Aktuelle Temperatur an jeder Zelle aufrufen ************************************************** *************/ temp = C_T(c,t); /************************************************** ************* Aktuellen Druck an jeder Zelle aufrufen ************************************************** *************/ pressure = C_P(c,t); /************************************************** ***************** Definition der Variablen ************************************************** ******************/ double pressure = 0.0; double temp = 0.0; double P1 = 19598.341796875; double P2 = 22733.578125; double P3 = 2.76653862; double P4 = 5604.6762695; double P5 = 5.1758676; double P6 = 0.06848801; double P7 = 0.0017973196; /************************************************** ************* spez. Volumen in Abhaengigkeit von Druck und Temperatur nach Schmidt ************************************************** *************/ Rho = 1/SpezVolu; spezVolu = p1 / (p2 + pressure) + (p3 * temp) / (p4 + pressure) + p5 * pow (( 2.718281828, (p6 * temp + p7 * pressure)); /********************************* Ende der Define Property **********************************/ }

 May 2, 2013, 22:35 #4 Senior Member   Join Date: Aug 2011 Posts: 315 Rep Power: 13 Try this one. The comments are deleted for neatness. There is a reason that I put the two lines immediately after the open curly bracket ({) in my last post. You need to declare the variable first before use. You should use 'real' instead of 'double'. The 'real' is an alias for 'float' in single precision solver and 'double' in double precision solver. #include "udf.h" DEFINE_PROPERTY(UDF_Cell_Density_Durethan,c,t) { double pressure = 0.0; double temp = 0.0; double P1 = 19598.341796875; double P2 = 22733.578125; double P3 = 2.76653862; double P4 = 5604.6762695; double P5 = 5.1758676; double P6 = 0.06848801; double P7 = 0.0017973196; double spezVolu; temp = C_T(c,t); pressure = C_P(c,t); Rho = 1/SpezVolu; spezVolu = p1 / (p2 + pressure) + (p3 * temp) / (p4 + pressure) + p5 * pow (( 2.718281828, (p6 * temp + p7 * pressure)); }

 October 20, 2013, 13:56 #5 New Member   Harshad Join Date: May 2013 Posts: 13 Rep Power: 5 pressure and temp are calculated by C_P(c,t) and C_T(c,t) respectively I think,we cant assign value 0.0 Simply this should work: real pressure, temp; Inform me whether u cud succeed.... Gud luck

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post UnclePetors Fluent UDF and Scheme Programming 1 January 1, 2013 10:47 a.lynchy FLUENT 3 March 23, 2012 14:45 monica CD-adapco 1 April 19, 2007 11:26 James FLUENT 0 July 20, 2004 07:54 HB &DS CFX 0 January 9, 2000 14:19

All times are GMT -4. The time now is 12:28.

 Contact Us - CFD Online - Top