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

UDF to find Species mass fraction parallel Linux

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2015, 06:53
Default UDF to find Species mass fraction parallel Linux
  #1
New Member
 
Join Date: Oct 2014
Posts: 17
Rep Power: 11
Schumacher00 is on a distinguished road
Hello Friends

would you please take a look at my Code.I'm confused, where the Problem is.
I receive a warning by the end of compiling " CC defined ,but not used" .I get by running Stack backtrace.

info: Linux/Parallel CPUs/ 3ddp

Thanks in advance
--------------------------------------------------------------
#include "udf.h"
#define BC_ID 5
#define nmrad 54
#define nmtang 2324
static double CC[nmtang*nmrad]={0.};
DEFINE_EXECUTE_AT_END(my_time_averager)
{
#if !RP_HOST
int mm;
double D[nmtang*nmrad];
double r[150000], tt[150000];
double R,tetha_prim,Y,Z;
FILE *fp;
fp = fopen("support-tat-blade1-outlet-Preparation.txt","r");
for (mm=0;(mm<nmtang*nmrad);mm ++)
{
fscanf(fp, "%lf %lf",&r[mm],&tt[mm]);
}
fclose(fp);
for (mm=0;(mm<nmrad);mm++)
{
r[nmtang*nmrad+mm]=r[mm];
tt[nmtang*nmrad+mm]=tt[mm];
}
for (mm=nmrad;(mm<nmrad*(nmtang+1));mm++)
{
r[mm-nmrad] =r[mm];
tt[mm-nmrad]=tt[mm];
}
fp= fopen("support-tat-blade1-outlet-Preparation.txt","w");
for (mm=0;(mm<nmtang*nmrad); mm++)
{
fprintf(fp, "%f\t %f\n", r[mm],tt[mm]);
}
fclose(fp);
double xx[ND_ND];
int numb = N_TIME;
Domain *d = Get_Domain(1);
Thread *t = Lookup_Thread(d,BC_ID), *tc;
face_t f;
Material *m;
int iair;
tc = THREAD_T0(t);
m = THREAD_MATERIAL(tc);
iair = mixture_specie_index(m,"air-2");
begin_f_loop(f,t)
{
F_CENTROID(xx,f,t);
Y=xx[1];
Z=xx[2];
R = sqrt(Y*Y+Z*Z);
tetha_prim = asin(-Z/R)/asin(1.)*90.;
if (Y<0.)
{
tetha_prim = tetha_prim/fabs(tetha_prim)*180.-tetha_prim;
}
for (mm=0;(mm<nmtang*nmrad);mm++)
{
if((fabs(R-r[mm])<0.00009) && (fabs(tetha_prim-tt[mm])<0.00009))
{
D[mm]=F_YI(f,t,iair); /* get the value of species air-2 */
CC[mm]=CC[mm]+D[mm];
}
}
}
end_f_loop(f,t)
if(numb==3)
{
fp = fopen("C-support-tat-blade1-outlet.txt","w");
for (mm=0;(mm<nmtang*nmrad);m++)
{
CC[mm]=(1/3)*CC[mm];
fprintf(fp, "%f\n", CC[mm]);
}
fclose(fp);
}
#endif
}

Last edited by Schumacher00; March 26, 2015 at 10:19.
Schumacher00 is offline   Reply With Quote

Old   March 26, 2015, 06:57
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
What error message are you getting? Should your line saving to the text file be "C:\" instead of "C-"?
`e` is offline   Reply With Quote

Old   March 26, 2015, 07:02
Default
  #3
New Member
 
Join Date: Oct 2014
Posts: 17
Rep Power: 11
Schumacher00 is on a distinguished road
Hi 'e'

Thanks for your quick response.

I get a warnning by compiling ' CC defined but not used'.By Running the calculation I get Stack backtrace .

Code gets compiled and loaded without any other Problem.

C- is just included by the name of the file,it's not an address.
Schumacher00 is offline   Reply With Quote

Old   March 26, 2015, 08:56
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
If RP_HOST is set, the preprocessor reduces your code to:

Code:
static double CC[2324*54]={0.};
DEFINE_EXECUTE_AT_END(my_time_averager)
{
}
As you can see, in that case CC is defined, but never used.
pakk is offline   Reply With Quote

Old   March 26, 2015, 10:15
Default
  #5
New Member
 
Join Date: Oct 2014
Posts: 17
Rep Power: 11
Schumacher00 is on a distinguished road
Thanks Pakk

So, I'm just not sure if I define static double CC[m*n] inside the EXECUTE macro, the calculated values for CC elements will be preserved at the end of each time step.
Moreover I have to exclude the Host CPU from Calculation task ,because I'm running fluent on parallel setting.

Right now, i just moved the defined static vaariable to below line of RP_HOST.Again Stack Backtrace...

What is the solution?
Schumacher00 is offline   Reply With Quote

Old   March 26, 2015, 10:19
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
You want to have a solution, but you should first explain what the problem is.

Until now, you have only said that you see a warning when you compile. Is that a problem for you? In that case, make it
Code:
#if !RP_HOST
static double CC[2324*54]={0.};
#endif
Or is something else than the warning the problem? You talk about "stack backtrace", but I have no idea what that is.
pakk is offline   Reply With Quote

Old   March 26, 2015, 10:47
Default
  #7
New Member
 
Join Date: Oct 2014
Posts: 17
Rep Power: 11
Schumacher00 is on a distinguished road
================================================== ============================
Stack backtrace generated for node id 0 (pid = 13244) on signal 11 :
================================================== ============================
================================================== ============================
================================================== ============================
Stack backtrace generated for node id 1 (pid = 13245) on signal 11 :
Stack backtrace generated for node id 5 (pid = 13249) on signal 11 :
Stack backtrace generated for node id 7 (pid = 13251) on signal 11 :
================================================== ============================
================================================== ============================
================================================== ============================
================================================== ============================
Stack backtrace generated for node id 3 (pid = 13247) on signal 11 :
Stack backtrace generated for node id 2 (pid = 13246) on signal 11 :
Stack backtrace generated for node id 6 (pid = 13250) on signal 11 :
Stack backtrace generated for node id 4 (pid = 13248) on signal 11 :
2: /lib64/libc.so.6() [0x3db1232920]
6: /lib64/libc.so.6(fscanf+0x88) [0x3db1262e08]
2: /lib64/libc.so.6(_IO_vfscanf+0x64) [0x3db12544c4]
6: libudf/lnamd64/3ddp_node/libudf.so(my_time_averager+0x5b) [0x7fe03bfb6ceb]
4: /--/--/--/fluent/1450/ansys_inc/v145/fluent/fluent14.5.0/lnamd64/3ddp_node/fluent_mpi.14.5.0() [0x1aedbfc]
Check the file fluenterror.log for details.
2: /lib64/libc.so.6(fscanf+0x88) [0x3db1262e08]
Please include this information with any bug report you file on this issue!
4: /lib64/libc.so.6() [0x3db1232920]
2: libudf/lnamd64/3ddp_node/libudf.so(my_time_averager+0x5b) [0x7f05dc83eceb]
4: /lib64/libc.so.6(_IO_vfscanf+0x64) [0x3db12544c4]
Check the file fluenterror.log for details.
================================================== ============================
Please include this information with any bug report you file on this issue!
4: /lib64/libc.so.6(fscanf+0x88) [0x3db1262e08]
================================================== ============================
4: libudf/lnamd64/3ddp_node/libudf.so(my_time_averager+0x5b) [0x7f811d5bcceb]
Check the file fluenterror.log for details.
Please include this information with any bug report you file on this issue!
================================================== ============================
3: /--/--/--/fluent/1450/ansys_inc/v145/fluent/fluent14.5.0/lnamd64/3ddp_node/fluent_mpi.14.5.0() [0x1ae9cc4]
3: /--/--/--/fluent/1450/ansys_inc/v145/fluent/fluent14.5.0/lnamd64/3ddp_node/fluent_mpi.14.5.0() [0x1aedbfc]
3: /lib64/libc.so.6() [0x3db1232920]
3: /lib6 The fluent process could not be started.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
This error occures exatly by the execution of EXECUTE_AT_END. (end of the first time step)

Like I wrote ,I moved the lines but the same error apears.

1.I wrote out the .prof file to calculate the radial and angular coordinates of my Face Centrids.
2.Ordered them as my desired and saved as (support-tat... .txt).
3. in UDF defined Radius and angle just like the principle of my ordering in previous step to be calculated in begin/end_f_loop.
4. Now in Calculation if R(step3)==RR(Step2) && tetha(step3)==tetha(step2), do get the value of my "mass fraction of Specie " of that ceratin face.
5.Save the values of "mass fraction of specie" of all faces in CC array at the end(when times step number is for example 3).
Schumacher00 is offline   Reply With Quote

Old   March 26, 2015, 10:56
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Try to isolate the problem.
For example: put
Code:
Message("Code runs till point A.");
on several places in your code (replacing A by different letters of the alphabet.)
If you see on your screen:

Quote:
Code runs till point A.
Code runs till point A.
Code runs till point B.
Code runs till point C.
(Fluent error)
Then the problem is between C and D.
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
how to load UDF in parallel at linux platform maye761 Fluent UDF and Scheme Programming 9 April 13, 2018 04:30
Problem of simulating of small droplet with radius of 2mm liguifan OpenFOAM Running, Solving & CFD 5 June 3, 2014 03:53
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
UDF for Species mass fraction daniel FLUENT 3 June 22, 2005 09:40


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