|
[Sponsors] |
fatal error during initialization after udf compilation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 26, 2012, 05:30 |
fatal error during initialization after udf compilation
|
#1 |
New Member
Join Date: Jan 2012
Posts: 5
Rep Power: 14 |
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. |
|
January 26, 2012, 15:36 |
|
#2 |
Member
David Stanbridge
Join Date: Apr 2010
Location: Norwich, UK
Posts: 59
Rep Power: 16 |
Are you inititializing with Fluent running in Parallel mode or serial?
|
|
January 26, 2012, 18:01 |
|
#3 |
Member
Join Date: Nov 2011
Location: Czech Republic
Posts: 97
Rep Power: 15 |
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.
|
|
January 27, 2012, 03:56 |
|
#4 |
New Member
Join Date: Jan 2012
Posts: 5
Rep Power: 14 |
@ 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 initializeI 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. |
|
January 29, 2012, 06:58 |
|
#5 |
Member
Join Date: Nov 2011
Location: Czech Republic
Posts: 97
Rep Power: 15 |
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:
PHP Code:
|
|
January 30, 2012, 11:57 |
|
#6 |
New Member
Join Date: Jan 2012
Posts: 5
Rep Power: 14 |
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. |
|
October 16, 2013, 19:09 |
Fluent initialization peoblem
|
#7 |
New Member
Join Date: Apr 2012
Posts: 19
Rep Power: 14 |
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 ? |
|
October 17, 2013, 04:01 |
|
#8 |
New Member
Join Date: Jun 2013
Posts: 15
Rep Power: 13 |
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. |
|
February 16, 2020, 08:33 |
|
#9 | |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
Quote:
I have the same problem. Could find the answer? I would appreciate it if you could let me know how you solved the problem? Regards |
||
February 16, 2020, 17:18 |
Your Code
|
#10 |
Senior Member
|
Rik's post is 8 years old, so, you may or may not expect a reply. However, one problem with his code was use of Get_Domain with numbers like 14 and 15. I didn't look further because code will not be able to go beyond that. If you are getting a problem, it would be better to share your code.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 17, 2020, 04:04 |
|
#11 |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
Hi Vinerm,
Thank you very much for your reply and also for the advice. I am trying to apply Peltier Heating to a wall. Peltier heating is a temperature dependent flux as: Q = alpha_pn * I * T_w So, I searched in the Fluent UDF manual and found Define_Heat_Flux function which was used to define convective heat transfer: Q = h * (T_w - T_ambient). I compared these two equations and wrote a code similarly as: --------------------------------------------------------------- #include "udf.h" real Alpha = 0.; // Seebeck coefficient of the couple (a_pn = Peltier/T) real I=0.; // Electric current // DEFINE_ADJUST(htc_adjust, domain) { // Define the heat transfer coefficient. */ Alpha = 0.000400; I=5; } DEFINE_HEAT_FLUX(heat_flux, f, t, c0, t0, cid, cir) { cid[0] = 0.; cid[1] = 0.0; cid[2] = Alpha*I; cid[3] = 0.; } ------------------------------------------------------ I would appreciate it if you could inform me why initialization of the case will lead to that error. Regards, Last edited by Pacific; February 17, 2020 at 06:49. |
|
February 17, 2020, 04:47 |
Define_heat_flux
|
#12 |
Senior Member
|
The macro DEFINE_HEAT_FLUX is actually a misnomer and Fluent (or Ansys) has never thought of changing its name. This macro is not meant for applying heat flux. If you wish to apply heat flux, then use DEFINE_PROFILE. Furthermore, DEFINE_ADJUST function is doing nothing, so, you do not need that.
And it appears that you have mixed two effects. Seebeck and Peltier effects are opposite of each other. Seebeck is the generation of emf due to temperature difference. So, Seebeck coefficient is multiplied by to get emf induced. Peltier effect on the other hand uses Peltier coefficients and its product with current given to the circuit gives heat generated.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 17, 2020, 05:51 |
|
#13 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
there is Electric Potential model in Fluent
__________________
best regards ****************************** press LIKE if this message was helpful |
|
February 17, 2020, 06:36 |
|
#14 |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
Thank you for reply.
I know about Peltier and Seebeck and their relation (Peltier = Seebeck * T). Define_Adjust and Define_Heat_Flux have been used by Fluent UDF manual. |
|
February 17, 2020, 06:46 |
|
#15 |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
||
February 17, 2020, 06:57 |
Fluent's usage
|
#16 |
Senior Member
|
Could you point me to Fluent's usage of DEFINE_HEAT_FLUX that you are referring to? Then it will be easier to help.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 17, 2020, 07:46 |
|
#17 | |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
Quote:
please look at the last example of the following file: https://drive.google.com/file/d/1dc7...ew?usp=sharing Regards, |
||
February 17, 2020, 08:14 |
Heat Flux
|
#18 |
Senior Member
|
If you read the statement in section 5, the highlighted one, it clearly mentions that the use of this UDF is to modify how Fluent relates temperature and heat flux. This is not to be used for applying the heat flux. If you wish to modify the relation, then you can go ahead and use it. In the example, the h value is provided by the user. Usually, this h value is determined by Fluent; this is heat transfer coefficient between fluid and its wall on the inside, not the outside of the wall where user specifies a boundary condition using the bc panel. If you wish to apply a heat flux, then use the example from section 1.
In any case, the UDFs in the example are very simple, kind of templates, and not meant for use as it is.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 17, 2020, 09:31 |
|
#19 | |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
Quote:
I will review the file again and get back to you soon. All I know is that a temperature dependent heat flux can be applied by Define_Heat_Flux function, not Define_Profile. Define_Profile can modify the amount of constant heat flux. My highest appreciation for the time taking to answer my questions. |
||
February 17, 2020, 09:42 |
Implications
|
#20 |
Senior Member
|
Consider the following scenario
There is a flat plate and water is flowing on top of it. Due to this water flow, a convection coefficient is developed between the water and the flat plate. This depends upon the Re number of the flow and Pr of the water apart from the boundary conditions applied on the bottom side of the wall. 1. If you wish to apply an arbitrary heat flux or temperature or convection coefficient on the bottom of the plate (it could be function of space, time, temperature, or any other variable), then you would use DEFINE_PROFILE 2. If you wish to modify the convection coefficient calculated by Fluent between water and plate, this could be due to any reason that is not being simulated, such as rough wall, then you would use DEFINE_HEAT_FLUX So, your understanding that DEFINE_HEAT_FLUX is to be used if the heat flux is a function of temperature is incorrect. The purpose of DEFINE_HEAT_FLUX is NOT to apply heat flux but modify its relation with the thermal field. To clarify it further, look at the hook point for both. DEFINE_HEAT_FLUX is hooked at a general location and it loops over all the boundaries that exist in your domain. On the other hand, DEFINE_PROFILE is applied on a specific boundary or cell zone.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compilation error | Szabolcs Varga | Fluent UDF and Scheme Programming | 4 | September 14, 2015 06:27 |
UDF compilation problem -- "undeclared variable" | Henrik Ström | FLUENT | 1 | September 21, 2005 06:25 |
error while compiling the USER Sub routine | CFD user | CFX | 3 | November 25, 2002 16:16 |
UDF initialization | Sam | FLUENT | 1 | May 21, 2002 09:23 |
Compiled UDF / Compilation problem | mikhail | FLUENT | 1 | October 13, 2000 07:12 |