creating multiple point monitors


Client needs to define multiple point surfaces. At each point surface, create a monitor for u,v,w and p. Thus for x points, there will be 4x point monitors. Each monitor is written to a uniquely-named file.

In the scheme file there are three lists: x, y and z, which all must be of the same length. The components of the list represent the x,y and z coords of the point surfaces. The only requirement is that the length of x = length y = length z.



;;;; SCHEME FILE
;;;; x, y, and z data
(define x (list
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
))
(define y (list
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
))
(define z (list
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
0.1 0.2 0.3 0.4
))








;;;;;;; Don't edit below this line...



;;; QUIET OUTPUT
(define ti-menu-load-string-quiet
(lambda (string)
(let (
(old-current *current-output-port*)
(port (open-output-string))
)
(set! *current-output-port* port)
(ti-menu-load-string string)
(set! *current-output-port* old-current)
(close-output-port port)
""
)
))

;;; Pad string with zeros
(define (pad-zeros name pad-length)
(if (< (string-length name) pad-length)
(begin (pad-zeros (string-append "0" name) pad-length)) name))


;;; Create a point and set 4 monitors on that point
(define assign-point-monitor
(lambda (ip xp yp zp)
(let ((i ip)
(x xp)
(y yp)
(z zp))
(ti-menu-load-string-quiet
(string-append
(string-append
(string-append
(string-append
(string-append
(string-append
(string-append "/surface point-surface "
(string-append "point-" (pad-zeros (number->string ip) 4)))
" ") (number->string x)) " ") (number->string y)) " ") (number->string z)))

(ti-menu-load-string-quiet
(string-append
(string-append
(string-append
(string-append
(string-append
(string-append "/solve monitors surface set-monitor "
(string-append "mon-p-" (pad-zeros (number->string ip) 4)))
" pressure ")
(string-append "(point-" (pad-zeros (number->string ip) 4)))
") n n y ")
(string-append "mon-p-" (pad-zeros (number->string ip) 4)))
".out y "Vertex Average"")
)

(ti-menu-load-string-quiet
(string-append
(string-append
(string-append
(string-append
(string-append
(string-append "/solve monitors surface set-monitor "
(string-append "mon-u-" (pad-zeros (number->string ip) 4)))
" x-velocity ")
(string-append "(point-" (pad-zeros (number->string ip) 4)))
") n n y ")
(string-append "mon-u-" (pad-zeros (number->string ip) 4)))
".out y "Vertex Average"")
)

(ti-menu-load-string-quiet
(string-append
(string-append
(string-append
(string-append
(string-append
(string-append "/solve monitors surface set-monitor "
(string-append "mon-v-" (pad-zeros (number->string ip) 4)))
" y-velocity ")
(string-append "(point-" (pad-zeros (number->string ip) 4)))
") n n y ")
(string-append "mon-v-" (pad-zeros (number->string ip) 4)))
".out y "Vertex Average"")
)

(ti-menu-load-string-quiet
(string-append
(string-append
(string-append
(string-append
(string-append
(string-append "/solve monitors surface set-monitor "
(string-append "mon-w-" (pad-zeros (number->string ip) 4)))
" z-velocity ")
(string-append "(point-" (pad-zeros (number->string ip) 4)))
") n n y ")
(string-append "mon-w-" (pad-zeros (number->string ip) 4)))
".out y "Vertex Average"")
)

)))


;;; Loop over all points (main loop)
(define def-mons
(lambda (first last xdata ydata zdata)
(let countdown ((i first) (xval xdata) (yval ydata) (zval zdata))
(if (< i last)
(begin
(assign-point-monitor i (car xval) (car yval) (car zval))
(countdown (+ i 1) (cdr xval) (cdr yval) (cdr zval))
)
(begin
(assign-point-monitor i (car xval) (car yval) (car zval))
(display 'Done.)
)))))


;;; Check arrays, then make call to main loop
(define make-uns-mons
(lambda (xd yd zd)
(let ((first 0)
(lenx (- (length xd) 1))
(leny (- (length yd) 1))
(lenz (- (length zd) 1))
)
(if (and (= lenx leny) (= lenx lenz))
(def-mons first lenx xd yd zd)
(display "x y and z are not the same lengthn")
)
)))





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