CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > 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 Search this Thread 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: 14
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: 14
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: 14
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: 14
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: 14
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: 14
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: 14
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: 14
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: 14
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: 60
Rep Power: 13
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: 11
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

Old   January 8, 2019, 08:02
Default
  #13
New Member
 
Shiyao Xuan
Join Date: Mar 2018
Posts: 4
Rep Power: 8
xuansy is on a distinguished road
Hello, sunjian. I have the same problem, can you tell me how to solve this problem. Thank you.
xuansy is offline   Reply With Quote

Old   January 8, 2019, 08:03
Default
  #14
New Member
 
Shiyao Xuan
Join Date: Mar 2018
Posts: 4
Rep Power: 8
xuansy is on a distinguished road
Quote:
Originally Posted by sunjian View Post
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.
Hello, sunjian. I have the same problem, can you tell me how to solve this problem. Thank you.
xuansy is offline   Reply With Quote

Old   January 9, 2019, 02:11
Default
  #15
Member
 
Join Date: Apr 2012
Location: Trivandrum
Posts: 37
Rep Power: 14
toolpost is on a distinguished road
Hi xuan. I am in same situation, but the error message is different here. My case is serial run on a Linux system. It compiles fine, but crashes in first iteration itself.

Code:
  Node 0: Process 8824: Received signal SIGSEGV.
  ==============================================================================
 MPI Application rank 0 exited before MPI_Finalize() with status 2
  The fluent process could not be started.
Did you able to solve it?
toolpost is offline   Reply With Quote

Old   April 25, 2021, 09:07
Default
  #16
New Member
 
Join Date: Sep 2010
Location: Wuhan, China
Posts: 23
Rep Power: 15
qin chunqiu is on a distinguished road
Dear Shi-yao,
Have you solved this problem. In my case, the iteration is OK but results in a result contradicing to physics.
qin chunqiu is offline   Reply With Quote

Old   April 25, 2021, 12:51
Default
  #17
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Can you elaborate on the results you see? In which way do they contradict physics?

This information would help on how to fix the UDF...
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
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 01:50.