CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Problem with DEFINE_UDS_FLUX

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 15, 2012, 11:55
Smile Problem with DEFINE_UDS_FLUX
  #1
New Member
 
Ryan
Join Date: Mar 2012
Posts: 11
Rep Power: 6
cfdmatteo is on a distinguished road
hi there,

I am learning to use DEFINE_UDS_FLUX macro, and I follow the UDF Manual
example but somehow there's a problem :

Here's my code:

#include "udf.h"

DEFINE_UDS_FLUX(ws_flux,f,t,i)
{
cell_t cO, c1=-1;
Thread *t0, *t1 = NULL;

real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;

c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A,f,t);

if(BOUNDARY_FACE_THREAD_P(T))
{

real dens;
if(NNULP(THREAD_STORAGE(t,SV_DENSITY)))
dens=F_R(f,t);
else
dens=C_R(c0,t0);

NV_DS(psi_vec,=,F_U(f,t),F_V(f,t),F_W(f,t),*,dens) ;
flux=NV_DOT(psi_vec,A);
}
else
{
c1=F_C1(f,t);
t1=F_C_THREAD(f,t);

NV_DS(psi_vec,=,C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),* ,C_R(c0,t0));
NV_DS(psi_vec,+=,C_U(c1,t1),C_V(c1,t1),C_W(c1,t1), *,C_R(c1,t1));
flux=NV_DOT(psi_vec,A)/2.0;
}
return flux;
}


And after I interpreting this macro, the command shows this error:

Error: D:\ryan\source_code\ws_flux.c: line 11: THREAD_STORE: undeclared variable

Can anybody help me? Any suggestion will be appreciated!

best regard, Ryan

Last edited by cfdmatteo; April 16, 2012 at 04:05.
cfdmatteo is offline   Reply With Quote

Old   April 16, 2012, 03:41
Default
  #2
New Member
 
Andreas K
Join Date: Apr 2012
Location: Austria
Posts: 1
Rep Power: 0
MMMSim is on a distinguished road
Hi Ryan,

I think you wrote a typo in line 11:
t0 = F_C0_THEREAD(f,t);
try
t0 = F_C0_THREAD(f,t);
instead

good luck!
MMMSim is offline   Reply With Quote

Old   April 16, 2012, 04:05
Default
  #3
New Member
 
Ryan
Join Date: Mar 2012
Posts: 11
Rep Power: 6
cfdmatteo is on a distinguished road
Quote:
Originally Posted by MMMSim View Post
Hi Ryan,

I think you wrote a typo in line 11:
t0 = F_C0_THEREAD(f,t);
try
t0 = F_C0_THREAD(f,t);
instead

good luck!
Dear Andreas K,
Thanks for your suggestion. : )
I'v fixed the code but still getting with the same problem.
It seems the DEFINE_UDS_FLUX example of the Manual is of defect.
Since I directly copy the code of example and somehow the same
error comes up.
cfdmatteo is offline   Reply With Quote

Old   April 16, 2012, 05:09
Default
  #4
New Member
 
Ryan
Join Date: Mar 2012
Posts: 11
Rep Power: 6
cfdmatteo is on a distinguished road
Quote:
Originally Posted by cfdmatteo View Post
hi there,

I am learning to use DEFINE_UDS_FLUX macro, and I follow the UDF Manual
example but somehow there's a problem :

Here's my code:

#include "udf.h"

DEFINE_UDS_FLUX(ws_flux,f,t,i)
{
cell_t cO, c1=-1;
Thread *t0, *t1 = NULL;

real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;

c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A,f,t);

if(BOUNDARY_FACE_THREAD_P(T))
{

real dens;
if(NNULP(THREAD_STORAGE(t,SV_DENSITY)))
dens=F_R(f,t);
else
dens=C_R(c0,t0);

NV_DS(psi_vec,=,F_U(f,t),F_V(f,t),F_W(f,t),*,dens) ;
flux=NV_DOT(psi_vec,A);
}
else
{
c1=F_C1(f,t);
t1=F_C_THREAD(f,t);

NV_DS(psi_vec,=,C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),* ,C_R(c0,t0));
NV_DS(psi_vec,+=,C_U(c1,t1),C_V(c1,t1),C_W(c1,t1), *,C_R(c1,t1));
flux=NV_DOT(psi_vec,A)/2.0;
}
return flux;
}


And after I interpreting this macro, the command shows this error:

Error: D:\ryan\source_code\ws_flux.c: line 11: THREAD_STORE: undeclared variable

Can anybody help me? Any suggestion will be appreciated!

best regard, Ryan
Well, the first problem seems to be solved since I subtitute
t0 = F_C0_THREAD(f,t) with t0 = THREAD_T0(t).

But here comes other problems :

for line 14 if(BOUNDARY_FACE_THREAD_P(T)) :
Error: D:\ryan\source_code\ws_flux.c: line 14: parse error.

and for line 20 dens = F_R(f,t); :
Error: D:\ryan\source_code\ws_flux.c: line 20: dens: undeclared variable

Any suggestion?
Ryan
cfdmatteo is offline   Reply With Quote

Old   April 22, 2012, 03:12
Default
  #5
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 6
chenxizh is on a distinguished road
Hi, you have serval mistakes in your udf, here the correct one is following, any way do you used it in multiphase?

#include "udf.h"

DEFINE_UDS_FLUX(ws_flux,f,t,i)
{
cell_t c0, c1=-1;
Thread *t0, *t1 = NULL;

real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;

c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A,f,t);

if(BOUNDARY_FACE_THREAD_P(t))
{

real dens;
if(NNULLP(THREAD_STORAGE(t,SV_DENSITY)))
dens=F_R(f,t);
else
dens=C_R(c0,t0);

NV_DS(psi_vec,=,F_U(f,t),F_V(f,t),F_W(f,t),*,dens) ;
flux=NV_DOT(psi_vec,A);
}
else
{
c1=F_C1(f,t);
t1=F_C1_THREAD(f,t);

NV_DS(psi_vec,=,C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),* ,C_R(c0,t0));
NV_DS(psi_vec,+=,C_U(c1,t1),C_V(c1,t1),C_W(c1,t1), *,C_R(c1,t1));
flux=NV_DOT(psi_vec,A)/2.0;
}
return flux;
}




Quote:
Originally Posted by cfdmatteo View Post
Well, the first problem seems to be solved since I subtitute
t0 = F_C0_THREAD(f,t) with t0 = THREAD_T0(t).

But here comes other problems :

for line 14 if(BOUNDARY_FACE_THREAD_P(T)) :
Error: D:\ryan\source_code\ws_flux.c: line 14: parse error.

and for line 20 dens = F_R(f,t); :
Error: D:\ryan\source_code\ws_flux.c: line 20: dens: undeclared variable

Any suggestion?
Ryan
chenxizh is offline   Reply With Quote

Old   April 22, 2012, 05:24
Default
  #6
New Member
 
Ryan
Join Date: Mar 2012
Posts: 11
Rep Power: 6
cfdmatteo is on a distinguished road
Quote:
Originally Posted by chenxizh View Post
Hi, you have serval mistakes in your udf, here the correct one is following, any way do you used it in multiphase?

#include "udf.h"

DEFINE_UDS_FLUX(ws_flux,f,t,i)
{
cell_t c0, c1=-1;
Thread *t0, *t1 = NULL;

real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;

c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A,f,t);

if(BOUNDARY_FACE_THREAD_P(t))
{

real dens;
if(NNULLP(THREAD_STORAGE(t,SV_DENSITY)))
dens=F_R(f,t);
else
dens=C_R(c0,t0);

NV_DS(psi_vec,=,F_U(f,t),F_V(f,t),F_W(f,t),*,dens) ;
flux=NV_DOT(psi_vec,A);
}
else
{
c1=F_C1(f,t);
t1=F_C1_THREAD(f,t);

NV_DS(psi_vec,=,C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),* ,C_R(c0,t0));
NV_DS(psi_vec,+=,C_U(c1,t1),C_V(c1,t1),C_W(c1,t1), *,C_R(c1,t1));
flux=NV_DOT(psi_vec,A)/2.0;
}
return flux;
}
hi
Thanks a lot for your help.
I am trying to calculate a multiphase problem. And as following your fixed code, it's still get some problem. Anyway, some say that might be a "interpreted or compiled" problem. Did you read this code by "interpreted" or by "compiled" in Fluent?

I was interpreting it and always got errors as :

Error: D:\ryan\paper comfirm\cfd_help_ws_flux.c: line 11: THREAD_STORE:undeclared variable
cfdmatteo is offline   Reply With Quote

Old   April 22, 2012, 05:27
Default
  #7
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 6
chenxizh is on a distinguished road
I use complie, there is no problem in my code
notice,the scalar transport in multiphase contain the volume fraction

Quote:
Originally Posted by cfdmatteo View Post
hi
Thanks a lot for your help.
I am trying to calculate a multiphase problem. And as following your fixed code, it's still get some problem. Anyway, some say that might be a "interpreted or compiled" problem. Did you read this code by "interpreted" or by "compiled" in Fluent?

I was interpreting it and always got errors as :

Error: D:\ryan\paper comfirm\cfd_help_ws_flux.c: line 11: THREAD_STORE:undeclared variable
chenxizh is offline   Reply With Quote

Old   April 22, 2012, 06:18
Default
  #8
New Member
 
Ryan
Join Date: Mar 2012
Posts: 11
Rep Power: 6
cfdmatteo is on a distinguished road
Quote:
Originally Posted by chenxizh View Post
I use complie, there is no problem in my code
notice,the scalar transport in multiphase contain the volume fraction
hi,
I appreciate for your reply, it's really helpful for me.
cfdmatteo is offline   Reply With Quote

Old   April 22, 2012, 06:21
Default
  #9
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 6
chenxizh is on a distinguished road
what is the problem you are studying? I aslo used uds in multiphase, and I find that the uds is unbound.
Quote:
Originally Posted by cfdmatteo View Post
hi,
I appreciate for your reply, it's really helpful for me.
chenxizh is offline   Reply With Quote

Old   April 22, 2012, 06:37
Default
  #10
New Member
 
Ryan
Join Date: Mar 2012
Posts: 11
Rep Power: 6
cfdmatteo is on a distinguished road
Quote:
Originally Posted by chenxizh View Post
what is the problem you are studying? I aslo used uds in multiphase, and I find that the uds is unbound.
hi,
I study on fuel cell calculating, and I use the PEMFC module of the Fluent but somehow the model is of defect.
I think the multiphase model of this module is UFT model,but the flux term is neglected, so I try to fixed the problem by UDF.
cfdmatteo is offline   Reply With Quote

Old   April 30, 2012, 02:27
Default Udf help
  #11
Member
 
Join Date: Apr 2012
Location: Mainz, Germany
Posts: 57
Rep Power: 6
juzer_700 is on a distinguished road
Is there a predefined macro under which I can write a new model (combustion model). I dont plan to use any combustion model provided in FLUENT.

Please help. I want to link the advance combustion model to fluent.

Under which DEFINE macro should I write my code???

Any help will be appreciate.
juzer_700 is offline   Reply With Quote

Old   July 29, 2014, 04:43
Default
  #12
New Member
 
Join Date: Jun 2014
Posts: 16
Rep Power: 4
sunjian is on a distinguished road
Quote:
Originally Posted by chenxizh View Post
Hi, you have serval mistakes in your udf, here the correct one is following, any way do you used it in multiphase?

#include "udf.h"

DEFINE_UDS_FLUX(ws_flux,f,t,i)
{
cell_t c0, c1=-1;
Thread *t0, *t1 = NULL;

real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;

c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A,f,t);

if(BOUNDARY_FACE_THREAD_P(t))
{

real dens;
if(NNULLP(THREAD_STORAGE(t,SV_DENSITY)))
dens=F_R(f,t);
else
dens=C_R(c0,t0);

NV_DS(psi_vec,=,F_U(f,t),F_V(f,t),F_W(f,t),*,dens) ;
flux=NV_DOT(psi_vec,A);
}
else
{
c1=F_C1(f,t);
t1=F_C1_THREAD(f,t);

NV_DS(psi_vec,=,C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),* ,C_R(c0,t0));
NV_DS(psi_vec,+=,C_U(c1,t1),C_V(c1,t1),C_W(c1,t1), *,C_R(c1,t1));
flux=NV_DOT(psi_vec,A)/2.0;
}
return flux;
}
Hi, chenxizh. Have you tried to calculate with this code? This code could be compiled without any error. But when iteration was run, the error access_violation occured. What do you think the problem is? I am looking forward to your reply. Thank you.
sunjian is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


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