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

Pinning the interface contact line - VOF model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 5, 2021, 09:22
Default Pinning the interface contact line - VOF model
  #1
New Member
 
N/A
Join Date: Jan 2021
Posts: 4
Rep Power: 5
pat.jachimczyk is on a distinguished road
Hi,
I am looking for the practical way to pin the interface contact line in Fluent for 3D geometry. On the theoretical side, a pinned contact line means that the outer edge of the liquid droplet, where it intersects the solid substrate, remains stationary (fixed position). The pinning is enforced by keeping the front velocity equal to zero. Fluid can move past the contact point only by rolling over it, not by moving the contact line along the surface.

I want to use the pinning feature in two phase system (VOF model) for simulation of deformation pinned water droplet placed on a horizontal flat surface. The droplet deformation is caused by the flow of the oil phase. The oil flow is parallel to the surface.

I have tried to prepare the udf implemented in boundary conditions (oil inlet) to introduce constant value of oil velocity and velocity value equal to 0 for cells placed on the two phase contact line (water, solid). In this problem, only one function can be used because of only one inlet stream. The water phase is initialized by other udf.

Below you can find draft of udf iterating through domains (water and oil) and cells within the mesh searching for the contact area between water and solid phases (droplet base). Actually, I don’t know how to combine F_PROFILE macro with iteration loop through domains. I do not know which arguments regarding domain/subdomain should be passed in DEFINE_PROFILE macro.

I am using ANSYS Fluent 2020R2
I would be grateful for any help.

Best regards


#include "udf.h"

DEFINE_PROFILE(x_velocity, cell_thread, cell_index)
{
int phase_domain_index;
cell_t cell;
real xc[ND_ND]; //cells coordinates
Domain *subdomain;

sub_domain_loop(subdomain, phase_domain_index)
{
if (DOMAIN_ID(subdomain) == 3) //Water Domain ID = 3
thread_loop_c (cell_thread,subdomain)
{
begin_c_loop_all (cell,cell_thread)
{
C_CENTROID(xc,cell,cell_thread);
//searching for the contact area between water and solid phases
if ((xc[2] <= 0.00008) && (sqrt(ND_SUM(pow(xc[0],2.0),pow(xc[1],2.0),pow(0.0,2.0))) < 0.000062039))
F_PROFILE(cell, cell_thread, cell_index) = 0.0;
else
F_PROFILE(cell, cell_thread, cell_index) = 0.5;
}
end_c_loop_all (cell,cell_thread)
}
}
}
pat.jachimczyk is offline   Reply With Quote

Old   January 7, 2021, 04:07
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
not sure about subdomain, but your code here looks correct
(DOMAIN_ID(subdomain) == 3) //Water Domain ID = 3

why do you have cell in the list of arguments for define_profile?
DEFINE_PROFILE(x_velocity, cell_thread, cell_index)

It means you are going to apply it to zone not to boundary!
How are you going to hook this udf to your model?
As far As I understand, define_profile is executed before each iteration (cause of common sense, boundary conditions must be applied/updated before iteration)

On the other hand, you may use define_adjust macro, which is also executed before each iteration
__________________
best regards


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

Old   January 7, 2021, 09:46
Default
  #3
New Member
 
N/A
Join Date: Jan 2021
Posts: 4
Rep Power: 5
pat.jachimczyk is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
It means you are going to apply it to zone not to boundary!
How are you going to hook this udf to your model?
As far As I understand, define_profile is executed before each iteration (cause of common sense, boundary conditions must be applied/updated before iteration)

On the other hand, you may use define_adjust macro, which is also executed before each iteration

Thank you for reply

My idea was to apply define_profile function to inlet boundary condition without hooking, just only after compilation I want to apply udf in Velocity Magnitude instead of constant value in Velocity inlet window.

Unfortunately, I do not know how to indicate particular cells/faces of second phase (water) to the Fluent and give them x-velocity equal to 0 as a boundary condition. The problem is that this boundary is located inside of fluid zone. Therefore, I have tried with definition of water domain.

Maybe it is not suitable way of solving my problem and I should use different macro (as you suggested) and hook the udf in Adjust window.

Best regards
Attached Images
File Type: jpg Fig_1.jpg (78.0 KB, 31 views)
pat.jachimczyk is offline   Reply With Quote

Old   January 8, 2021, 01:24
Default
  #4
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:
My idea was to apply define_profile function to inlet boundary condition without hooking
1. Applying to BC is hooking actually. Same meaning here.
2. " to apply define_profile function to inlet" seems different from what you are showing on picture. I can see droplet inside oil zone, so inlet is not involved
3. your code has cell inside arguments list of define_profile macro (so it means you are going to apply it to zone not to boundary(inlet))
4. Use your code, go to oil zone -> fixed values-> x-velocity -> change const to your udf

Frankly speaking, im not sure if your definition of changing velocity for secondary phase is correct, but for me it seems so
__________________
best regards


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

Old   January 15, 2021, 08:49
Default
  #5
New Member
 
N/A
Join Date: Jan 2021
Posts: 4
Rep Power: 5
pat.jachimczyk is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
1. Applying to BC is hooking actually. Same meaning here.
2. " to apply define_profile function to inlet" seems different from what you are showing on picture. I can see droplet inside oil zone, so inlet is not involved
3. your code has cell inside arguments list of define_profile macro (so it means you are going to apply it to zone not to boundary(inlet))
4. Use your code, go to oil zone -> fixed values-> x-velocity -> change const to your udf
Thank you, your tips were very helpful.

I have modified my code and now looks as follow.

#include "udf.h"

#define FLUID_ID 6

DEFINE_PROFILE(x_velocity_1,t,i)
{
face_t f;
float xc[ND_ND]; // coordinates
float x;
float y;
float z;

begin_f_loop(f,t)
{
F_CENTROID(xc,f,t);
x = xc[0];
y = xc[1];
z = xc[2];

if (x > -0.001 && x < 0.002)
{
if (y > -0.0015 && y < 0.0015)
{
if (z > 0.0008 && z < 0.0012) //3D area with given by F_PROFILE velocity
{
F_PROFILE(f,t,i) = 0.05;
}
}
}
}
end_f_loop(f,t)
}


I hooked the udf in x-velocity coordinate but I met other problem, the code works only when velocity given in udf is higher than 0 (for example F_PROFILE(f,t,i) = 0.05) and Inlet velocity given in boundary condition is equal to 0 (look at Fig_2).

When Inlet velocity is higher than 0, the Fluent shows different errors such as: Floating point exception; Global Courant Number is higher than 250; The velocity field is probably diverging. Then, on the contour figure it looks like the inlet velocity is blocked (look at Fig_3).

The important thing is that errors do not occure when udf is hooked in y-velocity coordinate and Inlet velocity is given as previously in x-coordinate.
I see the problem with convergence x-velocity field in my system. How can I figure out it?

Best regards
Attached Images
File Type: jpg Fig_2.jpg (66.6 KB, 15 views)
File Type: jpg Fig_3.jpg (70.0 KB, 11 views)
pat.jachimczyk is offline   Reply With Quote

Old   January 18, 2021, 01:17
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
first of all, I'm not sure if inlet could be with negative velocity value (which means it's not inlet anymore)

If you want to define velocity in domain (not on boundary), you should use loop over cells inside DEFINE_PROFILE macro, not loop over faces
Code:
was
begin_f_loop(f,t)
to be 
begin_c_loop(c,t)
you should be able to apply any value if it is physical

turn off "node values" option while making plotting contours so you will see the real values in cells
__________________
best regards


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

Old   June 19, 2022, 13:51
Default The way to pin the interface contact line.
  #7
New Member
 
ChonghaoLi
Join Date: Jun 2022
Posts: 2
Rep Power: 0
lch_njust is on a distinguished road
Hi,
I am interested in this part:

I am looking for the practical way to pin the interface contact line in Fluent for 3D geometry. On the theoretical side, a pinned contact line means that the outer edge of the liquid droplet, where it intersects the solid substrate, remains stationary (fixed position). The pinning is enforced by keeping the front velocity equal to zero. Fluid can move past the contact point only by rolling over it, not by moving the contact line along the surface.

Could you tell me how you pinned the interface contact line finally?
I would be grateful for your help.

Best regards
lch_njust is offline   Reply With Quote

Old   June 21, 2022, 02:07
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
I have no experience in this kind of simulations, but in fluent there should be some settings to control it
it could be called something like "contact angle"
my feeling is it should be somewhere with "surface tension" settings
__________________
best regards


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

Old   June 21, 2022, 12:12
Default
  #9
New Member
 
ChonghaoLi
Join Date: Jun 2022
Posts: 2
Rep Power: 0
lch_njust is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
I have no experience in this kind of simulations, but in fluent there should be some settings to control it
it could be called something like "contact angle"
my feeling is it should be somewhere with "surface tension" settings
Thank you for reply

Contact angle can indeed be controlled at boundary conditions(wall adhesion) in FLUENT .

However,I want to control contact line(or point) instead of contact angle.Similarly,you also want to control contact line in your case.So I would like to ask for advice how deal with it.

I have tried to use the udf to control volume fraction of the face.But my udf has no impact.Maybe you could give me some advice.

#include "udf.h"
DEFINE_ADJUST(adjust_vof, d)
{
Thread*t;
face_t f;
real xd[ND_ND];
thread_loop_f(t, d)
{
begin_f_loop(f, t)
{
if (xd[1] == 1.5&&xd[0] <= 0.245)
F_VOF(f, t) = 1;
if (xd[1] == 1.5&&(xd[0] > 0.245&&xd[0] < 0.255))
F_VOF(f, t) = 25.5 - 100*xd[0];
if (xd[1] == 1.5&&xd[0] >= 0.255)
F_VOF(f, t) = 0;
if (xd[1] == 0.5&&xd[0] <= 0.245)
F_VOF(f, t) = 1;
if (xd[1] == 0.5&&(xd[0] > 0.245&&xd[0] < 0.255))
F_VOF(f, t) = 25.5 - 100*xd[0];
if (xd[1] == 0.5&&xd[0] >= 0.255)
F_VOF(f, t) = 0;
}
end_f_loop(f, t)
}
}

My udf can't pin the interface contact point(line in 3D).I need some advice.

I would be grateful for any help.
Best regards
Attached Images
File Type: jpg phase.jpg (66.6 KB, 9 views)
File Type: jpg phase_magnified.jpg (198.9 KB, 9 views)
lch_njust is offline   Reply With Quote

Reply

Tags
interface detection, udf f_profile, water droplet in oil flow


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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 18:22
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 02:44
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 18:38
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56
OpenFOAM15 installables are incomplete problem with paraFoam tryingof OpenFOAM Bugs 17 December 7, 2008 05:41


All times are GMT -4. The time now is 13:45.