Simply the best answers.Get 100$ bonus
How to stop iteration process from UDF
Sometimes, users want to stop iteration process according to some criteria that are calculated in a UDF. But FLUENT can only stop the iteration process after a fixed number of iterations or when residual is reached.
Solution is to perform in a scheme loop 1 iteration, until some rp-variable is changed.
The scheme-side could look like this:
; make it possible that a UDF stops the iterations
(if (not (rp-var-object 'stop))(rp-var-define 'stop #f 'bool #f))
(define (my-iter max-iter)
(do ((i 0 (+ i 1))
((or (> i max-iter) (%rpgetvar 'stop))
The UDF side looks like this:
dbc *= 0.5;
bc += dbc;
F_PROFILE(f,ft,eqn) = bc;
You would hook the UDF to some boundary condition, and start the iteration from the TUI with (my-iter 2000)
This solution should also apply to 6.2.16. In this version there is still no other way to stop iterating from a UDF (as far as I know).