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

diffusive mass flux in a closed domain

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 5, 2024, 17:30
Unhappy diffusive mass flux in a closed domain
  #1
New Member
 
Mohammad
Join Date: May 2024
Posts: 7
Rep Power: 2
DrMaMad is on a distinguished road
Hi
(if my ENGLISH isn't good, I apologize in advance)

I am newbie in UDF writing,
I solved a 2D trapizoidal solar still in FLUENT solver. All boundaries of DOMAIN are wall. So the domain doesn't have any inlet or outlet BC. indeed the domain contains some air and water, BUT on bottom (water surface) and top boundry (glass cover) evaporation and condensation occurs, respectively (mass flow rate of evaporation and condensation are equal).
I need to get this mass flow rate, for which i wrote this UDF:

//////////////////////////////////////////////////////////////////////////
/* it is an unsteady problem*/
#include "udf.h"
DEFINE_EXECUTE_AT_END(Each_Timestep_Massrate)
/* after each time step compute and save the data in the file*/
{
FILE *data;//file for saving data//
Domain *d;
Thread *tw;//face thread for water surface//
Thread *tg;//face thread for glass cover surface//
face_t fw;
face_t fg;
real ftime = RP_Get_Real("flow-time");
real time_step, rateg, ratew;
time_step = ftime / 10;//10 second is time step size//

d = Get_Domain(1);
rateg = 0.;
ratew = 0.;
tg = Lookup_Thread(d,5);//top wall= glass cover//
tw = Lookup_Thread(d,8);//bottom wall= water surface//
begin_f_loop(fg,tg)
{
rateg += F_FLUX(fg,tg);
}
end_f_loop(fg,tg)
begin_f_loop(fw,tw)
{
ratew += F_FLUX(fw,tw);
}
end_f_loop(fw,tw)
data=fopen("D:\\desktop\\simulation\\Ansys\\Gaurav \\GauravFluent_files\\dp0\\FFF-10\\Fluent\\MASSRATE.txt","a");
fprintf(data,"time-step evaporation-rate condensation-rate\n");
fprintf(data,"%f\t%e\t%e\n",time_step,ratew,rateg) ;
fclose(data);

/////////////////////////////////////////////////////////////////////////////

but the UDF returns zero for all time steps. I studied the user's guide and if i realized correctly, F_FLUX() would return zero in a closed domain without any inlet and outlet.

on the next step, i read the user's guide to find a way for computing the water spicies flux on water surface (evaporation). it means that a way which computes (water spicies gradient at water surface dot product area normal vector of the boundary; multiplied by density and effective mass diffusivity on faces centroid from face thread of the boundary).

After a while, On page 261 in connectivity macros i found the BOUNDARY_SECONDARY_GRADIENT_SOURCE(source,n,dphi,d x, A_by_es,k) from "sg.h" header. this macros needs BOUNDARY_FACE_GEOMETRY().

I think some UDF like this can solve my problem:

//////////////////////////////////////////////////////////
massrate=0.;
begin_f_loop(fw,tw)
{
BOUNDARY_FACE_GEOMETRY(fw,tw,A,ds,es,A_by_es,dr0);
BOUNDARY_SECONDARY_GRADIENT_SOURCE(source,n,dphi,d x,
A_by_es,k);
massrate+=F_R(fw,tw)*k*NV_DOT(dphi,A);
}
end_f_loop(fw,tw)
//////////////////////////////////////////////////////////////

My questions are: 1- Is it correct way to compute the massrate?
2- How dphi could be equal to water species gradient?
3- How k could be equal to effective mass diffiusivity?


Cloud anyone help me on these two macros:
1- BOUNDARY_FACE_GEOMETRY(fw,tw,A,ds,es,A_by_es,dr0)
2- BOUNDARY_SECONDARY_GRADIENT_SOURCE(source,n,dphi,d x,
A_by_es,k)
Any simple tutorial or simple example in this issue (user guide example was too complicate)


I'd appreciate it if you could help me.
DrMaMad is offline   Reply With Quote

Reply

Tags
boundary, flux function, gradient, massrate, spicies


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
Table bounds warnings at: END OF TIME STEP CFXer CFX 4 July 17, 2020 00:44
Wrong mass flux for solid into fluid domain in icoFsiElasticNonLinUlSolidFoam solver EmadTandis OpenFOAM Verification & Validation 1 September 23, 2019 11:43
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 08:30
Waterwheel shaped turbine inside a pipe simulation problem mshahed91 CFX 3 January 10, 2015 12:19
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00


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