CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   calculating the face gradient of a UDS in fluent (http://www.cfd-online.com/Forums/fluent/107505-calculating-face-gradient-uds-fluent.html)

mean5990 September 28, 2012 18:40

calculating the face gradient of a UDS in fluent
 
Hi every one,
I am trying to solve water transport equation in a fuel cell using ANSYS Fluent.
I need to define a flux for the equation that I am gonna solve. The problem is that I cannot calculate face gradients in my code. I used F_UDSI_G(c,t,0) macro for this purpose but I recieved this error:
"
..\..\src\sources2.c(348) : error C2109: subscript requires array or pointer type
..\..\src\sources2.c(348) : error C2109: subscript requires array or pointer type
..\..\src\sources2.c(348) : error C2109: subscript requires array or pointer type
"
Does anybody know how to calculate face gradients of a UDS in fluent?

pifou74 September 29, 2012 11:24

I think that gradient data are not stored for the faces excepted boundary faces. You can only calculate the gradient by estimating a mean of the adjacent cells to the face....

Good luck

Maryam-A September 20, 2015 13:59

Hi every body

I wanted to return derivative of UDS as wall boundary value, but I faced with "fatal signal" while initializing (both Hybrid and standard) that I found this because of boundary condition UDS.:(
this is part of my udf for B.C of UDS( volume fraction of nanoparticle in my case)

DEFINE_PROFILE(alpha_bc1,thread,position)
{
Thread *t;
cell_t c;
.
.
.

begin_f_loop(f,thread)
{

C_UDSI_G(c,t,0)[0]=-(D_T/D_B)*C_T_G(c,t)[0];
F_PROFILE(f,thread,position)=C_UDSI_G(c,t,0)[0];
}
end_f_loop(f,t)
}

I would appreciate if anyone can help me about my mistakes.

Maryam-A September 20, 2015 14:00

Furthermore, I used Define_Adjust to calculate laplacian, maybe this is my fault?
can I use UDS as scalar variable and then I used it in source function?
I will turn off all Uds except one that I wanted to solve. is it true?

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDSI(c,t,1)=D_T*C_T_G(c,t)[0];
C_UDSI(c,t,2)=D_T*C_T_G(c,t)[1];
C_UDSI(c,t,3)=D_T*C_T_G(c,t)[2];
Laplacian=Laplacian+C_UDSI_G(c,t,1)[0]+C_UDSI_G(c,t,2)[1]+C_UDSI_G(c,t,3)[2];

C_UDSI(c,t,5)=dD_T*C_T_G(c,t)[0];
C_UDSI(c,t,6)=dD_T*C_T_G(c,t)[1];
C_UDSI(c,t,7)=dD_T*C_T_G(c,t)[2];
d_Laplacian=d_Laplacian+C_UDSI_G(c,t,4)[0]+C_UDSI_G(c,t,5)[1]+C_UDSI_G(c,t,6)[2];

C_UDSI(c,t,9)=D_D*C_T_G(c,t)[0];
C_UDSI(c,t,10)=D_D*C_T_G(c,t)[1];
C_UDSI(c,t,11)=D_D*C_T_G(c,t)[2];
LL=LL+C_UDSI_G(c,t,9)[0]+C_UDSI_G(c,t,10)[1]+C_UDSI_G(c,t,11)[2];

C_UDSI(c,t,13)=dD_D*C_T_G(c,t)[0];
C_UDSI(c,t,14)=dD_D*C_T_G(c,t)[1];
C_UDSI(c,t,15)=dD_D*C_T_G(c,t)[2];
dLL=dLL+C_UDSI_G(c,t,13)[0]+C_UDSI_G(c,t,14)[1]+C_UDSI_G(c,t,15)[2];

}
end_c_loop(c,t)
}
C_UDSI(c,t,4)=Laplacian;
C_UDSI(c,t,8)=d_Laplacian;
C_UDSI(c,t,12)=LL;
C_UDSI(c,t,16)=dLL;
}


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