Interrupting the fluent simulation when field variable exceeds any user-defined limit
Sometimes a particular flow variable (Pressure, velocity, temperature etc) diverges and leaves behind unreasonable results which are of little use. In many such cases, it helps to automatically stop/interrupt the simulations when these flow variables exceed some reasonable limits. The resolution is a combination of small UDF and scheme file. The UDF will loop over the cells and will switch the flag on when any user-defined limit is exceeded. Following is a case where we don't expect the temperature to exceed 1000K. UDF: #include "udf.h" #include "var.h" DEFINE_ADJUST(interrupt_fcn, d) { Thread *t; cell_t c; int x = 0; thread_loop_c(t,d) { begin_c_loop(c,t) { if(C_T(c,t)>1000.0) { x=1; break; } } end_c_loop(c,t) break; } x=PRF_GIHIGH1(x); if(x==1) RP_Set_Integer("interrupt/flag",1); } and the SCHEME : (rp-var-define 'interrupt/flag 0 'integer 1) (define (interrupt) (if (> (%rp-var-value 'interrupt/flag) 0) (cx-interrupt)) ) The procedure is: 1)The user has to read in the case/data files, the scheme and the UDF. 2) "interrupt_fcn" hooked for the Adjust Function and 3) "(interrupt)" entered in the Solve-Execute Commands panel. After the above steps, once the fluent simulations is started, the scheme file will interrupt the simulation if the temperature exceeds 1000K. The results can then give useful pointers/reasons for the imminent divergence. Note that the above procedure works for both serial and parallel simulation. |
||
![]()
|