CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Need help on mass source at wall boundary! (https://www.cfd-online.com/Forums/fluent/46339-need-help-mass-source-wall-boundary.html)

James October 16, 2007 02:40

Need help on mass source at wall boundary!
 
Hi all,

I need help on the above and had written a UDF to describe mass source and sink at wall boundary between 2 adjacent flow channels. In short, I would like to simulate one specie from the feed flow channel to pass through a wall(membrane), which i simulate by having the cells adjacent to the wall to have a mass sink. While on the permeate side I would like to simulate that this same specie permeats through the wall at the adjacent cells to the wall to act like a mass source.

I had written a UDF using Define_source and attached it below. Can someone help me comment on it as it doesnt seem to work when I add it into the simulation? Thanks alot.

# include "udf.h"

DEFINE_SOURCE(membrane_flux,c,t,ds,eqn) { face_t f; Thread *tf, *tfs, *t0, *t1; cell_t c0, c1; real osmotic_P1, osmotic_P2, mem_flux, source=0; int n;

c_face_loop(c,t,n) { f=C_FACE(c,t,n); tf=C_FACE_THREAD(c,t,n); if(BOUNDARY_FACE_THREAD_P(tf)) /* must be thread face */ {

if(!NULLP(tfs=THREAD_SHADOW(tf))) /* thread face too */

{

c0=F_C0(f,tf);

c1=F_C1(f,tf);

t0=THREAD_T0(tf);

t1=THREAD_T1(tf);

Source = /* This is for calculations to return the source/sink term */

}

else

{

} } else { } } return source; }


All times are GMT -4. The time now is 18:55.