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 scheme 之 xyplot 功能_第1张图片


fluent 提供了一些可以修改的参数,包括文字标签,显示范围,符号等,GUI 中也可以进行操作。




你可能感兴趣的:(velocity,Scheme,newline)