|
[Sponsors] |
something wrong when compiling udf, however the code is correct when interpreting |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 30, 2013, 11:59 |
something wrong when compiling udf, however the code is correct when interpreting
|
#1 |
Member
ben
Join Date: Apr 2013
Posts: 36
Rep Power: 13 |
Hey, everyone,
I began to change my udf from interpet to compile, however meet some problem and have no idea how to do. 1. The diffusivity the code: DEFINE_DIFFUSIVITY(uds_diffusivity_2,c,t,i) { return s_lamda*(1.0-POR)/3.0; } when I load this code, the uds goes to divergence. However, when I change "s_lamda*(1.0-POR)/3.0" into a constant, it works fine. In fact, s_lamda*(1.0-POR)/3.0 is a constant in my code since I defined "s_lamda" and "POR" in the begining of the code. This is weird 2. The source term the code: DEFINE_SOURCE(fluid_source_1,c,t,dS,eqn) { real Re, P, alamda_f, h,source_f; alamda_f=C_K_L(c,t); Re=C_U(c,t)/POR*ds*C_R(c,t)/C_MU_L(c,t); P=-8.278*pow(POR,0.38)+57.384*pow(POR,1.38)-106.63*pow(POR,2.38)+95.756*pow(POR,3.38)-37.24*pow(POR,4.38); h=2.096*pow(POR,0.38)*alamda_f*pow(Re,0.438)*P/(ds*ds); source_f=h*(C_UDSI(c,t,0)-C_T(c,t)); dS[eqn]=-h; return source_f; } I can load this source without any problem when interpreting, however in compiling it doesn't work at all. And the error is: 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 I have no idea what's wrong with my code or is there any difference between compile and interpret? I will appreciate a lot for your help. |
|
April 30, 2013, 22:31 |
|
#3 |
Member
ben
Join Date: Apr 2013
Posts: 36
Rep Power: 13 |
Thank you very much for your reply. I didn't get you. I can load this source term in interpreted UDFs. And when I load it in compiled UDFs, I have two UDSs. And I can display C_UDSI(c,t,0) but just cannot load this source term.
|
|
April 30, 2013, 23:13 |
|
#4 |
Member
ben
Join Date: Apr 2013
Posts: 36
Rep Power: 13 |
hey blackmask,
I know the reason but still have no idea how to solve it. the problem locates in this code : alamda_f=C_K_L(c,t) when I change C_K_L(c,t) into a constant, it works fine. So the problem is I can't cite using C_K_L(c,t) ? Why? Do you have any ideas? Or this is the problem you mentioned. Access it without allocated? |
|
April 30, 2013, 23:40 |
|
#5 | |
Senior Member
|
Give it a try.
Quote:
|
||
May 1, 2013, 05:27 |
|
#6 |
Member
ben
Join Date: Apr 2013
Posts: 36
Rep Power: 13 |
hey blackmask,
thank you for your suggestion. it didn't work. however i solved this problem by setting the thermal conductivity into a picewise-polynomial function related to the temperature. if the thermal conductivity is set to be a constant then it didn't work and the same error. i don't know why but it is solved. however i met another problem. do you know what is the meaning of this code? Thread *t0=thread-t0; when i compiled the udfs the warnings are: 'initializing' : 'struct thread_struct *' differs in levels of indirection from 'int ' local variable 't0' used without having been initialized although i can ignore these two wranings, when i load this udf containing this code it doesn't work. so i check the code one by one, and found that this code might be the problem. but have no idea how to intialize 't0' do you have any ideas? i will appreciat a lot for your help. |
|
May 11, 2013, 08:36 |
|
#8 |
Member
ben
Join Date: Apr 2013
Posts: 36
Rep Power: 13 |
thank you for your help and sorry for the delayed reply.
This code is copied in the UDF manual Charpter 8.2.5.2. I assumed it was wrong and thought it should be Thread *t0=thread Is it ok? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
please help me to correct my code | Ardalan | Main CFD Forum | 1 | June 2, 2010 19:32 |
UDF compiling problem in Flient 6.3 | jeevan kumar | FLUENT | 2 | February 25, 2009 01:43 |
What's wrong with my UDF? It worked in the past. | CF | FLUENT | 3 | September 26, 2007 21:09 |
compiling a UDF | co2 | FLUENT | 2 | January 5, 2004 20:34 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |