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

Controlling species wall flux using a UDF that checks adjacent cell species conc.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 9, 2022, 18:55
Default Controlling species wall flux using a UDF that checks adjacent cell species conc.
  #1
New Member
 
Zach
Join Date: Aug 2022
Posts: 5
Rep Power: 4
ZachFrankman is on a distinguished road
I would like to write a UDF to alter the species concentration of a boundary in a way that is dependent on the species concentration in an adjacent cell. I have attached an image to describe the equation.

1as.png


I have written the following UDF to use on the Species Mass Fraction boundary condition of a wall surface:

/************************************************** *********************
UDF for specifying a concentration-dependent wall surface species mole fraction for outward diffusion of dissolved oxygen within the channel
************************************************** **********************/

#include "udf.h"

DEFINE_PROFILE(oxygen_profile,t,i)
{
real x[ND_ND]; /* this will hold the position vector */
real y; /* this will hold x position */
cell_t c; /* this will hold the cell data for the cell */
cell_t c0; /* this will hold the cell data for the adjacent cell */
face_t f; /* this will hold the face data */
Thread *t0; /* this will hold the thread data for the adjacent cell */

begin_f_loop(f,t) /* this will loop over every face along the profile */
{
c0 = F_C0(f,t); /* this will hold the cell data for the adjacent cell */
t0 = THREAD_T0(t); /* this will hold the thread data for the adjacent cell */
F_CENTROID(x,f,t); /* this will hold the centroid of the cell adjacent to the face on this profile*/
y = x[0]; /* this will hold the hold x position*/
F_PROFILE(f,t,i) =C_YI(c0, t0, 1)*.9999999999999999999999999999999999999999; /* this will update the profile with the concentration at the centroid of the adjacent cell multiplied by a value */
}
end_f_loop(f,t)
}

Because the factor I am using is .9999999999999999999999999999999999999999, there should be only a 0.0000000000001% decrease in concentration between the face and the cell. However, I am observing rapid diffusion out of the channel using this boundary condition, as shown in the attached image.

b.png

What am I doing wrong?



This is extraneous information that may be useful in contemplating this question:

I am using ANSYS Fluent to model a 2D microfluidic channel. The channel is 50um tall and 1.5cm long. This model is of cells on the bottom surface consuming oxygen at a concentration-dependent rate.

To perform this model, I am using the Energy Model, the Laminar Flow model, and the Species Transport model for multicomponent diffusion.

The components modeled are liquid water with oxygen dissolved, therefore water is the bulk medium and last added to the species list.

The inlet pressure is 3.6Pa, giving the microfluidic channel a ~7.5e-5m/s maximum flow rate.

The temperature of the fluid in the channel is 37C/310.15K, giving the oxygen a diffusion coefficient of 3e-9m2/s. Because of this high diffusion coefficient, the flow should be diffusion-dominant.
ZachFrankman is offline   Reply With Quote

Old   August 10, 2022, 04:36
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
first of all:
how 0.0000000000001% (13 numbers) comes from this ->
.9999999999999999999999999999999999999999 (40 numbers) ?

are you using double precision for fluent?
should you run transient (with appropriate time step) or in steady?

is your mesh small enough?

which value is you actually applying as a boundary condition? (you need udm to check that)
__________________
best regards


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

Reply

Tags
species flux, 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
Table bounds warnings at: END OF TIME STEP CFXer CFX 4 July 17, 2020 00:44
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 03:30
How to Reference an Adjacent Cell in a UDF ? jeff8541 FLUENT 0 March 8, 2011 11:33
Basic question: UDF for wall heat flux Carl FLUENT 1 August 5, 2006 20:01
Multicomponent fluid Andrea CFX 2 October 11, 2004 06:12


All times are GMT -4. The time now is 22:17.