# deviation and Gradients

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

August 5, 2013, 16:22
#1
Member

Stephan Langenberg
Join Date: Sep 2011
Location: Germany
Posts: 73
Rep Power: 7
Hi,
In order to realize an equation (attached) I need to catch up some deviations (pressure Gradient and temperature Gradient).

- What is the best way to include deviations in a UDF? Should I use the Gradient Macro or is there a better way to use deviations?

- In my opinion I need a pointer on the deviations, are these pointer identic with the Macro-NAme (for examplecan I use C_P_G as pointer and function variable for the pressure deviation?)

- As a hint for me, Might this work? A= B*pressure'

.......
double A 0.0;
double B 0.0;

//variables

pressure' = C_P_G(c,t);

.......

Greetings,
Jim
Attached Images
 formel_pvT.JPG (52.8 KB, 10 views)

 August 8, 2013, 07:42 #3 Senior Member   Join Date: Aug 2011 Posts: 315 Rep Power: 14 Ensure that the pointer is not null. The macro might be invoked before the temperate gradient is calculated. Code: ```#include "udf.h" DEFINE_PROPERTY(test_Gradienten,c,t) { /************************************************** ************************** Standard UDF Befehle ************************************************** ***************************/ double Rho = 0.0; double gradient = 0.0; double s1 = 5; /************************************************** ************************** Variablen aufrufen ************************************************** ***************************/ if (NNULLP(THREAD_STORAGE(t, SV_T_G))) gradient = C_T_G(c,t)[1]; /************************************************** ************************* Zeiger Druck und Temperatur ************************************************** ***************************/ Rho = 1 + gradient * s1; return Rho; }``` Jim87 likes this.

 August 9, 2013, 06:44 #4 Member   Stephan Langenberg Join Date: Sep 2011 Location: Germany Posts: 73 Rep Power: 7 thank you. This one line fixed the UDF.

 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

All times are GMT -4. The time now is 04:15.

 Contact Us - CFD Online - Privacy Statement - Top