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/)
-   -   UDF for specifying species mass fraction gradient at boundary (https://www.cfd-online.com/Forums/fluent-udf/122331-udf-specifying-species-mass-fraction-gradient-boundary.html)

Zaphod'sSecondHead August 17, 2013 05:18

UDF for specifying species mass fraction gradient at boundary
 
Dear Members,

Pardon me, I am a complete newbie in the UDF sector.

I am modeling two-component purely diffusive species transport. At the boundary, I wish to specify the condition: del.C = 0, that is, the gradient of concentration at exit is zero. I used Mass Fraction as a measure of concentration.

UDF Logic:

1. Create a UDS, say UDS1, and store in it the value of mass fraction.
2. Create another UDS, say UDS2, and store in it the gradient of UDS1.
3. At boundary, specify the value of UDS2 to be zero.

I created the following UDF:
__________________________________________________ __________
#include "udf.h"

DEFINE_PROFILE(conc_grad, t, i)
{
cell_t c;
Thread *f_thread;
Domain *domain;

domain = Get_Domain(1);

thread_loop_c (f_thread, domain)
{
begin_c_loop (c, t)
{
C_UDSI(c, t, 0) = C_YI(c, t, i); /*First UDS*/
C_UDSI(c, t, 1) = NV_MAG(C_UDSI_G(f, t, 0)); /*Second UDS*/
}
end_c_loop (c, t)
}

}
__________________________________________________ _____________
After successfully interpreting the file, I set the exit boundary as "Outflow", and in the "Boundary Conditions -> Edit -> UDS" tab, specify the value as "udf conf_grad" in the drop-down menu.

After clicking OK, I get the ACCESS VIOLATION error.

I really do not know what the problem is. Could someone help me out please?

Thanks in advance. :)

mahdi-united March 14, 2020 06:12

Quote:

Originally Posted by Zaphod'sSecondHead (Post 446265)
Dear Members,

Pardon me, I am a complete newbie in the UDF sector.

I am modeling two-component purely diffusive species transport. At the boundary, I wish to specify the condition: del.C = 0, that is, the gradient of concentration at exit is zero. I used Mass Fraction as a measure of concentration.

UDF Logic:

1. Create a UDS, say UDS1, and store in it the value of mass fraction.
2. Create another UDS, say UDS2, and store in it the gradient of UDS1.
3. At boundary, specify the value of UDS2 to be zero.

I created the following UDF:
__________________________________________________ __________
#include "udf.h"

DEFINE_PROFILE(conc_grad, t, i)
{
cell_t c;
Thread *f_thread;
Domain *domain;

domain = Get_Domain(1);

thread_loop_c (f_thread, domain)
{
begin_c_loop (c, t)
{
C_UDSI(c, t, 0) = C_YI(c, t, i); /*First UDS*/
C_UDSI(c, t, 1) = NV_MAG(C_UDSI_G(f, t, 0)); /*Second UDS*/
}
end_c_loop (c, t)
}

}
__________________________________________________ _____________
After successfully interpreting the file, I set the exit boundary as "Outflow", and in the "Boundary Conditions -> Edit -> UDS" tab, specify the value as "udf conf_grad" in the drop-down menu.

After clicking OK, I get the ACCESS VIOLATION error.

I really do not know what the problem is. Could someone help me out please?

Thanks in advance. :)

hi

how to store the species mass fraction gradients in fluent?
what is the its command?


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