CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Mass Flow Outlet (http://www.cfd-online.com/Forums/fluent/27697-mass-flow-outlet.html)

Glenn Price May 29, 2000 13:23

Mass Flow Outlet
 
I am simulating a transient, compressible blowdown scenario with no inlet flows and a single outlet, where the mass flow rate is fixed via a PCV and a choked orifice plate.

Has anyone incorporated a mass flow OUTLET boundary condition into Fluent 5? One approach would be to adjust the set pressure in a pressure outlet b.c. via a UDF to meet the specified mass flow rate. Any other suggestions?

Graham Goldin May 29, 2000 14:46

Re: Mass Flow Outlet
 
Hi! Glenn,

This scheme file ought to work (it was written for UNS, so it might not work for Fluent 5, but it's worth a try). Let me know if you're not successful.

Graham

Put the text below this line in a file mfo.scm ...

;;; mfo.scm ;;; Mass-flow outlet boundary condition prototype.

;;; Copyright 1996 Fluent Inc. ;;; All Rights Reserved.

;;; Usage: ;;; ;;; - Set up your case and data as usual, using a pressure outlet ;;; for the outflow boundary type. Set the outflow pressure ;;; to a reasonable value and, for best results, partially converge ;;; the solution before proceding to the next step. ;;; ;;; - Load this file by typing (load 'mfo) in the console window. ;;; You will be prompted for a few configuration parameters. ;;; You can examine or change these parameters at any time with ;;; the /define/bc/mass-flow-outlet command. If you want, you ;;; can change the default configuration values below by editing ;;; this file. ;;; ;;; - Then just iterate as usual. The outlet pressure will be ;;; updated once every n iterations to achieve the target mass flow. ;;;

(define mfo/target-mf 10.0) ; target mass flow (define mfo/interval 5) ; update pressure every n'th iteration (define mfo/relax 1) ; relax pressure update (define mfo/min-pressure .1e5) ; limit pressure (define mfo/max-pressure 2.e5) (define mfo/verbose? #t) ; display status?

;;; end of user-configurable variables

(define mfo/name) (define mfo/area)

(define (mfo/ti-configure) (let ((po (get-threads-of-type 'pressure-outlet)))

(if (null? po)

(error "mass-flow-outlet: there are no pressure outlets defined"))

(set! mfo/name

(thread-name (car po)))

(format "Using ~a.\n" mfo/name))

(set! mfo/target-mf ;; (read-real "Target mass-flow (kg/s)" mfo/target-mf)

(read-with-units "Target mass-flow" mfo/target-mf 'mass-flow " ")) (set! mfo/interval

(read-real "Iteration update interval" mfo/interval)) (set! mfo/verbose?

(y-or-n? "Display update diagnostics?" mfo/verbose?)) (set! mfo/relax

(read-real "Pressure change relaxation factor" mfo/relax)) (set! mfo/min-pressure ;; (read-real "Minimum allowable gauge pressure (pascal)" mfo/min-pressure)

(read-with-units "Minimum allowable gauge pressure" mfo/min-pressure 'pressure " ")) (set! mfo/max-pressure ;; (read-real "Maximum allowable gauge pressure (pascal)" mfo/max-pressure)

(read-with-units "Maximum allowable gauge pressure" mfo/max-pressure 'pressure " "))

;; cache the surface area (set! mfo/area

(surface-area (cx-get-surface-ids (list mfo/name)))) )

;; add a /define/bc/mass-flow-outlet command

(ti-menu-insert-item! bc-menu (make-menu-item "mass-flow-outlet" #t

mfo/ti-configure

"Configure the mass flow outlet"))

;; build a new profile boundary condition with a constant value (define (constant-profile constant) (list (cons 'constant constant) '("" "")))

;; update the bc (define (mfo/update) (let* ((mfo (get-thread mfo/name))

(mf (- (cdr (assq 'mass-flow (thread-integrals (thread-id mfo))))))

(p (cdr (assq 'constant (send mfo get-var 'p))))

(rho)

(dp)

(new-p))

;; compute the average density on the thread

(client-set-node-values #f)

(client-fill-node-values 'density)

(set! rho (surface-average (cx-get-surface-ids (list mfo/name))))

;; adjust pressure using Bernoulli's

(set! dp (* mfo/relax

(/ mfo/target-mf rho mfo/area mfo/area)

(- mf mfo/target-mf)))

;; diagnostic message

(if mfo/verbose?

(format "mass-flow: actual = ~a, target = ~a, pressure change = ~a\n"

mf mfo/target-mf dp))

(set! new-p (min mfo/max-pressure

(max mfo/min-pressure

(+ p dp))))

;; update the boundary condition

(send mfo set-var! 'p (constant-profile new-p))

;; download to the solver

(send mfo update-solver-vars!)

))

;; automatically update the bc each iteration

(define (mass-flow-outlet-monitor niter . args) (if niter

(if (zero? (remainder niter mfo/interval))

(mfo/update))) '())

(cancel-solution-monitor 'mass-flow-outlet-monitor) (register-solution-monitor 'mass-flow-outlet-monitor mass-flow-outlet-monitor)

;; check the configuration (mfo/ti-configure)

;;; end-of-file

Glenn Price May 29, 2000 16:06

Re: Mass Flow Outlet
 
Thanks alot Graham!

Chris May 30, 2000 12:23

Re: Mass Flow Outlet (Jonas, please read...)
 
Is there some way to disable the formatting of posts so that code can be posted legibly?

I have tried various html tags (pre, code, plaintext) but the indentation and line breaks are still being changed.

Thanks, Chris

Jonas Larsson May 30, 2000 14:02

Re: Mass Flow Outlet (Jonas, please read...)
 
No, there is no way to do that currently, sorry. All posts are parsed in order to optimize the apperance of plain-text on different browsers. The parsing removes all line-breaks so that the browser wraps lines automatically based on window-width. Double line-breaks are translated into paragraph-breaks. This works okay on plain-text, which is the vast majority of all posts, but when people try to post tables, source-code, indendation etc. things will break. I know that it is annoying. I will try to find a solution.


All times are GMT -4. The time now is 15:55.