|
[Sponsors] |
December 8, 2004, 08:14 |
UDF to change density in species transport
|
#1 |
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); } |
|
December 8, 2004, 08:45 |
Re: UDF to change density in species transport
|
#2 |
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. |
|
December 8, 2004, 08:59 |
Re: UDF to change density in species transport
|
#3 |
Guest
Posts: n/a
|
|
|
December 8, 2004, 09:31 |
Re: UDF to change density in species transport
|
#4 |
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 |
|
December 8, 2004, 10:01 |
Re: UDF to change density in species transport
|
#5 |
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); } |
|
December 8, 2004, 10:03 |
Re: UDF to change density in species transport
|
#6 |
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. |
|
December 8, 2004, 19:19 |
Re: UDF to change density in species transport
|
#7 |
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 |
|
|
|
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 04: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 24, 2008 00:53 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 05:41 |