|
[Sponsors] |
December 28, 2016, 11:02 |
Implementation of DEFINE_UDS_FLUX
|
#1 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Hi all,
I am trying without success to implement the DEFINE_UDS_FLUX macro for a UDS I am solving in my problem. I have a function defined as C_FUNCTION(c,t), which defines the density of my scalar in a cell base. Nevertheless, I have no idea how to define it with respect of the face (e.g. C_R/F_R). I've got this piece of code from Fluent manual, replaced with the C_FUNCTION, but I have no idea what to use for the face line (???). Can someone help me with this task? Thank you very much in advance. Code:
DEFINE_UDS_FLUX(my_uds_flux,f,t,i) { cell_t c0, c1 = -1; Thread *t0, *t1 = NULL; real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0; c0 = F_C0(f,t); t0 = F_C0_THREAD(f,t); F_AREA(A, f, t); /* If face lies at domain boundary, use face values; */ /* If face lies IN the domain, use average of adjacent cells. */ if (BOUNDARY_FACE_THREAD_P(t)) /*Most face values will be available*/ { real dens0, dens1; /* Depending on its BC, density may not be set on face thread*/ if (NNULLP(THREAD_STORAGE(t,SV_DENSITY))) dens0 =??? ; /*F_R(f,t) Set dens to face value if available */ else dens0 = C_FUNCTION(c0,t0); /* else, set dens to cell value */ NV_DS(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t), *, dens0); flux = NV_DOT(psi_vec, A); /* flux through Face */ } else { c1 = F_C1(f,t); /* Get cell on other side of face */ t1 = F_C1_THREAD(f,t); dens0 = C_FUNCTION(c0,t0); dens1 = C_FUNCTION(c1,t1); NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,dens0); NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1),*,dens1); flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */ } /* ANSYS FLUENT will multiply the returned value by phi_f (the scalar's value at the face) to get the "complete'' advective term. */ return flux; } |
|
January 3, 2017, 05:22 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
It looks like you will have to define a function (I propose with name F_FUNCTION(f,t)) that defines the density of your scalar on faces.
I have no idea what you did with C_FUNCTION, but you should probably try to make F_FUNCTION physically consistent. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Free CFD code with implementation of Menter's k-omega SST model | nikola_m | Main CFD Forum | 2 | May 8, 2020 13:13 |
Issues in FGM combustion model implementation | Lisandro Maders | OpenFOAM Programming & Development | 15 | April 22, 2020 20:18 |
a little confused with the implementation of compressibleInterFoam | su_junwei | OpenFOAM Running, Solving & CFD | 2 | May 7, 2014 18:33 |
Implementation issues of fvSchemes / laplacianScheme, in particular gaussLaplacianSch | thomek | OpenFOAM Programming & Development | 0 | October 18, 2010 06:10 |
Please explain the implementation of species transport Eqn in reactingFoam | kallipygian | OpenFOAM Running, Solving & CFD | 0 | October 13, 2008 08:29 |