CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   fatal error during initialization after udf compilation (http://www.cfd-online.com/Forums/fluent-udf/96571-fatal-error-during-initialization-after-udf-compilation.html)

rik January 26, 2012 05:30

fatal error during initialization after udf compilation
 
Hi all,

I have write an UDF to copy wall temperature of semi-cylinder to another.
When I want to initialize, Fluent send me fatal error, see belows :
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()


My Udf :

#include "udf.h"
#include "config.h"
DEFINE_PROFILE(temp_profil,thread,index)
{
real x[3]; /*vecteur position*/
real x1[3]; /*vecteur translaté*/
Domain *domain15=Get_Domain(15);
Domain *domain14=Get_Domain(14);
face_t f;
Thread *t0;
int Zone_ID14=14;
int Zone_ID15=15;
face_t f1;
face_t f2;

begin_f_loop(f,thread) /*boucle sur les faces des mailles*/
{
F_CENTROID(x,f,thread); /*accès aux coordonnées du centre de la face*/

if (x[1]>=244.12)
{
t0=Lookup_Thread(domain15,Zone_ID15);
begin_f_loop(f1,t0) /*boucle sur les faces des mailles*/
{
F_CENTROID(x1,f1,t0);
if (x1[0]==x[0])
{
if (x1[2]==x[2])
{
F_PROFILE(f,thread,index)=F_T(f1,t0);
}
}
}
end_f_loop(f1,t0)
}
if (x[1]<244.12)
{
t0=Lookup_Thread(domain14,Zone_ID14);
begin_f_loop(f2,t0) /*boucle sur les faces des mailles*/
{
F_CENTROID(x1,f2,t0);
if (x1[1]==x[1])
{
if (x1[2]==x[2])
{
F_PROFILE(f,thread,index)=F_T(f2,t0);
}
}
}
end_f_loop(f2,t0)
}
/*accès aux coordonnées du centre de la face translatée de -47mm /!\ Problème peut venir de l'unité*/
/*accès à la température de la face translatée*/
/*F_PROFILE(f1,tread,index) /*accès au profile de température de la face translatée*/
}
end_f_loop(f,thread) /*fin de la boucle*/
}


Does anybody know which mistake can lead to this error?

Thanks a lot in advance.





swiftaircraft January 26, 2012 15:36

Are you inititializing with Fluent running in Parallel mode or serial?

Sixkillers January 26, 2012 18:01

My compiler (gcc) noticed only nested comments at the end of the file. However I have suspicion that you are using macro Get_Domain wrong way. There is always only one domain for single phase flows. You should definitely check out UDF manual to understand its concept. Generally speaking don't be shame to try if your UDF is working in the middle of development of it. It is much easier to find a bug in the early stage than your code become more complex.

rik January 27, 2012 03:56

@ swiftaircraft:
I've compiled my udf , and there's two way,
1_If I first put the udf boundary condition, the error appears when i want to initialize
2_If I initialize before the compilation of the udf, the error comes when I put the boundary condition...
I hope this will answer to your question.

@ Sixkillers:
Sorry but I'm not fluent with C++ code. What should I have to do?

Thanks for your support.

Sixkillers January 29, 2012 06:58

As I mentioned before if you are doing single-phase simulation there is only 1 domain. So you will have to change your code:

PHP Code:

Domain *domain15=Get_Domain(15);
Domain *domain14=Get_Domain(14); 

to:

PHP Code:

Domain *domain=Get_Domain(1); 

Moreover I would commented out most of your code and load it into Fluent to ensure that it is working and then add several new lines and repeat it again. The following approach should help you to isolate piece of code which is failing. In addition don't hesitate to consult Fluent's UDF guide.

rik January 30, 2012 11:57

I understand what you are talking about, I've seen that in the Fluent's UDF guide, but Get_Domain(1) will return the fluid domain pointer, and I've to point on a specfic wall. Can I do that ?

Because my goal is to copy temperature from a wall to another, so how could I do that?

Thanks a lot for the help.

MultiphaseFlowsLab October 16, 2013 18:09

Fluent initialization peoblem
 
I have written a UDF, and I have complied it and did couple of runs. but now, when I compile it for the same case, it is not initialized and Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: #f

appears. but if I read my old data file, with the exactly the same UDF and case file, it works without any issue.
could someone help me ?

kornetka October 17, 2013 03:01

Hi
I am not sure it will help, but please try doing this: Change the code so that first you declare all variables and only after that you assign values to them.


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