CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   somebody help me!!(regarding udf) (https://www.cfd-online.com/Forums/fluent/31026-somebody-help-me-regarding-udf.html)

guevara March 4, 2003 05:46

somebody help me!!(regarding udf)
 
I don't know wheather this form is correct or not. Can anyboby help me?

#include "udf.h"

#define PI 3.141579 #define I 36000 #define Jc 4400

DEFINE_SOURCE(thetamom_source, cell, thread, dS, eqn) {

real x[ND_ND];

real Rc, R, source1;

real Jz, B,y;

y=x[1];

Rc=sqrt(I/PI*Jc);

R=Rc*(1.+sqrt(x[0]/Rc));

if(y<=R)

{ C_CENTROID(x, cell, thread);

Jz = (2*I/PI*pow(R,4))*(pow(R,2)-pow(y,2));

B = I/PI*(y/pow(R,2)-(pow(y,3)/2*pow(R,4)));

source1= Jz*B;

if(y>R)

source1= 0;

dS[eqn]=0;

return source1;

}

- guevara

ccc, can you send me? if you can, i will appreciate it

Murali March 4, 2003 13:02

Re: somebody help me!!(regarding udf)
 
<font face = "courier new">some tips that were suggested to me while writing udfs are:

(1) the #define statements each better be in different lines

(2) do not ever try to cut a long stmt into parts and continue the trailing part in the next line. Write the full stmt in the same line

(3) do not use /* and */ for commenting huge chunks of code. Use them for commenting single lines

Other than these company tips, whatever you write is your code. U don't really have to by ultra-proficient in C to programme UDFs. A little application of mind with a lot of copy-paste from UDF manuals should take care of UDFs.

Hope this helps

Murali </font>

ccc March 4, 2003 21:41

Re: somebody help me!!(regarding udf)
 
hi, guevara: sorry, I am out for several days. I will send it to you and others who want it tonight and you might recieve it today or tomorrow due to the time difference.

guevara March 5, 2003 04:48

Re: somebody help me!!(regarding udf)
 
thanks ccc.


All times are GMT -4. The time now is 10:50.