|
[Sponsors] |
December 12, 2020, 09:44 |
multiphase, define profile
|
#1 |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Hi everybody,
I have a question that I'm stuck in it; I asked this question at the end of the last thread that I made, but because I'm in a hurry (deadlines) and I thought that because the discussion's getting long, nobody answered. So I ask it again here. I want to catch the VOF of the phases on the wall by a defined profile. Is there any macro for this purpose, and with what data accessing and looping macro? I send my code here, so if you can help me, I will be appreciated. but when I apply my code, the fluent crashes out as soon as I initialize the solution. (image attache) #include "udf.h" #include "mem.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "metric.h" DEFINE_PROFILE(heatflux_slip_shoulder_W, t, i) { /*Domain *d=Get_Domain(1);*/ int phase_domain_index = 0; /* primary phase index is 0 */ Thread *tm = THREAD_SUPER_THREAD(t); Thread *subthread = THREAD_SUB_THREAD(tm,phase_domain_index); double p[ND_ND]; /* this will hold the position vector */ double x, y, r, qslip, sigma, tav_stick, tav_fric, temp, Vx, Vy, Vz, V_W, V_T, VF; double w = 1120; double pi = 3.1415927; double U = 0.002; double press = 50000000; double delta = 0.65; double etta = 0.7; double heat_ratio = 0.6383; double Rshol = 0.0075; double fric ; double Rpin = 0.0025; face_t f; /*thread_loop_f(f, d)*/ { begin_f_loop(f,t) { VF =F_VOF(f,subthread); F_CENTROID(p, f, t); x = p[0]; y = p[1]; r = sqrt((x*x) + (y*y)); temp = F_T(f,t);if ((297.<=temp)&&(temp<=273.)) { sigma_6 = 325.80263157895 + (-0.171052631578952 * temp); sigma_5 = 282.355263157897 + (-0.0921052631578974*temp); } ...(and some conditions like above)... if ((297.<=temp)&&(temp<=855.)) fric = 0.383752244165171 + (-0.000448833034111311 * temp); else fric = 0; tav_6 = sigma_6*1000000/1.732; tav_5 = sigma_5*1000000/1.732; tav = VF * tav_6 + (1 - VF ) * tav_5; qslip = ((pi*w*r/30) - (U*y/r)) * ((etta * (1 - delta) * tav) + (delta * fric * press)); F_PROFILE(f, t, i) = heat_ratio * qslip; } end_f_loop(f,t) } |
|
December 14, 2020, 02:08 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
compile this code
Code:
#include "udf.h" #include "mem.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "metric.h" DEFINE_PROFILE(heatflux_slip_shoulder_W, t, i) { /*Domain *d=Get_Domain(1);*/ int phase_domain_index = 0; /* primary phase index is 0 */ Thread *subthread = THREAD_SUB_THREAD(t,phase_domain_index); double p_coord[ND_ND]; /* this will hold the position vector */ double x, y, r, qslip, sigma, tav_stick, tav_fric, temp, Vx, Vy, Vz, V_W, V_T, VF; double w = 1120; double pi = 3.1415927; double U = 0.002; double press = 50000000; double delta = 0.65; double etta = 0.7; double heat_ratio = 0.6383; double Rshol = 0.0075; double fric ; double Rpin = 0.0025; face_t f; begin_f_loop(f,t) { VF =F_VOF(f,subthread); F_CENTROID(p_coord, f, t); x = p_coord[0]; y = p_coord[1]; r = sqrt((x*x) + (y*y)); temp = F_T(f,t);if ((297.<=temp)&&(temp<=273.)) { sigma_6 = 325.80263157895 + (-0.171052631578952 * temp); sigma_5 = 282.355263157897 + (-0.0921052631578974*temp); } /*...(and some conditions like above)...*/ if ((297.<=temp)&&(temp<=855.)) fric = 0.383752244165171 + (-0.000448833034111311 * temp); else fric = 0; tav_6 = sigma_6*1000000/1.732; tav_5 = sigma_5*1000000/1.732; tav = VF * tav_6 + (1 - VF ) * tav_5; qslip = ((pi*w*r/30) - (U*y/r)) * ((etta * (1 - delta) * tav) + (delta * fric * press)); F_PROFILE(f, t, i) = heat_ratio * qslip; } end_f_loop(f,t) }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 14, 2020, 04:20 |
|
#3 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
Thank you so much, I do your command, but nothing changed; I attached the error log file also here. and I should mention that I put my simulation on the volume of fluid multiphase. (not mixture or Elureian) So, what do you think? Where is the problem? It's from F_VOF macro, or it's from its domain and thread? |
||
December 14, 2020, 04:25 |
|
#4 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
so here is : |
||
December 14, 2020, 06:34 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
try this code
Code:
#include "udf.h" DEFINE_PROFILE(heatflux_slip_shoulder_W, t, i) { /*Domain *d=Get_Domain(1);*/ int phase_domain_index = 0; /* primary phase index is 0 */ Thread *subthread = THREAD_SUB_THREAD(t,phase_domain_index); face_t f; begin_f_loop(f,t) { VF =F_VOF(f,subthread); F_UDMI(f,t,0) = VF; F_PROFILE(f, t, i) = 1.0; } end_f_loop(f,t) } now you may plot VOF distribution
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 15, 2020, 02:22 |
|
#6 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
Well, I try this one, and again fluent crashes out. I'm confused, and I don't know what's happening? I am suspicious that maybe I do something wrong. So I want to say what I did; first of all, I compiled the UDF, it was ok. Then I allocated one udm. Then I defined my model, multiphase vof (implicit), and energy and laminar flow. Then I defined my material from fluent material, air, and water vapor. Then in the list of phases, I made air primary and the other secondary phase. And in boundary, I define velocity inlet of phases and outflow and apply udf on wall shoulder. Then initialize and crash. Here my image of geometry. This image is when I initialize and patch it first and then apply the UDF on the wall. Is there any problem with my steps? |
||
December 15, 2020, 05:10 |
|
#7 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
I want to share some result with you, well, I explorer in the UDF manual, and I find one example that was near my project, and I apply that to my work. The example was: "Example UDF that Utilizes UDM and UDS Variables" on page 332 in UDF manual 19 R3. When I apply to adjust, fluent crashes out again. What do you think about that? Where is the problem? and I should mention that I allocated udm and uds in GUI. Thanks a lot. |
||
December 17, 2020, 02:49 |
|
#8 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
most likely, if you use code from manual and get error - there is a problem with your case, not with a code
you've told Quote:
__________________
best regards ****************************** press LIKE if this message was helpful |
||
December 17, 2020, 04:54 |
|
#9 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
Can you tell me more about the case problem, because when I don't apply the VOF code, it runs very well? And about the initialize first and then apply UDF, I tried that. When I want to apply the macro on the wall, it crashes out. |
||
December 17, 2020, 10:25 |
|
#10 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
Thanks. |
||
December 17, 2020, 11:13 |
|
#11 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
I try what you said. I initialize first and then apply the UDF and put them on the boundary; up to now, there was no problem. Then I click on the calculation, and I face this error. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hydrogen storage by metal hydride | longbk | FLUENT | 12 | August 1, 2023 20:13 |
Multiphase - Define pressure for 1 phase | melona | FLUENT | 1 | March 15, 2020 12:15 |
Unsteady Boundary Profile with data file | Arianna | FLUENT | 34 | July 29, 2019 16:35 |
UDF carbon conversion | papteo | Fluent UDF and Scheme Programming | 1 | August 18, 2011 07:32 |
multiphase define | perry | FLUENT | 4 | June 7, 2005 09:57 |