Is it possible to modify the loss coefficient in the outlet-vent boundary condition via UDF?

No, it is not possible via UDF.

BUT, a scheme routine enables to automatically modify the coefficient depending on the average pressure on postprocessing zone.

Please find the a description and the file (content) below:

What to do?

Please perform following to use the routine:
1) Read the case & data in a FLUENT session (FLUENT 12.1.4)
2) Read change_bc.scm
3) Ensure that the discharge coefficient for outlet vent is set to 7
4) Also check that the (rb-setzen) function is specified in Calculation activities --> Execute commands panel
5) Run the calculation for 5 time steps.
6) Check the discharge coefficient for outlet vent. It would have a value of 70

The scheme file does following:
When the pressure on outlet vent falls below 280 Pa, the discharge coefficient for outlet vent is changed to 70.
With the test case, the pressure at the outlet vent was falling with time, so I changed the criterion for changing the BC.

User Inputs required:
Have a look at the scheme file in the editor. There are comment marked, which start with words USER INPUT.
Client will have to make changes at line no. 10, 12 & 14.
Content of routine "change_bc.scm":


; alter boundary condition if pressure on outlet vent exceeds pressure limit
(define pressurelimit 280) ; pressure limit [Pa]

(define actual-pressure)

(define rb-setzen
(lambda ()

;; USER INPUT required in the line below change (2) with appropriate surface ID, which can be obtained from Suraface --> Manage panel
(set! actual-pressure (string->number (pick "/report/surface-integrals/mass-weighted-avg (2) pressure no")))
;; USER INPUT In the following line, please change the less than sign "<" to greater than ">" for your problem
(if (< actual-pressure pressurelimit)
(ti-menu-load-string "
/define/boundary-conditions/outlet-vent 4 n 0 n y y n 1 n 1 n n , 70")) ;; USER INPUT You can modify this command as you want


(define pick) ; picks item(s) from the output of a ti-command
(define display-pick-list) ; displays the items of the output of a ti-command


(define tokenize
;; splits a string into tokens, which are defined
;; as being separated by delimiters.
(lambda (str)
(let ((l (string->list str))
(result '())
(delimiters (list #space #newline #) #())
(started? #f)
(temp '()))
(lambda (c)
(if started?
(if (not (memv c delimiters))
(set! temp (append temp (list c)))
(set! result (append result (list (list->string temp))))
(set! temp '())
(set! started? #f)))
(if (not (memv c delimiters))
(set! temp (append temp (list c)))
(set! started? #t)))))
(if started?
(set! result (append result (list (list->string temp)))))

(let ((pick-list ()))

(set! pick
(lambda (ti-command . pos)
;; picks a token out of the output from ti-command, where
;; ti-command has to be a string. If the optional
;; argument(s) pos is(are) missing, the last token is
;; returned, otherwise the one(s) at position(s) pos.
(let ((value))
(set! pick-list
(tokenize (with-output-to-string
(lambda () (ti-menu-load-string ti-command))))))
(set! value
(if (pair? pos)
(map (lambda (i) (list-ref pick-list (- i 1))) pos)
(car pick-list)))
(if (pair? value)
(if (equal? (length value) 1)
(car value); return the single element, not a list
value) ; more that one element, return a list
value) ; not a pair, return it as is

(set! display-pick-list
(lambda arg
;; Without arg, displays the last pick-list in a numbered
;; fashion. An optional argument may be the ti-command from
;; which to generate the pick-list.
(display "n")
(if (pair? arg)
(display "command output:n")
(set! pick-list
(tokenize (with-output-to-string
(lambda () (ti-menu-load-string (car arg)))))))
(display "n")
(display "items to pick:n")
(let ((i (length pick-list)))
(lambda (t) (format "~5a ... ~an" i t) (set! i (- i 1)))
(reverse pick-list)))
(display "n")))

;; (pick "/report/projected-surface-area (1) 2e-6 0 0 1")
;; (display-pick-list)


Show Form
can you load your cas&dat data or send it to me per mail then can I modify this sheme for my modell?
Philipp, Fri May 16, 2014