Being able to specify automatically a naming convention based on type+ID for all the zones in a case file


In a case file with a large number of zones, the task of enforcing a certain naming
convention based on each zone type and ID, would be daunting if done manually.
Hence, provide an automatical / journal-friendly method to name ALL the zones
in a given case file based on zone type (interior, fluid, solid, velocity-inlet, etc.)
and zone ID. For example, all the pressure-inlets will be named
pressure-inlet-7
pressure-inlet-10
pressure-inlet-12
and all the walls will be named
wall-9,
wall-11,
wall-121,
etc.
Use the Scheme function showed below.

;; Scheme function to enforce a naming convention
;; for zones based on their type and their ID
;;
;; Usage
;; 1) Read case file
;; 2) Load the file "naming.scm" through File>Read>Scheme or
;; through (load "naming.scm")
;; 3) use the function through a command of the form
;; (scramble type)
;; where type is a symbol for the type of the face / cell zones
;; you want affected by the naming convention
;; For example, if you would like to set the names for ALL the
;; walls to a generic wall-N, where N is the ID of that zone,
;; type the command
;; (scramble 'wall)
;; Do not change below this line without calling for support
;;;==========================================================
(define scramble
(lambda (type)
(let ((scr))
(set! scr
(lambda (t typ)
(let ((tname)(tid))
(set! tname (thread-name t))
(set! tid (thread-id t))
(ti-menu-load-string (string-append "/def/bc/mo-zo/zo-na " (number->string tid)
" " (symbol->string typ) "-" (number->string tid))))))
(for-each
(lambda (t)
(scr t type))
(get-threads-of-type type)))))





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