CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Problem with implicit equations in UDF (

NPat March 1, 2013 16:31

Problem with implicit equations in UDF
Hi friends,

I am a new user of FLUENT and UDF programming...

I need a UDF that calculates a system of implicit equations, like:


I am sketching a code that, I think, could do this work. What I have is:

DEFINE_ADJUST(my_adjust, domain)
Thread *thread;
cell_t cell;

thread_loop_c(thread, domain)
begin_c_loop_all(cell, thread)
C_UDMI(cell,thread,0) = 1. + C_UDMI(cell,thread,3);
C_UDMI(cell,thread,1) = 2. + C_UDMI(cell,thread,3);
C_UDMI(cell,thread,2) = 3. + C_UDMI(cell,thread,3);
C_UDMI(cell,thread,3) = C_UDMI(cell,thread,0) + C_UDMI(cell,thread,1) + C_UDMI(cell,thread,2);
end_c_loop_all(cell, thread)

I am able to compile it in FLUENT and initialize it, but when I run the iterations the program simply crashes... so, I think I am doing something pretty wrong. Could anyone please help me on this?

Observation: This code is meant to be used in mass transfer in multiphase simulations.

Best Regards,

msaeedsadeghi March 2, 2013 05:06

delete "_all"
just use "begin_c_loop"

NPat March 2, 2013 09:17

Thank you, Sir.

I was able to get this code working, but it seems to be sensitive of the constants, since large values lead to what seems to be an infinity loop and FLUENT crashes. However, small values for the constants allow for good results.

Anyway, if someone else has another suggestion, it would be very approciated!


NPat March 2, 2013 09:26

Just one more detail... The use of "begin_c_loop_all" or just "begin_c_loop" seems to don't have effect on the results.


msaeedsadeghi March 3, 2013 06:16

It should be checked precisely.

All times are GMT -4. The time now is 23:37.