FLUENT-6.3-->Improving the graphics issues


During post-processing in FLUENT, we observe that the graphics resolution is not too good, leaving strange graphics around a corner of an object. Sometimes we have also seen problems in hidden line removal option. Even after using Hidden line removal the grid/feature lines are also seen.

These problems occur because of the fixed camera position in FLUENT. One can change the camera position through Display-->View-->Camera. However, changing the camera position in this way is not straight-forward and a matter of trial and error. A scheme function helps to achieve this by simply changing a slider bar.

Please read the following scheme function in FLUENT through File-->Read-->Scheme. A new panel is created in Display-->Improve Graphics Resolution.
Display any graphics in a graphics window and change the slider bar position in the above panel. Hit `Update Graphics` to improve the resolution. If you change the graphics orientation of the object then use `Reset Graphics` before using `Update Graphics`.
;; Scheme function starts
(define (make-new-rpvar name default type)
(if (not (rp-var-object name))
(rp-var-define name default type #f)))

(make-new-rpvar 'scl-pos 0 'real)
(make-new-rpvar 'orig-cam (cx-show-camera) 'list)
(make-new-rpvar 'orig-pos (list-ref (rpgetvar 'orig-cam) 0) 'list)

(display "n***************************************************************n")
(display " A new panel is added under Display menu. n")
(display " Go to Display-->Improve Graphics Resolution n")
(display "***************************************************************n")

(define
gui-cam-pos-adjust
(let ((panel #f)
(table)
(table1)
(hlp-text)
(scl-loc)
(rst-nw)
(up-nw)
)
(define (update-cb . args)
(cx-set-scale scl-loc
(rpgetvar 'scl-pos))
(cx-show-scale scl-loc)
(enable-cb)
)

(define (apply-cb . args)
(rpsetvar 'scl-pos (cx-show-scale scl-loc))
(enable-cb)
)


(define (enable-cb . args)
(cx-enable-item rst-nw (cx-active-window))
(cx-enable-item up-nw (cx-active-window))
)

(define (show-help)
(display "n***************************************************************n")
(display "This panel helps the user to improve the graphics resolution n")
(display "***************************************************************n")
(display " INFORMATION ABOUT THE PANEL ITEMS n")
(display " (1) Slider Bar : Adjusts the graphics resolution n")
(display " (2) Reset Graphics : Resets the defaults with the current n")
(display " graphic location n")
(display " (3) Update Gaphics : Updates the graphics based on the n")
(display " current slider bar position n")
(display " (4) "Reset Graphics" and "Update Graphics" buttons are n")
(display " available only when any of the graphics window is active n")
(display "---------------------------------------------------------------n")
(display " HOW TO USE? n")
(display " (1) Display the graphics in any active graphics window n")
(display " (2) Zoom in to any specific zone in the model n")
(display " (3) Hit "Reset Graphics" to update the defaults n")
(display " (4) Increase the slider bar position & hit "Update Graphics"n")
(display " to update the graphics. Increase the slider bar position n")
(display " till you get satisfied resolution n")
(display " (5) If you change the orientation of the model or geometry hitn")
(display " "Reset Graphics" again before using "Update Graphics" n")
(display "***************************************************************n")
)
(define (rest-cam)
(if (not (eq? #f (cx-active-window)))
(begin
(rpsetvar 'orig-cam (cx-show-camera))
(rpsetvar 'orig-pos (list-ref (rpgetvar 'orig-cam) 0))
(rpsetvar 'scl-pos 0)
(update-cb)
)
)
)

(define (exe-funs)
(if (not (eq? #f (cx-active-window)))
(begin
(apply-cb)
(update-cb)
(define cam (cx-show-camera))

; (define pos (list-ref cam 0))

(define tar (list-ref cam 1))

(define view-vec '())

(do ((i 0 (+ i 1)))
((> i 2))
(set! view-vec (list-add view-vec (- (list-ref (rpgetvar 'orig-pos) i) (list-ref tar i))))
)

(define vect-mag2 0)

(do ((i 0 (+ i 1)))
((> i 2))
(set! vect-mag2 (+ vect-mag2 (* (list-ref view-vec i) (list-ref view-vec i))))
)

(define vect-mag (sqrt vect-mag2))

(define dir-vec '())

(do ((i 0 (+ i 1)))
((> i 2))
(set! dir-vec (list-add dir-vec (/ (list-ref view-vec i) vect-mag)))
)

(define n-pos '())

(do ((i 0 (+ i 1)))
((> i 2))
(set! n-pos (list-add n-pos (+ (list-ref tar i) (* (list-ref dir-vec i) vect-mag (- 100.0 (rpgetvar 'scl-pos)) 0.01))))
)

(define testt (list n-pos))

(do ((i 1 (+ i 1)))
((> i 5))
(set! testt (list-add testt (list-ref cam i)))
)

(apply cx-set-camera testt))
)
)

(lambda args
(if (not panel)
(let ((table) (table1))
(set! panel (cx-create-panel "Improve Graphics Resolution"
apply-cb update-cb))
(set! table (cx-create-frame panel ""
'border #f))
(set! hlp-text (cx-create-button table "Read Me"
'activate-callback show-help))

(set! scl-loc (cx-create-scale table "Move right for better resolution"
'minimum 0
'maximum 95
'length 250
'below hlp-text
))

(set! table1 (cx-create-table panel ""
'below scl-loc
'border #f))

(set! rst-nw (cx-create-button table1 "Reset Graphics"
'row 1
'col 0
'activate-callback rest-cam))


(set! up-nw (cx-create-button table1 "Update Graphics"
'row 1
'col 1
'activate-callback exe-funs))
))
(cx-show-panel panel))))

(cx-add-item "Display"
"Improve Graphics Resolution"
#f
#f
cx-client?
gui-cam-pos-adjust)

;; Scheme function ends





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