|
[Sponsors] |
May 7, 2015, 02:13 |
How to give names to udf memory?
|
#1 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
In the contour plots C_UDMI(c,t,1) shows contours of user defined memory 1.
But I need this macro should display contours of velocity, temperature volume fraction etc.. How to give name to this macro? Any help would be appreciated |
|
May 7, 2015, 02:54 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Use the "Set_User_Memory_Name" function with the following format (read the section in the user's guide on User-Defined Memory for details).
Code:
void Set_User_Memory_Name(int i,char *name); |
|
May 7, 2015, 07:49 |
|
#3 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
Thank you.
Can you help me to solve this? Code:
#include "udf.h" #include "sg_udms.h" #include "math.h" #include "mem.h" #include "sg.h" " DEFINE_ADJUST(temp, d) { #if PARALLEL Domain *d; real tavg = 0.; real tmax = 0.; real tmin = 0.; real temp,volume,vol_tot; void Set_User_Memory_Name(int i,char *temp_ratio); Thread *t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { volume = C_VOLUME(c,t); temp = C_T(c,t); if (temp < tmin || tmin == 0.) tmin = temp; if (temp > tmax || tmax == 0.) tmax = temp; vol_tot += volume; tavg += temp*volume; } end_c_loop(c,t) tavg /= vol_tot; printf("\n Tmin = %g Tmax = %g Tavg = %g\n",tmin,tmax,tavg); begin_c_loop(c,t) { temp = C_T(c,t); C_UDMI(c,t,0) = (temp-tmin)/(tmax-tmin); C_UDMI(c,t,temp_ratio)= C_UDMI(c,t,0); } end_c_loop(c,t) } #endif } |
|
May 7, 2015, 08:55 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
That's not how you call functions in C. The format I posted above was of the function declaration. Try the following code to call the function:
Code:
Set_User_Memory_Name(0, "temp_ratio"); Code:
C_UDMI(c,t,temp_ratio)= C_UDMI(c,t,0); |
|
May 8, 2015, 02:37 |
|
#5 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
I replaced but didn't work.. Can you modify?
Code:
#include "udf.h" #include "sg_udms.h" #include "math.h" #include "mem.h" #include "sg.h" " DEFINE_ADJUST(temp, d) { #if PARALLEL Domain *d; real tavg = 0.; real tmax = 0.; real tmin = 0.; real temp,volume,vol_tot; void Set_User_Memory_Name(int i,char *temp_ratio); Thread *t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { volume = C_VOLUME(c,t); temp = C_T(c,t); if (temp < tmin || tmin == 0.) tmin = temp; if (temp > tmax || tmax == 0.) tmax = temp; vol_tot += volume; tavg += temp*volume; } end_c_loop(c,t) tavg /= vol_tot; printf("\n Tmin = %g Tmax = %g Tavg = %g\n",tmin,tmax,tavg); begin_c_loop(c,t) { temp = C_T(c,t); C_UDMI(c,t,0) = (temp-tmin)/(tmax-tmin); Set_User_Memory_Name(0, "temp_ratio"); } end_c_loop(c,t) } #endif } |
|
May 8, 2015, 03:23 |
|
#6 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
You still have the following line in your code...
Code:
void Set_User_Memory_Name(int i,char *temp_ratio); |
|
May 8, 2015, 04:53 |
|
#7 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
Code:
void Set_User_Memory_Name(int i,char *temp_ratio); |
|
May 8, 2015, 06:48 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Does the code do what you want it to do?
If so, it is ok. |
|
May 8, 2015, 07:01 |
|
#9 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
Thank you
Yes. This is the only code.. Here I need to change inlet conditions, temperature values etc.. Code:
#include "udf.h" #include "sg_udms.h" #include "math.h" #include "mem.h" #include "sg.h" " DEFINE_ADJUST(temp, d) { #if PARALLEL Domain *d; real tavg = 0.; real tmax = 0.; real tmin = 0.; real temp,volume,vol_tot; Thread *t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { volume = C_VOLUME(c,t); temp = C_T(c,t); if (temp < tmin || tmin == 0.) tmin = temp; if (temp > tmax || tmax == 0.) tmax = temp; vol_tot += volume; tavg += temp*volume; } end_c_loop(c,t) tavg /= vol_tot; printf("\n Tmin = %g Tmax = %g Tavg = %g\n",tmin,tmax,tavg); begin_c_loop(c,t) { temp = C_T(c,t); C_UDMI(c,t,0) = (temp-tmin)/(tmax-tmin); Set_User_Memory_Name(0, "temp_ratio"); } end_c_loop(c,t) } #endif } |
|
May 8, 2015, 08:13 |
|
#10 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
Do you want to know if it compiles? Try it. Do you want to know if it does what you want it to do? I don't know, because I don't know what you want it to do. And what do you mean with "declare function as mentioned in the Manual"? Which part of the manual are you referring to? I only have one remark. One thing your code does, is set the name "temp_ratio" to UDM0 many times, where one time is enough. You don't have to put that in the loop, so you can make your code more efficient by putting that line somewhere else. |
||
May 10, 2015, 09:13 |
|
#11 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
Thank you. I just needed the name of that udm-0 in the contour menu. I got it thank you very much.
|
|
May 10, 2015, 09:50 |
|
#12 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
I have one more doubt. Can this udm be read in CFX post?
|
|
May 10, 2015, 18:46 |
|
#13 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
UDM values can be visualised in CFD-Post. Ensure you have saved these values via File > Data File Quantities...
|
|
May 11, 2015, 00:59 |
|
#14 |
New Member
Join Date: Apr 2015
Posts: 12
Rep Power: 11 |
||
May 11, 2015, 07:01 |
|
#15 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Hi,
Have you read this udm in techplot? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf for 3d model to give heat flux profile around the wall surface | n7310889 | Fluent UDF and Scheme Programming | 3 | May 8, 2018 07:45 |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
Run-time memory allocation error | akalopsis | CFX | 0 | November 17, 2014 18:17 |
Lenovo C30 memory configuration and discussions with Lenovo | matthewe | Hardware | 3 | October 17, 2013 11:23 |
Identifying cell in parallel UDF | upeksa | Fluent UDF and Scheme Programming | 0 | July 24, 2013 12:27 |