CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Problem with C_T_G(cell,thread)[0] (https://www.cfd-online.com/Forums/fluent/112598-problem-c_t_g-cell-thread-0-a.html)

Raymond.Leoi January 31, 2013 11:49

Problem with C_T_G(cell,thread)[0]
 
when I set C_UDSI(cell,thread,3) = C_UDSI_DIFF(cell,thread,2)*C_T_G(cell,thread)[0] in DEFINE_EXECUTE_AT_END(execute_at_end), FLUENT couldn't run with the following error,
Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0
tx86\2ddp\fl1450s.exe 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

Any idea for this problem?

czhao86 January 31, 2013 17:11

It is better if you post the whole UDF.

Jonathan January 31, 2013 19:06

two quick thoughts ...

1) obviously since you are calling temperature gradients, make sure you are solving the energy equation (!)

2) from memory, if you want to access gradient data, you need to tell the solver to retain temporary solution data:

solve > set > expert
'yes' to prevent temporary solver data from being freed (i think its second or third option depending on what models you have enabled).

cheers
jonathan

Raymond.Leoi February 1, 2013 05:07

Thanks a lot, Jonathan. It seems working after choosing 'yes' for 'temporary data from being freed'.

Quote:

Originally Posted by Jonathan (Post 405417)
two quick thoughts ...

1) obviously since you are calling temperature gradients, make sure you are solving the energy equation (!)

2) from memory, if you want to access gradient data, you need to tell the solver to retain temporary solution data:

solve > set > expert
'yes' to prevent temporary solver data from being freed (i think its second or third option depending on what models you have enabled).

cheers
jonathan


Jonathan February 1, 2013 05:31

hi Raymond,

great - glad its working! that info is only in the small print in the UDF guide :)

Jim87 August 8, 2013 05:54

Hi,
I have a similar problem. I tried your advice but get the same error when I initialize the simulation.
My first thought is: Could it be that the simulation need some iterations before i use the udf? The grsdient (and the UDF) needs values from former itarations, maybe it can only work if there are some data files in fluents memory?

#include "udf.h"

DEFINE_PROPERTY(test_Gradienten,c,t)
{

/************************************************** **************************
Standard UDF Befehle
************************************************** ***************************/

double Rho = 0.0;
double gradient = 0.0;
double s1 = 0.5;

/************************************************** **************************
Variablen aufrufen
************************************************** ***************************/

gradient = C_T_G(c,t)[1];

/************************************************** *************************
Zeiger Druck und Temperatur
************************************************** ***************************/

Rho = 1 + gradient * s1;
return Rho;
}




Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe 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

Jonathan August 8, 2013 06:27

hi,

sorry - i just replied to your PM and then saw this.

i cant see exactly what is wrong right now, but if you send me you .cas and udf files i can perhaps have a look and see tonight if i get time.

what version of ansys are you using? it matters only because some UDF's will not cross-compile on newer versions ... :)

cheers
jonathan

Quote:

Originally Posted by Jim87 (Post 444543)
Hi,
I have a similar problem. I tried your advice but get the same error when I initialize the simulation.
My first thought is: Could it be that the simulation need some iterations before i use the udf? The grsdient (and the UDF) needs values from former itarations, maybe it can only work if there are some data files in fluents memory?

#include "udf.h"

DEFINE_PROPERTY(test_Gradienten,c,t)
{

/************************************************** **************************
Standard UDF Befehle
************************************************** ***************************/

double Rho = 0.0;
double gradient = 0.0;
double s1 = 0.5;

/************************************************** **************************
Variablen aufrufen
************************************************** ***************************/

gradient = C_T_G(c,t)[1];

/************************************************** *************************
Zeiger Druck und Temperatur
************************************************** ***************************/

Rho = 1 + gradient * s1;
return Rho;
}




Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe 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


Raymond.Leoi August 8, 2013 09:02

Well, you might try initialising your case first or even running few iterations before specifying your UDF. The fact is that there's no C_T_G(c,t) at the very beginning, which can probably cause your problem.


Quote:

Originally Posted by Jim87 (Post 444543)
Hi,
I have a similar problem. I tried your advice but get the same error when I initialize the simulation.
My first thought is: Could it be that the simulation need some iterations before i use the udf? The grsdient (and the UDF) needs values from former itarations, maybe it can only work if there are some data files in fluents memory?

#include "udf.h"

DEFINE_PROPERTY(test_Gradienten,c,t)
{

/************************************************** **************************
Standard UDF Befehle
************************************************** ***************************/

double Rho = 0.0;
double gradient = 0.0;
double s1 = 0.5;

/************************************************** **************************
Variablen aufrufen
************************************************** ***************************/

gradient = C_T_G(c,t)[1];

/************************************************** *************************
Zeiger Druck und Temperatur
************************************************** ***************************/

Rho = 1 + gradient * s1;
return Rho;
}




Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe 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


Jim87 August 8, 2013 09:36

@ Jonathan & Raymond.Leoi thank you for your comments.

The problem was close to Raymonds approach. The user Blackmask helped me to fix it with one more line.

#include "udf.h" DEFINE_PROPERTY(test_Gradienten,c,t) { /************************************************** ************************** Standard UDF Befehle ************************************************** ***************************/ double Rho = 0.0; double gradient = 0.0; double s1 = 5; /************************************************** ************************** Variablen aufrufen ************************************************** ***************************/ if (NNULLP(THREAD_STORAGE(t, SV_T_G))) gradient = C_T_G(c,t)[1]; /************************************************** ************************* Zeiger Druck und Temperatur ************************************************** ***************************/ Rho = 1 + gradient * s1; return Rho; }

This line fixed all problems

@ Jonathan: I coppied your hint, the expert solver settings and the fixing
line in the UDF were both needed.

Jonathan August 8, 2013 09:43

mem.h
 
ALso, i just noticed you are missing mem.h from your includes ...

as per the UDF manual (pg. 210) for accessing variable gradients, you need to include the memory header file in your user code ...

cheers
jonathan

Quote:

Originally Posted by Jim87 (Post 444543)
Hi,
I have a similar problem. I tried your advice but get the same error when I initialize the simulation.
My first thought is: Could it be that the simulation need some iterations before i use the udf? The grsdient (and the UDF) needs values from former itarations, maybe it can only work if there are some data files in fluents memory?

#include "udf.h"

DEFINE_PROPERTY(test_Gradienten,c,t)
{

/************************************************** **************************
Standard UDF Befehle
************************************************** ***************************/

double Rho = 0.0;
double gradient = 0.0;
double s1 = 0.5;

/************************************************** **************************
Variablen aufrufen
************************************************** ***************************/

gradient = C_T_G(c,t)[1];

/************************************************** *************************
Zeiger Druck und Temperatur
************************************************** ***************************/

Rho = 1 + gradient * s1;
return Rho;
}




Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe 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



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