CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   mass flux at adjacent cell to wall: Hertz-Knudsen-Schrage (https://www.cfd-online.com/Forums/fluent/228115-mass-flux-adjacent-cell-wall-hertz-knudsen-schrage.html)

arunraj June 20, 2020 06:18

mass flux at adjacent cell to wall: Hertz-Knudsen-Schrage
 
1 Attachment(s)
Dear all,

I want to apply the attached mass flux equation to the cells near the wall. Could someone correct my code. I have successfully applied constant heat flux value near the wall. However, applying the function seems bit tricky. Here, Pv and Tv are the vapor pressure and temperature. Pi and Ti are the temperature adjacent to the wall. Pi is calculated from Clausius-Clapeyron equation.

#include "udf.h"
int boundaryID=78;
DEFINE_ON_DEMAND(on_demand_calc)
{
real sigma;
real R=8314.40;
real M=18.015;
real hfg=2406000;
real const;
real pi;
real ti;
real pstatic=C_P(c,t);
real poper=RP_Get_Float("operating-pressure");
real pv;
real tv=C_T(c,t);
real area;
face_t f;
cell_t c;
Domain *domain=Get_Domain(1);
Thread *t;
Thread *tf
thread_loop_f(t,domain)
{
if (THREAD_ID(t)==boundaryID)
{
begin_f_loop(f,t)
{
F_AREA(area,f,t);
area =NV_MAG(area);
pi=exp(((hfg*M)/R)*((1/373.0)-(1/C_T(c0,t0))))*101325.0;
ti=sqrt(C_T(c0,t0);
pv=pstatic+poper;
const=((2*sigma)/(1-sigma))*(1/sqrt(2*3.141592653589*(R/M)));
C_UDMI(F_C0(f,t),THREAD_T0(t),0)=(const*(((pv)/tv)-(pi/ti))))*area;
}
end_f_loop(f,t)
}
}

vinerm June 20, 2020 16:14

Flux or Source
 
You cannot apply flux to the cells; you need to apply these as sources or apply at the faces instead of the cells. As far as the code is concerned, it is not applying anything; only calculating and storing in UDM. And no where is value of sigma being calculated. There is nothing called RP_Get_Float; use RP_Get_Real. There are many other syntactical mistakes in the code. It won't even compile.

arunraj June 21, 2020 00:41

Wick-vapor interface
 
Hi vinerm,
Thanks for your reply. I did things in a hurry. I have attached the corrected UDF. This is compiling successfully. However, I have some doubt. Can we use
C_P(c,t), C_T(c,t), RP_Get_Real("operating-pressure") in the star marked region below. Is this allowed?

thread_loop_f(t,domain)
{
if (THREAD_ID(t)==boundaryID)
{
begin_f_loop(f,t)
{
*****
}
end_f_loop(f,t)
}



#include "udf.h"
int boundaryID=78;
DEFINE_SOURCE(massflux1,c,t,dS,eqn)
{
real mdot;
mdot=C_UDMI(c,t,0)/C_VOLUME(c,t);
return (mdot);
}
DEFINE_ON_DEMAND(on_demand_calc)
{
face_t f;
cell_t c;
cell_t c0;
Domain *domain=Get_Domain(1);
Thread *t;
Thread *t0;
real sigma=0.03;
real R=8314.40;
real M=18.015;
real hfg=2406000;
real pi;
real ti;
real pstatic=C_P(c,t);
real poper=RP_Get_Real("operating-pressure");
real pv;
real tv;
real A[ND_ND];
real area;
thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0)=0;
}
end_c_loop(c,t)
}
thread_loop_f(t,domain)
{
if (THREAD_ID(t)==boundaryID)
{
begin_f_loop(f,t)
{
c0=F_C0(f,t);
t0=THREAD_T0(t);
F_AREA(A,f,t);
area=NV_MAG(A);
pi=exp(((hfg*M)/R)*((1/373.0)-(1/C_T(c0,t0))))*101325.0;
ti=sqrt(C_T(c0,t0));
pstatic=C_P(c,t);
pv=pstatic+poper;
tv=C_T(c,t);
C_UDMI(c0,t0,0)=(((2*sigma)/(1-sigma))*(1/sqrt(2*3.141592653589*(R/M)))*((pv/tv)-(pi/ti)))*area;
}
end_f_loop(f,t)
}
}
}

arunraj June 21, 2020 01:02

What do you mean by applying flux at face? Is it possible to apply flux without DEFINE_SOURCE. I thought DEFINE_SOURCE is the only way for this problem. I would like to know more about applying flux directly at the face. May be it is more relevant for my problem. I am not able to achieve the expected results using DEFINE_SOURCE. I will try both the methods simultaneously. Thank you for your kind help.

arunraj June 21, 2020 01:05

Quote:

Originally Posted by vinerm (Post 775317)
You cannot apply flux to the cells; you need to apply these as sources or apply at the faces instead of the cells. As far as the code is concerned, it is not applying anything; only calculating and storing in UDM. And no where is value of sigma being calculated. There is nothing called RP_Get_Float; use RP_Get_Real. There are many other syntactical mistakes in the code. It won't even compile.

What do you mean by applying flux at face? Is it possible to apply flux without DEFINE_SOURCE. I thought DEFINE_SOURCE is the only way for this problem. I would like to know more about applying flux directly at the face. May be it is more relevant for my problem. I am not able to achieve the expected results using DEFINE_SOURCE. I will try both the methods simultaneously. Thank you for your kind help.

vinerm June 21, 2020 16:12

Source and Flux
 
DEFINE_SOURCE is NOT used for defining flux, but for source. Flux and source are different, though inter-convertible using Gauss' theorem. If you want to apply flux, use DEFINE_PROFILE.


All times are GMT -4. The time now is 05:36.