CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for computing Interfacial area in 3 phase flow (https://www.cfd-online.com/Forums/fluent-udf/228307-udf-computing-interfacial-area-3-phase-flow.html)

Anshs June 26, 2020 10:26

UDF for computing Interfacial area in 3 phase flow
 
1 Attachment(s)
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.

Attachment 78682


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);

}

}


AlexanderZ June 28, 2020 22:48

most likely, you've loaded libudf library already unload it before compiling the code.

also you may see following
Code:

udf_names.c and user_nt.udf files in 2ddp are upto date.
to avoid it before compiling make folowwing: anywhere in your code put any letter, then delete it (space for instance). Save file. That is how you can update file.

Anshs June 29, 2020 05:27

Quote:

Originally Posted by AlexanderZ (Post 776307)
most likely, you've loaded libudf library already unload it before compiling the code.

also you may see following
Code:

udf_names.c and user_nt.udf files in 2ddp are upto date.
to avoid it before compiling make folowwing: anywhere in your code put any letter, then delete it (space for instance). Save file. That is how you can update file.

I'm not able to understand your reply! Can you please elaborate on your reply, or re-write it using proper English!

Thank you.

AlexanderZ June 29, 2020 18:10

proper english for you Anshuman Sinha

you are trying to loaded libudf library which had been loaded already. unload it before compiling the code.

to fix up_to_date issue make following: anywhere in your code put any letter, then delete it (space letter for instance). Save your source file. Compile


All times are GMT -4. The time now is 02:08.