CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Can't interpret my udf (MPT_gisum1: no function prototype) (https://www.cfd-online.com/Forums/fluent-udf/141708-cant-interpret-my-udf-mpt_gisum1-no-function-prototype.html)

nnvoro September 14, 2014 13:46

Can't interpret my udf (MPT_gisum1: no function prototype)
 
Dear all,

I'm currently trying to set up the resistance boundary condition on the pressure-outlet to model blood flow in the vessel tree.

The idea is to calculate flow rate trough the outlet at each time instant and then calculate the lumped parameter model pressure using formula: P=Q*R where R is resistance (parameter values for which are taken from literature). Lumped parameter model (P,Q) can be coupled to the outlet boundary of the computational domain (p,v) by:

Q = -\int_\Gamma v*n d\Gamma
-Pn = pn+\mu(\nabla v)n

where \Gamma - outlet, v - velocity, and n - normal vector. P and p are scalars. Using these formulas I get pressure p and set it as the pressure-outlet condition.

I wrote udf to set up this boundary condition. UDF is for parallel computation. When I interpret it I get an error: line 73: MPT_gisum1: no function prototype. The line which gives me an error is shown in red in the code.

Here is my UDF:

DEFINE_PROFILE(pressure_profile1,t,i)
{
/* Variables used by serial, host, node versions */
real Q = 0.;
real R1 = 10.; /*resistance value downstream outlet*/
real P;
real flow_time = RP_Get_Real("flow-time");
face_t f;
if (flow_time == 0.)
{
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = 0.;
}
end_f_loop(f,t)
}
else
{
#if !RP_HOST
/*calculate flow through the outlet*/
begin_f_loop(f,t)
{
Q += F_FLUX(f,t);
}
end_f_loop(f,t)

#if RP_NODE
Q = PRF_GISUM1(Q); /* summation of the flow rate*/
#endif /* RP_NODE */

#endif /* !RP_HOST */

P=Q*R1;/*calculate resistance BC model pressure*/
Q = 0.;
/*calculate pressure at the outlet*/

begin_f_loop(f,t)
{
.................................................. ..................
.................................................. ..................
here comes the part where I calculate pressure p
which I removed from the post
.................................................. ..................
.................................................. ..................
F_PROFILE(f,t,i) = ... ;
}
end_f_loop(f,t)
}
}

Could you please help me with this problem?

Thanks

nnvoro

nnvoro September 17, 2014 13:28

I think I found the solution to this problem. Before I was interpreting this UDF and it didn't work. It seems that some functions needed to be compiled. When I compiled it it started to work.

shandongliutao January 29, 2015 01:02

Hi, nnvoro!
I am also trying to simulate blood flow with resistance boundary condition,
but i use openfoam.The problem is that with patient-specific model openfoam didn't converge well .So i want to have a try with fluent. Did your result converge well and is reasonable? Thank you.

AhmadKoolivand August 24, 2022 09:53

compiled udfs don't print values in console
 
Quote:

Originally Posted by nnvoro (Post 510700)
I think I found the solution to this problem. Before I was interpreting this UDF and it didn't work. It seems that some functions needed to be compiled. When I compiled it it started to work.

Hi. When I compile below UDF, it does not print value n but when I interpret it, value n gets printed. How can I fix this problem with compiled UDFs?

#include"udf.h"

DEFINE_ADJUST(cellcounter,domain)
{
#if !RP_HOST
Thread *t;
cell_t c;
int n=0;


thread_loop_c(t,domain)
{
begin_c_loop_int(c,t)
{
n+=1;
}
end_c_loop_int(c,t)
}
printf("n: %d\n", n);
#endif
}


All times are GMT -4. The time now is 16:02.