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

information from a surface, not made from GAMBIT

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2009, 11:08
Default information from a surface, not made from GAMBIT
  #1
Member
 
R. Roy
Join Date: Mar 2009
Location: India
Posts: 52
Rep Power: 17
rr123 is on a distinguished road
dear all,

i have a small problem which is related to the post-processing of data from a surface, which is created in the Fluent, and not from GAMBIT.

i have 2d vertical channel. i have made few horizontal surfaces (using line/rake option). let the surfaces be y = 1 m, y = 2m, etc.
Note: These surfaces are not created in GAMBIT, they are just created as a post-processing feature in the case/data file itself.

now, my main requirement is to know some of the properties (like moments) of these surfaces. these moments are population balance variables.
The entire description of this variabe in the PBM manual is:

Macro Argument Types Returns
C_PB_QMOMI cell t_c, Thread *t, int i ith moment, where i = 0;
1;2; 3; 4; 5

if some one can share me the main code snippet that i must do as a UDF, it would be very useful. my main query is what domain and the thread macros that i must use.

thanks in advance.

rr123
rr123 is offline   Reply With Quote

Old   March 22, 2009, 23:35
Default
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
Why not simply report those moment in Fluent to file? I guess it is under Report -> Moments? Unless you've got more variables which you cannot easily access in Fluent.
paka is offline   Reply With Quote

Old   March 23, 2009, 04:02
Default
  #3
Member
 
R. Roy
Join Date: Mar 2009
Location: India
Posts: 52
Rep Power: 17
rr123 is on a distinguished road
yes, i know that method and i consder it as a work-around only.
but my query is why not i make a UDF which would solve this problem.
something, whcih i could have executed as a post-processing macro.
rr123 is offline   Reply With Quote

Old   March 23, 2009, 05:19
Default
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
Maybe I'm mistaken, but there is no need to define post-processing UDF. You define UDF to do "things" during computational process. Afterwards, I would use any scripting language to get what I need from saved ASCII files with necessary output.
paka is offline   Reply With Quote

Old   March 23, 2009, 06:30
Default
  #5
Member
 
R. Roy
Join Date: Mar 2009
Location: India
Posts: 52
Rep Power: 17
rr123 is on a distinguished road
Indeed you are very right sir.
I am just trying to make a use of a UDF.
In theory, a UDF 'is' possible to make for this and i just want to make it.

Thanks and regards.
rr123 is offline   Reply With Quote

Old   March 23, 2009, 06:49
Default
  #6
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
OK. Good luck
paka is offline   Reply With Quote

Old   March 23, 2009, 21:37
Default
  #7
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
panda is on a distinguished road
It seems Fluent UDF cannot access the surfaces you created for post-processing. Actually, for unsteady flows sometimes we really need such a UDF to access the newly created surfaces to get the time-dependant local response.
panda is offline   Reply With Quote

Old   March 25, 2009, 17:20
Default
  #8
Member
 
R. Roy
Join Date: Mar 2009
Location: India
Posts: 52
Rep Power: 17
rr123 is on a distinguished road
i also understand that UDF can't access the surfaces which i made.
but why not ?
where is the problem ?
i am not interested in the work-around problem said by paka.


#include
"udf.h"
#include"sg_pb.h"
#include"sg_mphase.h"
#define NIDS (sizeof (idmeters) / sizeof (idmeters[0])) /* #define is a macro, the division means total array size/first element of the array size */
#define NMOM 6
struct idmeter
{
int id;
real meter;
};

DEFINE_ON_DEMAND (execute)
{
int i;
int j;
struct idmeter idmeters[] = { /* idmeters is a structured array with two elements */
{12, 1.0}, /* first id, then meter correspondingly for one surface */
{13, 3.9}, /* then for another surface, and so on.. */
{14, 10.0}
};

FILE *postprocess;
Domain *d;
real time = CURRENT_TIME;
/* getting time */
real mu;
real sigma;
postprocess = fopen (
"results.txt", "a"); /* writing with several moments at a time */

for (j = 0; j < NIDS; j++)
{
int id = idmeters[j].id; /* the dot operator means that for the jth element of the idmeters array, the value of the element that is id */
real meter = idmeters[j].meter;
real A[NMOM];
/* temporary data array */
real T[NMOM]; /* temporary data array */
for (i = 0; i < NMOM; i++)
T[i] = 0;
cell_t c;
d = Get_Domain (3);
/* solid phase domain */
Thread *c_thread = Lookup_Thread (d, id);
begin_c_loop (c, c_thread)
{
for (i = 0; i < NMOM; i++)
T[i] += A[i] = C_PB_QMOMI (c, c_thread, i);
fprintf (postprocess,
"cell %12.5e %d %12.5e", time, id, meter);

for (i = 0; i < NMOM; i++)
fprintf (postprocess,
"%12.5e", A[i]);
mu = A[1] / A[0];
sigma = A[2] / A[0];
fprintf (postprocess,
"%12.5e %12.5e\n", mu, sigma);
}
end_c_loop (c, c_thread);

}

fclose (postprocess);
}

--------------------

am i correct in the logic ?
i checked, the code is not giving any error on compilation; but it gives
Stack backtrace generated for process id 32337 on signal 1....
with a segmentation violation

hope someone helps

best wishes

rr123
rr123 is offline   Reply With Quote

Reply


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
mass flow rate on the Iso-clip surface & interior Sunil Gupta FLUENT 0 April 22, 2008 10:29
meshing a fan using gambit tony FLUENT 1 February 15, 2008 01:28
[Commercial meshers] Internal surface import from gambit mighelone OpenFOAM Meshing & Mesh Conversion 2 February 6, 2008 19:07
Gambit: Volume mesh starting from floating surface Peter FLUENT 0 July 31, 2007 14:26
user surface in post xinzhangabc CFX 0 February 24, 2005 07:29


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