|
[Sponsors] |
Creating a heat Flux UDF with a temperature Dependent argument |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 19, 2018, 12:36 |
Creating a heat Flux UDF with a temperature Dependent argument
|
#1 |
New Member
Constantinos
Join Date: Mar 2018
Posts: 3
Rep Power: 8 |
Hi y'all!
I want to create a UDF for the heat flux on the side of a cylinder. The function of the heat flux is as follows: Capture.PNG and the parameter Y-bar has the following values Capture1.PNG While the parameters Please note: In the same .c file I have included 3 udf's in total and the other 2 work properly, so there is no point in including them in this post. (That's why you may see some definitions not used in the udf. I have interpreted it and the error I get is "Error: received a fatal signal (Segmentation fault)" . FLUENT interprets the file with no errors. I am not familiar with C language, but I suppose that the problem has to do with the whole logic of the udf: the definition of the parameter for some temperature values and then obtaining the desired value for the respective temperatura through linear interpolation, saving it in a new variable (Y_bar1) which is finally used in the definition of the heat flux profile. Since I cannot find where exactly the problem seems to be lying, can anyone suggest some other logic I can create the UDF and especially how to create a temperature dependent parameter or at least tell me what the segmentation error is in my code?? The UDF is as follows Code:
#include "udf.h" #define pi 3.1415926526535897 #define mi 0.4 #define F_n 12000 #define w 78.54 #define r_p 0.00325 #define t_melt 864 #define r_s 0.0115 DEFINE_PROFILE(qpin_side,t,i) { real x[ND_ND]; real y; real u; real r; real A_p; face_t f; real temp = F_T(f,t); real sqm = mi/sqrt(3*(1+mi*mi)); int kelvin[8],Y_bar[8]; kelvin[0]=293; kelvin[1]=373; kelvin[2]=473; kelvin[3]=573; kelvin[4]=673; kelvin[5]=773; kelvin[6]=873; kelvin[7]=973; Y_bar[0]=440e+06; Y_bar[1]=437e+06; Y_bar[2]=364e+06; Y_bar[3]=181e+06; Y_bar[4]=61e+05; Y_bar[5]=50e+05; Y_bar[6]=40e+05; Y_bar[7]=0; begin_f_loop(f, t) { real Y_bar1; for ( i=0; i<7; i++) { if(temp > kelvin[i] && temp < kelvin[i+1]){ Y_bar1 = Y_bar[i]+(temp-kelvin[i])*(Y_bar[i+1]-Y_bar[i])/(kelvin[i+1]-kelvin[i]); } } F_CENTROID (x,f,t); y = x[1]; u = x[0]; r = sqrt(u*u+y*y); A_p = pi*r_p*r_p; F_PROFILE(f,t,i) = sqm*r_p*w*Y_bar1; } end_f_loop(f,t) |
|
March 19, 2018, 21:38 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
what initial temperature do you use to start your case?
Best regards |
|
March 20, 2018, 08:00 |
|
#3 |
New Member
Constantinos
Join Date: Mar 2018
Posts: 3
Rep Power: 8 |
||
March 20, 2018, 08:14 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Three things:
1. You define Y_bar as integers, but the values that you give don't fit as integers. I would redefine them as float. This is not causing your current problem, but if you don't fix this you might see very strange results later on. 2. You define "temp" as "F_T(f,t)", the temperature on face "f", before you have specified which face "f" you are talking about. This causes your error. You should move this down, into the loop. 3. Your code does not specify what happens if the temperature is below 293 K or above 973 K. So if you reach these temperature, you run into undefined behavior. |
|
Tags |
heat flux, segmentation error, temperature dependent, udf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Temperature & Heat Flux Boundary | jamesmaca | FLUENT | 5 | December 11, 2019 06:16 |
UDF for time dependent heat flux | rontgen5 | Fluent UDF and Scheme Programming | 5 | August 8, 2019 04:04 |
Wall Heat Flux & Temperature | Greg Perkins | FLUENT | 10 | November 20, 2015 10:32 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
Basic question: UDF for wall heat flux | Carl | FLUENT | 1 | August 5, 2006 20:01 |