CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF to get the average temperature of a face and use it to define a property

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes
  • 1 Post By D.M
  • 1 Post By gdb
  • 5 Post By gdb
  • 3 Post By D.M
  • 2 Post By sina769
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 11, 2016, 09:38
Default UDF to get the average temperature of a face and use it to define a property
  #1
gdb
New Member
 
Gonzalo
Join Date: Jan 2015
Posts: 3
Rep Power: 11
gdb is on a distinguished road
Dear all,

I have been reading this forum for a while, but this is my first post, so first I would like to say hi. I have been using Fluent for my research during the last 3 years and this forum has provided me with invaluable resources and answers, so thanks to all the contributors. I would like to kindly ask for some help with a UDF that I am trying to write.

I am modelling the melting of a material into an enclosure by means of the enthalpy porosity approach. It is a transient, 2D axisymmetric simulation. What I want to do by the UDF is to define an effective thermal conductivity of a material as a function of the Rayleigh number. This Rayleigh number is at the same time a function of the average temperature of one of the walls in the previous time step.

I know how to use the DEFINE_PROPERTY macro, but my problem is that I don’t know how to retrieve the average temperature of the wall from the previous time step. Thus, I decided first to write a Define on Demand macro in order to learn how to retrieve that average temperature. What I do is to run the simulation for a couple of time steps and then execute the macro on demand. This way I can compare the temperature that I want to retrieve by the UDF with the actual temperature of the wall. If this would work, then I could implement this part of the code in the DEFINE_PROPERTY macro….but obviously, I have facing some problems.
The UDF that I have written is shown next:

#include "udf.h"
DEFINE_ON_DEMAND(demo_calc)
{
Domain *d;
face_t f;
real tavg;
real temper;
real vol_tot;
real volume;
int ID=7; /*this is the ID of the boundary wall that I want to get the temperature from*/
Thread *t;
cell_t c;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
volume = C_VOLUME(c,t); /* get cell volume */
temper = C_T(c,t); /* get cell temperature */
vol_tot += volume;
tavg += temper*volume;
}
end_c_loop(c,t)
tavg /= vol_tot;
printf("temp = %g\n",tavg);
}
}

I can interpret and execute the udf, however, instead of one temperature I get 8 different temperatures, as can be seen below: (Note that in the model I have 8 bc in total, which I guess that is not just a coincidence)

temp = -1.#IND
temp = -1.#IND
temp = 562.851
temp = 1.4915e+06
temp = 559.15
temp = 1.63967e+06
temp = 559.15
temp = 1.41307e+06

The temperatures of 559 and 562K are in the range of the working temperatures of the model. However they don’t match the temperature of the wall that I am looking for.

I have tried different codes and I have checked the manual and the forum looking for answers…but I wasn’t able to reach any solution. So any help would be really appreciated.

Thank you very much in advance,

Gon
gdb is offline   Reply With Quote

Old   August 12, 2016, 05:04
Default
  #2
D.M
Member
 
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10
D.M is on a distinguished road
Hello,
first of all you have identified your thread by t = lookup_thread(d,id) and your id is 7 , so what is the reason you are looping over the threads?? (thread_loop_c(t,d)!!) , i mean if you have identified t , then there is no need to do that , just looping over faces would be enough!! and by faces i realy mean exactly the "faces"!! your thread is a face thread not cell thread so why looping over cells?? and what do the lines "tavg += temper*volume; & tavg /= vol_tot;" mean??

maybe try this :
#include "udf.h"
static real area_tot = 0;
static real tsum = 0;
static int i = 0;
DEFINE_EXECUTE_AT_END(average_temp)
{
Domain *d;
face_t f;
real A[ND_ND];
real temper;
real area;
int ID=7;
Thread *t;
cell_t c;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);

begin_f_loop(f,t) /*you have identified t in previous steps*/
{
i++;
F_AREA(A,f,t);
area = NV_MAG(A);
temper = F_T(f,t);
area_tot += area;
tsum += temper;
}
end_f_loop(f,t)
F_UDMI(f,t,0) = tsum /( i * area_tot);
}


this udf that i have written gives you the average temp on the wall at the end of each time step:
(average temp of your face/area of your face) , if you want something else try to change the udf.
so now you have average temperature at the end of each time step (in UDMI) and you can use it for next time step! do not forget to go to "define" , "user define" , "memory" and change the number of "user define memory locations" into 1.
i haven't checked the udf myself but this was as far as i could help i think i hope it helps u.
gdb likes this.

Last edited by D.M; August 13, 2016 at 00:53.
D.M is offline   Reply With Quote

Old   August 12, 2016, 06:11
Default
  #3
D.M
Member
 
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10
D.M is on a distinguished road
another thing if you insist on finding the cells temp and ... cause i think you need them for DEFINE_PROPERTY , you should do something like this:

#include "udf.h"
static real vol_tot = 0;
static real tsum = 0;
static int i = 0;
DEFINE_EXECUTE_AT_END(average_temp)
{
Domain *d;
face_t f;
real temper;
real volume;
int ID=7;
Thread *t;
Thread *t0;
cell_t c;
cell_t c0;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);

begin_f_loop(f,t) /*you have identified t in previous steps*/
{
i++;
c0 = F_C0(f,t);
t0 = THREAD_T0(t);
temper = C_T(c0,t0);
volume = C_VOLUME(c0,t0);
vol_tot += volume;
tsum += temper;


}
end_f_loop(f,t)
C_UDMI(c0,t0,0) = tsum /( i * vol_tot);
}

i don't know if it is right or not but you can check it your self and try to change it if you think it is wrong.
D.M is offline   Reply With Quote

Old   August 13, 2016, 04:13
Default
  #4
gdb
New Member
 
Gonzalo
Join Date: Jan 2015
Posts: 3
Rep Power: 11
gdb is on a distinguished road
Hi D.M,

Many thanks for the help!

I have been doing some tests and I think that your code can definitely help me. However, it gives an error while running. After some trials, I saw that this is solved if I the F_UDMI statement is moved within the "begin_f_loop". I have read that UDM is associated with cells, and thus it needs a loop when it is used. I concluded that this might be the reason for the error.

Anyway, I have realized that this probably doesn’t affect my UDF. Since my objective is just to compute one temperature value (the average temperature of the boundary wall with ID = 8), I guess that I don’t need to use the UDM. I just need to write a UDF where that average temperature is a global variable. The value of this global variable is calculated at the end of each time step by the DEFINE_EXECUTE_AT_END macro, and used in the DEFINE_PROPERTY macro as an input.

I used your code and I did some modifications to get the average value of the boundary wall at the end of each time step (see it at the end of the message). The tavg value is the one that will be used in the DEFINE_PROPERTY macro.

The code is running…but now I have another problem: I get 4 different tavg values instead of one!! You can see it in the results attached below (I get them by means of the TUI). The funny story is that if I take the value of the 3 results that have physical meaning and calculate their average, then I get the average temperature that I am looking for.

However, when I use the variable tavg to calculate the thermal conductivity in the DEFINE_PROPERTY macro I get also different values of thermal conductivity. It looks as if the wall with ID 8 would be divided into different zones at the same time...

Tavg = -1.#IND area_tot = 0
Tavg = 582.391 area_tot = 0.0723761
Tavg = 559.15 area_tot = 0.0652473
Tavg = 559.15 area_tot = 0.0720006

I have tried several alternatives but I don’t get the solution. I thought that it might be related with the fact that the model is axisymmetric…but I used it on a 2D planar model and I got the same 4 results. ..

Any help is really appreciated

Thank you!!

Gon

P.S.: I started working with UDFs a few days ago...so I apologize if any of the things that I'm saying they make no sense...

Code:

#include "udf.h"
real tavg;
DEFINE_EXECUTE_AT_END(average_temp)
{
Domain *d;
face_t f;
real temper = 0.0;
real A[ND_ND];
real area = 0.0;
real area_tot = 0.0;
int ID = 8; /*this is the ID of the boundary wall that I want to get the temperature from*/
Thread *t;
int zone_ID;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
area = NV_MAG(A)*2.0*M_PI; /*Since the model is axisymmetric, we have to multiply by 2pi*/
area_tot += area;
temper = F_T(f,t); tavg += temper*area;
}
end_f_loop(f,t)
tavg /= area_tot;
printf("Tavg = %g area_tot = %g\n",tavg,area_tot);
}

DEFINE_PROPERTY(thermal_conductivity,c,t)
{
real keff;
real Ra;
real Nu;
real k = 0.55;
real C = 0.03;
real n = 0.25;
real beta = 0.0005;
real Tm = 565.00;
real v = 0.000002;
real alfa = 0.0000005;
real g = 9.81;
real Lc = 0.33333;
Ra=(g*beta*(tavg-Tm)*pow( Lc, 3))/(v*alfa);
Nu=C*pow( Ra, n);
keff = k*Nu;
return keff;
}
Berkk likes this.
gdb is offline   Reply With Quote

Old   August 14, 2016, 23:33
Default
  #5
gdb
New Member
 
Gonzalo
Join Date: Jan 2015
Posts: 3
Rep Power: 11
gdb is on a distinguished road
Hi all,

I have found that the reason why I got several results instead of 1 was that I was running the simulation in a parallel mode, so the mesh was partitioned. When I changed to a serial mode, then I got only one result and the code is working properly. Hopefully this info can be useful to other people.

Cheers,

Gon
parco, Tleja, D.M and 2 others like this.
gdb is offline   Reply With Quote

Old   August 18, 2016, 15:35
Default
  #6
D.M
Member
 
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10
D.M is on a distinguished road
thank u so much for posting the reason, i was wondering what the reason could be, tnx.
parco, gdb and AnasMK like this.
D.M is offline   Reply With Quote

Old   March 15, 2018, 03:31
Default
  #7
New Member
 
Cna
Join Date: Oct 2014
Posts: 4
Rep Power: 11
sina769 is on a distinguished road
Dear all

Since fluent divides computational domain when running in parallel mode, sometimes you need to be aware of some udf coding consideration. For example, when you are going to compute total volume of all grid and fluent give you n (number of assigned processor) output.
Fortunately, by a little manipulation in your udf you will be able to make it suitable for parallel simulation. For this, refer to chapter entitled parallel considerations in udf manual.
Or below link:
Parallel UDF Problem
parco and ATIKADAR like this.
sina769 is offline   Reply With Quote

Old   August 31, 2019, 11:04
Default
  #8
New Member
 
Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 6
hlmehr is on a distinguished road
Hey,
I was working on a code related to this and i found your code and basically i want to change the inlet velocity or temperature if possible with the cell ID's temperature.
The code is this.
#include "udf.h"
real tavg;
DEFINE_EXECUTE_AT_END(average_temp)
{
Domain *d;
face_t f;
real temper = 0.0;
real A[ND_ND];
real area = 0.0;
real area_tot = 0.0;
int ID = 78; /*this is the ID of the boundary wall that I want to get the temperature from*/
Thread *t;
int zone_ID;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
area = NV_MAG(A)*2.0*M_PI; /*Since the model is axisymmetric, we have to multiply by 2pi*/
area_tot += area;
temper = F_T(f,t); tavg += temper*area;
}
end_f_loop(f,t)
tavg /= area_tot;
printf("Tavg = %g area_tot = %g\n",tavg,area_tot);
}
DEFINE_PROFILE(velocity_magnitude, t, i)
{
real velocity;
face_t f;

if ((tavg>=305))
{
velocity=3;
}
if ((tavg<305))
{
velocity=1.5;
}
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = velocity;
}
end_f_loop(f,t)
}
It is interpreted, and entered as udf inlet velocity but nothing happens rather the velocity becomes constant at 0.9 ms-1 (Strange since i've put 3 and 1.5 velocities in the code.
What's wrong and how should i execute it?
hlmehr is offline   Reply With Quote

Old   September 2, 2019, 00:46
Default
  #9
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
did you hooked DEFINE_EXECUTE_AT_END macro and your define_profile as inlet boundary condition?

DEFINE_EXECUTE_AT_END: fluent GUI -> user defined -> function hooks -> execute at end

define_profile : fluent GUI -> boundary conditions -> your inlet _. velocity change from constant to your udf

best regards
hlmehr likes this.
AlexanderZ is offline   Reply With Quote

Old   September 2, 2019, 04:17
Default
  #10
New Member
 
Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 6
hlmehr is on a distinguished road
Thank you! I'll try this.
hlmehr is offline   Reply With Quote

Old   September 2, 2019, 04:45
Default
  #11
New Member
 
Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 6
hlmehr is on a distinguished road
Hey, Thank you for replying.
I did hook up and put in the boundary conditions; the two functions like you said,
It is giving error: recieved a fatal signal (segmentation fault) Error Object: #f
I'll try to change some things and execute it. If you could identify the problem, it would be great.
The problem is with in DEFINE_EXECUTE_AT_END function. I ran both functions separately and this gave the segmentation fault.
Best regards

Last edited by hlmehr; September 2, 2019 at 15:08. Reason: More information
hlmehr is offline   Reply With Quote

Old   September 3, 2019, 02:48
Default
  #12
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h" 
real tavg=300;
which version of fluent do you use? do you run in parallel or single core?

best regards
AlexanderZ is offline   Reply With Quote

Old   September 9, 2019, 02:41
Default
  #13
Member
 
Vignesh Lakshmanan
Join Date: Nov 2016
Posts: 79
Rep Power: 9
ViLaks is on a distinguished road
Quote:
Originally Posted by D.M View Post
Hello,
first of all you have identified your thread by t = lookup_thread(d,id) and your id is 7 , so what is the reason you are looping over the threads?? (thread_loop_c(t,d)!!) , i mean if you have identified t , then there is no need to do that , just looping over faces would be enough!! and by faces i realy mean exactly the "faces"!! your thread is a face thread not cell thread so why looping over cells?? and what do the lines "tavg += temper*volume; & tavg /= vol_tot;" mean??

maybe try this :
#include "udf.h"
static real area_tot = 0;
static real tsum = 0;
static int i = 0;
DEFINE_EXECUTE_AT_END(average_temp)
{
Domain *d;
face_t f;
real A[ND_ND];
real temper;
real area;
int ID=7;
Thread *t;
cell_t c;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);

begin_f_loop(f,t) /*you have identified t in previous steps*/
{
i++;
F_AREA(A,f,t);
area = NV_MAG(A);
temper = F_T(f,t);
area_tot += area;
tsum += temper;
}
end_f_loop(f,t)
F_UDMI(f,t,0) = tsum /( i * area_tot);
}


this udf that i have written gives you the average temp on the wall at the end of each time step:
(average temp of your face/area of your face) , if you want something else try to change the udf.
so now you have average temperature at the end of each time step (in UDMI) and you can use it for next time step! do not forget to go to "define" , "user define" , "memory" and change the number of "user define memory locations" into 1.
i haven't checked the udf myself but this was as far as i could help i think i hope it helps u.
Hi,

Sorry for restarting the thread.
I am simulating flow through a capillary tube (3D) in Fluent and I would like to understand the variation in temperature and pressure across the length of the capillary.
The simple and tedious option would be to create multiple faces across the capillary (varying in 2 directions, say x and y) and report values at each face.

Is it possible to do this through UDFs?
I would like inputs in looping through cells in a particular domain and write values at fixed intervals, say 0.1 m or so

PS: My geometry is a coiled capillary

Thanks in Advance!!!
ViLaks is offline   Reply With Quote

Old   September 25, 2019, 06:05
Default UDF to get the average temperature of two faces and use them to defin
  #14
Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 38
Rep Power: 11
rampal is on a distinguished road
hi,
I am working on the udf to define a property based on the temperature of two different faces (annulus ).

The UDf I am trying to use is

#include "udf.h"


real tavg_glass;
real tavg_abr;

/*averge glasscover innerwall temperature*/

DEFINE_EXECUTE_AT_END(averagetempglasscoverinnerwa ll)
{
Domain *d;
face_t f;
real A[ND_ND];
real area_g = 0.0;
real area_tot_g = 0.0;
int ID = 8; /*this is the ID of the boundary wall that I want to get the temperature from*/
Thread *t;
int zone_ID;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg_glass = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
area_g = NV_MAG(A);
area_tot_g += area_g;
tavg_glass += F_T(f,t)*area_g;
}
end_f_loop(f,t)
tavg_glass /= area_tot_g;
printf("average glass cover temp = %g area_tot_g = %g\n",tavg_glass,area_tot_g);
}

/*averge absorber outerwall temperature*/


DEFINE_EXECUTE_AT_END(averagetempabsorberouterwall )
{
Domain *d;
face_t f;
real A[ND_ND];
real area_a = 0.0;
real area_tot_a = 0.0;
int ID = 9; /*this is the ID of the boundary wall that I want to get the temperature from*/
Thread *t;
int zone_ID;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg_abr = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
area_a = NV_MAG(A);
area_tot_a += area_a;
tavg_abr += F_T(f,t)*area_a;
}
end_f_loop(f,t)
tavg_abr /= area_tot_a;
printf("Tavgabrouterwall = %g area_tot_a = %g\n",tavg_abr,area_tot_a);
}

/*calculation of the property on the basis of the temperature*/

DEFINE_PROPERTY(thermalconductivity,c,t)
{
real keff;
real lamda;
real pressure= 0.0001; /*annulus gas pressure (mmhg=torr=10^-4)*/
real delta = 3.53*pow(10,-8); /*molecular diameter of annulus gas (cm)*/
real Tavg; /* degree calcius*/
real b=1.571; /* interactio coefficient*/
real gamma=1.4; /* ratio of specific heats for the annulus gas*/
real a; /* accomodation coefficient*/
real dia_absorber=0.07; /* absorber tube diameter*/
real dia_glass=0.109; /* glass cover inner diameter*/
real k_air=0.02551; /*normal conductivity*/
Tavg=(tavg_abr+tavg_glass)/2;
lamda=2.331*pow(10,-20)*(Tavg)/(pressure*pow(delta,2));

keff = k_air/((dia_absorber/2)*log(dia_glass/dia_absorber)+b*lamda*((dia_absorber/dia_glass)+1));
return keff;
}

Error on compilation:
The UDF library you are trying to load is not compiled for parallel use on the current platform (win64).

I also tried to work on series fluent, but giving the error:

The UDF library you are trying to load is not compiled for 3ddp on the current platform (win64)
rampal is offline   Reply With Quote

Old   September 25, 2019, 21:45
Default
  #15
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
fluent GUI -> user-defined -> functions -> compiled -> BUILD

Code:
#include "udf.h"


real tavg_glass;
real tavg_abr;

/*averge glasscover innerwall temperature*/

DEFINE_EXECUTE_AT_END(averagetempglasscoverinnerwall)
{
Domain *d;
face_t f;
real A[ND_ND];
real area_g = 0.0;
real area_tot_g = 0.0;
int ID = 8; /*this is the ID of the boundary wall that I want to get the temperature from*/
Thread *t;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg_glass = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
area_g = NV_MAG(A);
area_tot_g += area_g;
tavg_glass += F_T(f,t)*area_g;
}
end_f_loop(f,t)
tavg_glass /= area_tot_g;
Message("average glass cover temp = %g area_tot_g = %g\n",tavg_glass,area_tot_g);
}

/*averge absorber outerwall temperature*/


DEFINE_EXECUTE_AT_END(averagetempabsorberouterwall)
{
Domain *d;
face_t f;
real A[ND_ND];
real area_a = 0.0;
real area_tot_a = 0.0;
int ID = 9; /*this is the ID of the boundary wall that I want to get the temperature from*/
Thread *t;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg_abr = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
area_a = NV_MAG(A); 
area_tot_a += area_a;
tavg_abr += F_T(f,t)*area_a;
}
end_f_loop(f,t)
tavg_abr /= area_tot_a;
Message("Tavgabrouterwall = %g area_tot_a = %g\n",tavg_abr,area_tot_a);
}

/*calculation of the property on the basis of the temperature*/

DEFINE_PROPERTY(thermalconductivity,c,t)
{
real keff;
real lamda;
real pressure= 0.0001; /*annulus gas pressure (mmhg=torr=10^-4)*/
real delta = 3.53*pow(10,-8); /*molecular diameter of annulus gas (cm)*/
real Tavg; /* degree calcius*/
real b=1.571; /* interactio coefficient*/
real gamma=1.4; /* ratio of specific heats for the annulus gas*/
real a; /* accomodation coefficient*/
real dia_absorber=0.07; /* absorber tube diameter*/
real dia_glass=0.109; /* glass cover inner diameter*/
real k_air=0.02551;	/*normal conductivity*/
Tavg=(tavg_abr+tavg_glass)/2;
lamda=2.331*pow(10,-20)*(Tavg)/(pressure*pow(delta,2));

keff = k_air/((dia_absorber/2)*log(dia_glass/dia_absorber)+b*lamda*((dia_absorber/dia_glass)+1));
return keff;
}
best regards
AlexanderZ is offline   Reply With Quote

Old   October 18, 2019, 03:19
Smile
  #16
New Member
 
Sandeep
Join Date: Oct 2019
Posts: 1
Rep Power: 0
sandeepiitd17 is on a distinguished road
Hey all, I need some help on writing UDF for A Wall. The inlet temp changes in distance from 623K to 313K from upside down.
Problem:
Zone 1. 0 cm to 5 cm is at 313K temp
Zone 2. 5 cm to 10 cm is at 423K temp
Zone 3. 10 cm to 15 cm is at 494K temp
Zone 4. 15 cm to 30 cm Temp falls linearly to 613 K
Zone 5. 35 cm to 31 cm is at 623K temp

Hope anyone can help

there is 5 zone.
sandeepiitd17 is offline   Reply With Quote

Old   October 22, 2019, 04:07
Default
  #17
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
Originally Posted by sandeepiitd17 View Post
Hey all, I need some help on writing UDF for A Wall. The inlet temp changes in distance from 623K to 313K from upside down.
Problem:
Zone 1. 0 cm to 5 cm is at 313K temp
Zone 2. 5 cm to 10 cm is at 423K temp
Zone 3. 10 cm to 15 cm is at 494K temp
Zone 4. 15 cm to 30 cm Temp falls linearly to 613 K
Zone 5. 35 cm to 31 cm is at 623K temp

Hope anyone can help

there is 5 zone.
Ansys fluent customization manual
look for DEFINE_PROFILE macro and F_CENTROID macro
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 2, 2022, 06:00
Post Question regarding Segmentation Fault
  #18
New Member
 
Join Date: Nov 2022
Posts: 10
Rep Power: 3
hsze is on a distinguished road
Quote:
Originally Posted by hlmehr View Post
Hey, Thank you for replying.
I did hook up and put in the boundary conditions; the two functions like you said,
It is giving error: recieved a fatal signal (segmentation fault) Error Object: #f
I'll try to change some things and execute it. If you could identify the problem, it would be great.
The problem is with in DEFINE_EXECUTE_AT_END function. I ran both functions separately and this gave the segmentation fault.
Best regards
Hello, sorry for restarting this thread I do realize it's been a couple of years.

I've been trying calculate average temeratures on a profile as well and get the same Segmentation Fault error when running the simulation.
(I've run the same UDF that generated multiple temperatures in parallel mode and one correct temperature in serial mode for the original writer of this thread, with my id and domain of course.)

Have you solved this issue and give me some advice?

So the UDF is interpreted succesfully and I hooked it accordingly and I can initialize it. (Running in serial mode)

Also I get the Segmentation Fault everytime I try to access flow or geometry values in my UDFs. If I use UDFs with constants and normal variables only, for example to define a not changing profile,, I'm able to run the simulation normally and the profile is set as expected.
Does anyone know how to debug this?

Thanks in advance!
hsze is offline   Reply With Quote

Old   November 2, 2022, 22:49
Default
  #19
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
show the code you are using, better to open new thread on forum, however you may put it here as well
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 3, 2022, 03:11
Default
  #20
New Member
 
Join Date: Nov 2022
Posts: 10
Rep Power: 3
hsze is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
show the code you are using, better to open new thread on forum, however you may put it here as well
Thank you for your quick answer and for finding my Thread!!

If anyone else is interested: I declared my domain with the wrong number.

Thanks again!
hsze is offline   Reply With Quote

Reply

Tags
define property, get wall temperature, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



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