FLUENT 6 - Report - Discrete Phase - Histogram: Would like to write histogram to a file, or at least print data

Most histograms can be printed as text (numbers) to the FLUENT console. This is not the case for histograms generated via Report - Discrete Phase - Histogram, which is a distinct limitation in the usability of this feature.

File RepDPMHstPrt.scm:
;; (c) Fluent Deutschland GmbH, 2001, Jochen Schuetze
;; Load this into FLUENT 5 or FLUENT 6 using the command...
;; (load "RepDPMHstPrt.scm")
;; After that, any Histogram generated using
;; Report---Discrete-Phase---Histogram is listed
;; in the console window instead of plotted.
;; By enabling the generation of a transcript file,
;; you can easily capture the output in a file.
;; You may certainly try to vary the appearance of
;; the output by varying the scheme source below...
(define *cx-histogram-location* "events")
(define (plot-sample-histograms vmin vmax nbin sample field dopercent)
(let* ((delta (/ (- vmax vmin) nbin))
(names (list sample field))
(lbin (%sample-bins vmin vmax nbin names))
(total (apply + lbin))
(percent (lambda (num)
(if dopercent
(* 100.0 (/ num total))

;; Addition by JOS (3 lines):
(format "~%~a ~a below ~a (~a %)" (car lbin) *cx-histogram-location*
(percent (car lbin)))

(let loop ((n 0)
;;jos (x '())
;;jos (y '())
(l (cdr lbin)))
(if (= n nbin)

;; Addition by JOS (4 lines):
(format "~%~a ~a above ~a (~a %)~%" (car l)
(percent (car l)))


;; Addition by JOS (3 lines):
(format "~% ~a ~a between ~a and ~a (~a %)" (car l)
(+ vmin (* n delta))

;;jos (cx-with-open-varenv
;;jos "/histogram"
;;jos (cxsetvar 'xy/scale/label/x field)
;;jos (cxsetvar 'xy/units/x '("" 1))
;;jos (if dopercent
;;jos (cxsetvar 'xy/scale/label/y '%)
;;jos (cxsetvar 'xy/scale/label/y 'N))
;;jos (cxsetvar 'xy/units/y '("" 1))
;;jos (start-title-plot (string-append "Histogram of " (symbol->string field)))
;;jos (err-protect
;;jos (cx-xy-plot-data x y))
;;jos (cx-end-frame)))
;;jos (let ((xp (list
(+ vmin (* (+ n 1) delta))
;;jos (+ vmin (* (+ n 1) delta))
;;jos (+ vmin (* n delta))
;;jos (+ vmin (* n delta))))
;;jos (yp (list 0 (percent (car l)) (percent (car l)) 0)))

;; Addition by JOS (1 line):
(percent (car l)))

(loop (+ n 1)
;;jos (append xp x)
;;jos (append yp y)
(cdr l)))))))

Show Form
No comments yet. Be the first to add a comment!