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/)
-   -   Controlling species wall flux using a UDF that checks adjacent cell species conc. (https://www.cfd-online.com/Forums/fluent-udf/244465-controlling-species-wall-flux-using-udf-checks-adjacent-cell-species-conc.html)

ZachFrankman August 9, 2022 17:55

Controlling species wall flux using a UDF that checks adjacent cell species conc.
 
2 Attachment(s)
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.

Attachment 91093


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.

Attachment 91094

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.

AlexanderZ August 10, 2022 03:36

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)


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