fluent scheme 之 xyplot 功能

在 FLUENT 中,利用 xyplot 功能可以繪製一些曲線,查看某些變量隨某一參數的變化情況。


還是先給出一個例子吧。


(define (hy-write-xyplot-file-2 fn v1 v2 v3 title labels llabels)
  (let
    ((p (open-output-file fn)))
    (newline)
    (format p "(title \"~a\")" title)
    (newline p)
    (format p "(labels \"~a\" \"~a\")" (car labels) (cadr labels))
    (newline p)
    (newline p)
    (format p "(")
    (newline p)

    ;
    (format p "(xy/line/pattern \"----\")")
    (format p "(xy/marker/symbol \"()\")")
    (format p "(xy/marker/size 0.6)")
    (format p "(xy/scale/label/y \"~a\") " (car labels))
    (format p "(xy/key/label \"~a\")" (car llabels))
    (format p "(xy/key/legend \"~a\")" (cadr labels))
    (format p "(xy/key/border? #f)")
    (newline p)

    (do ((i  0 (+ i 1)))
      ((>= i (length v1)))
      (begin
        (format p "~a ~a" (list-ref v1 i) (list-ref v2 i))
        (newline p)
      )
    )

    (newline p)
    (format p ")")
    (newline p)

    (newline p)
    (newline p)
    (format p "(")
    (newline p)

    ;
    (format p "(xy/line/pattern \"----\")")
    (format p "(xy/marker/symbol \"[]\")")
    (format p "(xy/marker/size 0.6)")
    (format p "(xy/scale/label/y \"~a\") " (cadr labels))
    (format p "(xy/key/label \"~a\")"  (cadr llabels))
    (format p "(xy/key/legend \"~a\")" (cadr labels))
    (format p "(xy/key/border? #f)")
    (newline p)

    (do ((i  0 (+ i 1)))
      ((>= i (length v1)))
      (begin
        (format p "~a ~a" (list-ref v1 i) (list-ref v3 i))
        (newline p)
      )
    )

    (newline p)
    (format p ")")
    (newline p)

    (close-input-port p)
    #t
  )
)

(hy-write-xyplot-file-2 "xyplot.xy"
 '(1 2 3 4 5 6 7) '(1 2 3 4 5 6 7) '(2 4 6 8 10 12 14) "xyplot" '("position" "velocity") '("A" "B"))

(xy-plot-file "xyplot.xy")


fluent 提供了一些可以修改的參數,包括文字標籤,顯示範圍,符號等,GUI 中也可以進行操作。




發佈了121 篇原創文章 · 獲贊 11 · 訪問量 29萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章