how to calculate a derivative through UDF
Hi, all.
In my task I need to calculate a derivative from (du/dx+dv/y) by x and y. How can i do this in my UDF ? I tried to do so ( (C_DUDX(c,t)+C_DVDY(c,t)) - (C_DUDX(c-1,t)+C_DVDY(c-1,t)) )/hx but it is wrong, and I have no other ideas. Can anyone help me with this problem? |
Hello, christophelorant !
Thank you very much for your answer and code, now my udf works correct (imho). I fixed some bugs in your code: 1. Variable f must be defined as face_t 2. String grad = grad/C_VOLUME(c,t) leading to compilation error, so i updated this as following grad[0] = grad[0]/C_VOLUME(c,t) grad[1] = grad[1]/C_VOLUME(c,t) and i hope this is correct. Because in this code a "c_face_loop" is used, udf source file must be compiled (not interpreted) in Fluent. Regards, Rigid |
All times are GMT -4. The time now is 00:46. |