CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

UDF to change density in species transport

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 8, 2004, 08:14
Default UDF to change density in species transport
  #1
Karthik
Guest
 
Posts: n/a
Hello all,

I am trying to fix upthe density values in a three dimensional cylindrical enclosure for which I give the density distribution at each cells. I am using species transport model. Interpreting does not display any result but when iterated Fluent displays error saying

"chip-exec: den_adjust: wrong return type: float udf function expected"

Could you please help to solve this problem. The udf i used is

#include "udf.h" DEFINE_ADJUST(den_adjust,d) {

Domain *d;

Thread *t;

cell_t c;

FILE *fp1;

real arr1=0.;

fp1=fopen("densitynew.dat","r");

begin_c_loop(c,t)

{

fscanf(fp1,"%g",&arr1);

C_R(c,t)=arr1;

}

end_c_loop(c,t)

printf("The density of cells are patched successfully");

fclose(fp1); }
  Reply With Quote

Old   December 8, 2004, 08:45
Default Re: UDF to change density in species transport
  #2
Andrew Garrard
Guest
 
Posts: n/a
Well I am unfamiliar with reading in data from a file, but from your UDF I can see that you are trying to conduct a cell loop over a thread that has not been defined. I don't know if that is causing your error, but if it isn't, it would cause a different one.

When I am creating UDF's I usually make them very simple, see if they work and then increase the complexity. That way de bugging becomes very easy. Try getting C_R(c,t) to be a constant value first, and see if that works before trying to read from a file.
  Reply With Quote

Old   December 8, 2004, 08:59
Default Re: UDF to change density in species transport
  #3
Chimwemwe Banda
Guest
 
Posts: n/a
  Reply With Quote

Old   December 8, 2004, 09:31
Default Re: UDF to change density in species transport
  #4
Karthik
Guest
 
Posts: n/a
Thanks Andrew for your attempt. But i have tried with declaring the cell values with a constant density also. I face with the same error. I hope that this error is not due to the variable values but in some other thing. Whats wrong in "return type" that could be seen in the error message?

chip-exec: den_adjust: wrong return type: float udf function expected
  Reply With Quote

Old   December 8, 2004, 10:01
Default Re: UDF to change density in species transport
  #5
hongfw
Guest
 
Posts: n/a
If you amend your UDF like following, The problem may be solved.

#include "udf.h" DEFINE_ADJUST(den_adjust,d) {

Thread *t;

cell_t c;

FILE *fp1;

real arr1=0.;

fp1=fopen("densitynew.dat","r");

thread_loop_c(t, d) { begin_c_loop(c,t)

{

fscanf(fp1,"%g",&arr1);

C_R(c,t)=arr1;

}

end_c_loop(c,t)

} printf("The density of cells are patched successfully");

fclose(fp1); }

  Reply With Quote

Old   December 8, 2004, 10:03
Default Re: UDF to change density in species transport
  #6
Andrew Garrard
Guest
 
Posts: n/a
It the first part of my message I mention this:

Well I am unfamiliar with reading in data from a file, but from your UDF I can see that you are trying to conduct a cell loop over a thread that has not been defined.

When you invoke the cell loop, you are applying a condition to every cell on a particular "cell thread". You delcare a thread pointer, in your case *t, but you do not tell the UDF what thread it is.

You will need to put in a line something like this

Thread *t = Lookup_Thread(ID, dom)

Where ID is the boundary ID, avaliable in the boundary condition panel and domain is your domain pointer, as passed in the argument of the DEFINE_ADJUST. There is more info at 6.5.7 in the UDF manual.

  Reply With Quote

Old   December 8, 2004, 19:19
Default Re: UDF to change density in species transport
  #7
cg
Guest
 
Posts: n/a
Try using a

DEFINE_PROPERTY(lem_density,c,t) { real rho;

rho = ...

return rho; }

and hook this to density in the Materials panel
  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 species equations louiza FLUENT 4 March 10, 2010 02:20
PB: Saving mass fraction of species on two points with an udf biget.a FLUENT 2 July 23, 2009 03:06
Model foaming process: change the volume / density pmp77 CFX 0 November 18, 2008 10:53
Species Transport with Multiphase flow in FBR venkat FLUENT 1 July 23, 2008 23:53
Warning 097- AB CD-adapco 6 November 15, 2004 05:41


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