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

multiphase, define profile

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By AlexanderZ
  • 1 Post By AlexanderZ
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 12, 2020, 09:44
Default multiphase, define profile
  #1
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
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)
}
Attached Images
File Type: jpg Screenshot (520).jpg (121.8 KB, 5 views)
mohammadreza_hj is offline   Reply With Quote

Old   December 14, 2020, 02:08
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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)
}
mohammadreza_hj likes this.
__________________
best regards


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

Old   December 14, 2020, 04:20
Default
  #3
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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)
}
Hello AlexanderZ,
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?
mohammadreza_hj is offline   Reply With Quote

Old   December 14, 2020, 04:25
Default
  #4
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by mohammadreza_hj View Post
Hello AlexanderZ,
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?
I'm so sorry; I forgot to attach the error file.
so here is :
Attached Images
File Type: jpg Screenshot (525).jpg (46.1 KB, 2 views)
File Type: jpg Screenshot (524).jpg (74.0 KB, 1 views)
mohammadreza_hj is offline   Reply With Quote

Old   December 14, 2020, 06:34
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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)
}
allocate 1 user-defined memory location in fluent GUI.
now you may plot VOF distribution
mohammadreza_hj likes this.
__________________
best regards


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

Old   December 15, 2020, 02:22
Default
  #6
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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)
}
Allocate 1 user-defined memory location in fluent GUI.
now you may plot VOF distribution
Thanks for your attention, Mr. alexander

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?
Attached Images
File Type: jpg Screenshot (372).jpg (123.7 KB, 2 views)
mohammadreza_hj is offline   Reply With Quote

Old   December 15, 2020, 05:10
Default
  #7
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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)
}
Allocate 1 user-defined memory location in fluent GUI.
now you may plot VOF distribution
Hi, again Mr alexanderz,
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.
mohammadreza_hj is offline   Reply With Quote

Old   December 17, 2020, 02:49
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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:
This image is when I initialize and patch it first and then apply the UDF on the wall.
try this approach, actually, initialize first, then apply UDF and run the case.
mohammadreza_hj likes this.
__________________
best regards


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

Old   December 17, 2020, 04:54
Default
  #9
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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


try this approach, actually, initialize first, then apply UDF and run the case.
Thank you alexanderz

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.
mohammadreza_hj is offline   Reply With Quote

Old   December 17, 2020, 10:25
Default
  #10
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by mohammadreza_hj View Post
Thank you alexanderz

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.
Oh, I'm sorry I did not get your point; I think I was busy; I will do that.
Thanks.
mohammadreza_hj is offline   Reply With Quote

Old   December 17, 2020, 11:13
Default
  #11
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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


try this approach, actually, initialize first, then apply UDF and run the case.
Mr. Alexanderz,

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.
Attached Images
File Type: jpg Screenshot (541).jpg (136.9 KB, 3 views)
File Type: jpg Screenshot (539).jpg (139.5 KB, 3 views)
File Type: jpg Screenshot (540).jpg (137.1 KB, 1 views)
mohammadreza_hj is offline   Reply With Quote

Reply


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


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


All times are GMT -4. The time now is 16:42.