|
[Sponsors] |
June 29, 2022, 04:43 |
Density gradient UDF
|
#1 |
Member
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 9 |
I have written this code to get the Density gradient in a pressure-based solver by switching ON UDS for density. But it gives SIGSEGV error.
This is based on the UDF Example available in Fluent Manual for getting Temperature gradient. I changed it to Density. Since face values are not available for density, I interpolated and calculated it. Code:
# include "udf.h" DEFINE_ADJUST(adjust_gradient, domain) { Thread* t; cell_t c; face_t f; /* Fill UDS with the variable. */ thread_loop_c(t, domain) { begin_c_loop(c, t) { C_UDSI(c, t, 0) = C_R(c, t); } end_c_loop(c, t) } thread_loop_f(t, domain) { if (THREAD_STORAGE(t, SV_UDS_I(0)) != NULL) begin_f_loop(f, t) { F_UDSI(f, t, 0) = (C_R(F_C0(f, t), THREAD_T0(t)) + C_R(F_C1(f, t), THREAD_T1(t))) / 2; } end_f_loop(f, t) } } DEFINE_SOURCE(gradient_source, c, t, dS, eqn) { real source; source = C_UDSI_G(c, t, 0)[1]; dS[eqn] = 0; return source; }
__________________
Always Thedal |
|
Tags |
density, fluent, gradient, udf, uds |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
temperature gradient problem in udf | Souviktor | Fluent UDF and Scheme Programming | 6 | March 10, 2019 06:48 |
How to calculate number density in breakup rate UDF? | masoud.ravan | Fluent UDF and Scheme Programming | 0 | April 4, 2018 04:56 |
UDF for Density | Priyank Mehta | Fluent UDF and Scheme Programming | 19 | December 6, 2017 08:07 |
UDF to Access Wall Normal Concentration Gradient | Daniel Tanner | Fluent UDF and Scheme Programming | 4 | February 18, 2015 15:35 |
REAL GAS UDF | brian | FLUENT | 6 | September 11, 2006 09:23 |