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

Interfacial area UDF for 3 phase flow

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2020, 22:31
Default Interfacial area UDF for 3 phase flow
  #1
Member
 
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8
Anshs is on a distinguished road
I'm trying to compute the interfacial area between 2 phases, given that there are 3 phases. I have tried a UDF here. The three phases are water, oil, air. Computing the area between air (phase 2) and water (phase 0) only.

Screenshot 2020-06-07 at 6.07.27 AM.jpg

I had constructed a code for 2 phase flows, but now I want to implement in 3 phases:

2 phase code:

Code:
#include "udf.h"

DEFINE_ADJUST(store_gradient, domain)

{

Thread *t;
Thread **pt;
cell_t c;


double A_inter3;


int phase_domain_index = 0.;
Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index);

{
Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomain, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomain,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}


mp_thread_loop_c (t,domain,pt)

if (FLUID_THREAD_P(t))
{

Thread *ppt = pt[phase_domain_index];


C_UDMI(c,t,0) = NV_MAG(C_VOF_G(c,ppt)) ;

A_inter3 += C_UDMI(c, t, 0)*C_VOLUME(c, ppt) ;


Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);

}

}

3 phase code: ( in code ppti = water , and pptj = air )


Code:
#include "udf.h"

DEFINE_ADJUST(store_gradient, domain)

{

Thread *t;
Thread **pt;
cell_t c;


double A_inter3;


int pdi = 0.;
int pdf = 2.;

Domain *pDomaini = DOMAIN_SUB_DOMAIN(domain,pdi);

{
Alloc_Storage_Vars(pDomaini,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomaini, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomaini,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}

Domain *pDomainj = DOMAIN_SUB_DOMAIN(domain,pdj);

{
Alloc_Storage_Vars(pDomainj,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomainj, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomainj,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}


mp_thread_loop_c (t,domain,pt)

Thread *ppti = pt[pdi];
Thread *pptj = pt[pdi];

if ( ( C_VOF(c,ppti)*C_VOF(c,pptj) > 0.21 ) && (C_VOF(c,ppti) + C_VOF(c,pptj) >0.95) )
{


C_UDMI(c,t,0) = NV_MAG(C_VOF_G(c,ppti)) ;

A_inter3 += C_UDMI(c, t, 0)*C_VOLUME(c, ppti) ;



Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);

}

}
Anshs is offline   Reply With Quote

Old   June 9, 2020, 01:51
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
any question?

in your code you do have
Code:
Thread *ppti = pt[pdi];
Thread *pptj = pt[pdi];
__________________
best regards


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

Old   June 9, 2020, 09:56
Default 3 phase code not working
  #3
Member
 
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8
Anshs is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
any question?

in your code you do have
Code:
Thread *ppti = pt[pdi];
Thread *pptj = pt[pdi];
Yes, my 3 phase code is not working.
Anshs is offline   Reply With Quote

Old   June 10, 2020, 01:08
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
are you going to describe your issues or you expect people here can guess them?
__________________
best regards


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

Old   June 15, 2020, 05:12
Default Interfacial Area
  #5
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Are you getting all values as 0? If that is the case, then try plotting the UDM where you are saving gradients.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 11:13
Default 3 phase area
  #6
Member
 
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8
Anshs is on a distinguished road
Quote:
Originally Posted by vinerm View Post
Are you getting all values as 0? If that is the case, then try plotting the UDM where you are saving gradients.

I hawe tried compiling this udf, and getting the following error: Can you please help me.



Error:

Code:
Copied D:\ladle final - Copy/D:\ladle final - Copy\area_ud.c to D:
ew_ladle\ladle_x_files\dp0\FFF-5\Fluent\libudf\src
udf_names.c and user_nt.udf files in 2ddp are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\v180\fluent"\fluent18.0.0\src\udf\makefile_nt.udf "D:
ew_ladle\ladle_x_files\dp0\FFF-5\Fluent\libudf\win64\2ddp\makefile" ")
        1 file(s) copied.
(chdir "D:\new_ladle\ladle_x_files\dp0\FFF-5\Fluent\libudf")(chdir "win64\2ddp")# Linking libudf.dll because of user_nt.udf udf_names.obj area_ud.obj
Microsoft (R) Incremental Linker Version 14.00.24213.1
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1104: cannot open file 'libudf.dll'

Done.

UDF:

Code:
#include "udf.h"

DEFINE_ADJUST(store_gradient, domain)

{

Thread *t;
Thread **pt;
cell_t c;


double A_inter3;


int pdi = 0.;
int pdf = 2.;

Domain *pDomaini = DOMAIN_SUB_DOMAIN(domain,pdi);

{
Alloc_Storage_Vars(pDomaini,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomaini, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomaini,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}

Domain *pDomainf = DOMAIN_SUB_DOMAIN(domain,pdf);

{
Alloc_Storage_Vars(pDomainf,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomainf, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomainf,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}


mp_thread_loop_c (t,domain,pt)


if (FLUID_THREAD_P(t))

{

Thread *ppti = pt[0];
Thread *pptf = pt[2];

if ( ( C_VOF(c,ppti)*C_VOF(c,pptf) > 0.21 ) && (C_VOF(c,ppti) + C_VOF(c,pptf) >0.95) )
{


C_UDMI(c,t,0) = NV_MAG(C_VOF_G(c,ppti)) ;

A_inter3 += C_UDMI(c, t, 0)*C_VOLUME(c, ppti) ;

}

}

Message("\n : Area Density= %f\n", C_UDMI(c, t, 0));

Free_Storage_Vars(pDomaini,SV_VOF_RG,SV_VOF_G,SV_NULL);

Free_Storage_Vars(pDomainf,SV_VOF_RG,SV_VOF_G,SV_NULL);


}

 


On 2020-06-25 18:46, anshs wrote:

#include "udf.h"

DEFINE_ADJUST(store_gradient, domain)

{

Thread *t;
Thread **pt;
cell_t c;


double A_inter3;


int pdi = 0.;
int pdf = 2.;

Domain *pDomaini = DOMAIN_SUB_DOMAIN(domain,pdi);

{
Alloc_Storage_Vars(pDomaini,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomaini, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomaini,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}

Domain *pDomainj = DOMAIN_SUB_DOMAIN(domain,pdj);

{
Alloc_Storage_Vars(pDomainj,SV_VOF_RG,SV_VOF_G,SV_NULL);
Scalar_Reconstruction(pDomainj, SV_VOF,-1,SV_VOF_RG,NULL);
Scalar_Derivatives(pDomainj,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
Vof_Deriv_Accumulate);
}


mp_thread_loop_c (t,domain,pt)

Thread *ppti = pt[pdi];
Thread *pptj = pt[pdi];

if ( ( C_VOF(c,ppti)*C_VOF(c,pptj) > 0.21 ) && (C_VOF(c,ppti) + C_VOF(c,pptj) >0.95) )
{


C_UDMI(c,t,0) = NV_MAG(C_VOF_G(c,ppti)) ;

A_inter3 += C_UDMI(c, t, 0)*C_VOLUME(c, ppti) ;



Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);

}

}
Anshs is offline   Reply With Quote

Reply

Tags
fluent, interfacial area, multiphase, 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF bug, for reversing flow direction and magnitude EngGhost Fluent UDF and Scheme Programming 12 April 20, 2020 08:50
CFX Modelling 3 Phase flow with particle transport fluid and particle transport solid amon CFX 4 February 25, 2020 16:55
How to Find Temperature Field of Two Phase Flow? Shomaz ul Haq CFX 5 October 16, 2017 06:25
Help me to check my UDF Liufeng_ustb Fluent UDF and Scheme Programming 2 May 7, 2013 11:25
CFX Solver Memory Error mike CFX 1 March 19, 2008 08:22


All times are GMT -4. The time now is 15:18.