CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   user defined function (https://www.cfd-online.com/Forums/fluent/212264-user-defined-function.html)

ASCT November 29, 2018 08:14

user defined function
 
hi guys,

I am facing an error called no function prototype.
can you guys please help me with that. my code is
#include "udf.h"
DEFINE_PROFILE(heatflux,thread,nv)
{
int p=110.111;
int i;
int h[6]={123800,3033966,6067932,788100,62205,45600};
float n[0];

int num=6;
face_t f;
begin_f_loop(f,thread);
{
F_CENTROID(n,f,thread);

for(i=1;i<num;i++);
{
F_PROFILE(f, thread, nv) = h(i) + ((h(i+1)-h(i))*(p-n(i)))/(n(i+1)-n(i));
}
/*return 1;*/
}
end_f_loop(f,thread);
}

I am trying to do piecewise linear approximation for heat flux variation along the length of the rocket nozzle.

AlexanderZ December 2, 2018 23:25

Code:

DEFINE_PROFILE(heatflux,thread,nv)
{
real p=110.111;
int i;
real h[]={123800,3033966,6067932,788100,62205,45600};
real n[]={123800,3033966,6067932,788100,62205,45600};
int num=6;
face_t f;
begin_f_loop(f,thread);
        {
                F_CENTROID(n,f,thread);
                for(i=1;i<num;i++);
                {
                        F_PROFILE(f, thread, nv) = h[i] + ((h[i+1]-h[i])*(p-n[i]))/(n[i+1]-n[i]);
                }
        }
end_f_loop(f,thread);
}

best regards

ASCT December 3, 2018 01:26

Thank you @Alexanderz


All times are GMT -4. The time now is 06:20.