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. 

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"

     real m[ND_ND];                         /* this will hold the position vector */
      real x;                    /* this will hold x position */
      face_t f;                /* this will hold the face data */
    Thread *t0;                /* this will hold the thread data for the adjacent cell */
    cell_t c0;                /* this will hold the cell 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(m,f,t);            /* this will hold the centroid of the cell adjacent to the face on this profile*/
          x = m[0];                /* this will hold the hold x position*/
          F_PROFILE(f,t,i) = C_YI(c0,t0,1)*.999;    /* this will update the profile with the concentration at the centroid of the adjacent cell multiplied by a value */

Because the factor I am using is 0.999, there should be only a 0.1% 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.

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.