Renaming wall/wall-shdow pairs such that the shadow zone neighbors the solid zone
When we read any mesh file in FLUENT, wall/wall-shadow pairs are created for all the wall zones having cells on both sides. The creation of the wall/wall-shadow pair is dependent on the face normals. Many a times, it happens that, the zone name contains "-shadow", for a zone neighboring a fluid zone. One of the ways to change this is to adjust the face normals in Tgrid before entering/reading the mesh in FLUENT. However, it is not always possible. The following scheme function makes sure that the zone neighbouring the solid zone has "-shadow" in the zone name. The scheme function skips all the wall/wall-shadow pairs that are having same zone type around them. Thus the walls immersed in fluid or solid are skipped and their names are not altered. ;; *****************************scheme function starts********************************* ;; This is a scheme function that renames the wall-wall shadow wall pairs such that, ;; the wall zone neighbouring the solid zone, carries the name "-shadow" ;; Present Logic of the Implementation: ;; (1) The scheme function checks the wall/wall-shadow pairs in the existing case ;; (2) Checks the name of the wall/wall-shadow pair and identifies, whether the ;; wall-shadow zone neighbours the fluid zone or not ;; (3) If it does, then the string "-shadow" is removed from the name of the zone ;; (4) In the same way, if the wall zone (without the shadow in the name) neighbours ;; any fluid zone, then the string "-shadow" is removed from the zone name ;; (5) This scheme will skip all the wall/wall-shadow pairs having same zone (solid or fluid) ;; on either side of the pair. It works only on the wall/wall-shadow pairs ;; that have fluid and solid zones on either side ;; (6) The scheme function assumes that, there are no manual edits done in the ;; zone names before using the scheme function or after reading the mesh/case ;; file in FLUENT ;; (7) It is only tested on serial FLUENT session ;; In such cases the naming pattern changes singnificantly ;; This scheme function needs modification to handle those situations ;; Written by: Aashish Watve (aashish.watave@ansys.com) ;; How to use? ;; After reading the case file, read this scheme file from File-->Read-->Scheme manu ;; Now on the FLUENT command prompt, issue the following scheme command (including brackets) ;; (rename-shadow-walls-adv) (define (rename-shadow-walls-adv) (define wall-th-ids (list )) (set! wall-th-ids (map thread-id (get-threads-of-type 'wall))) (define wall-list-length (length wall-th-ids)) (define coupled-wall-list '()) (do ((i 0 (+ i 1))) ((> i (- wall-list-length 1))) (if (integer? (list-ref (inquire-adjacent-threads (list-ref wall-th-ids i)) 2)) (set! coupled-wall-list (list-add coupled-wall-list (list-ref wall-th-ids i))) ) ) (define wall-c-wall-name-list (list )) (define wall-c-wall-string-list (list )) (define c-wall-str-length-list '()) (set! wall-c-wall-name-list (map thread-id->name coupled-wall-list)) (define c-wall-list-length (length coupled-wall-list)) (do ((i 0 (+ i 1))) ((> i (- c-wall-list-length 1))) (begin (set! wall-c-wall-string-list (list-add wall-c-wall-string-list (symbol->string (list-ref wall-c-wall-name-list i)))) (set! c-wall-str-length-list (list-add c-wall-str-length-list (string-length (list-ref wall-c-wall-string-list i)))) ) ) (do ((i 0 (+ i 1))) ((> i (- c-wall-list-length 1))) (begin (if (and (eq? 'fluid (thread-type (get-thread (list-ref (inquire-adjacent-threads (list-ref coupled-wall-list i)) 0)))) (eq? 'solid (thread-type (get-thread (list-ref (inquire-adjacent-threads (list-ref coupled-wall-list i)) 1))))) (begin (if (and (> (list-ref c-wall-str-length-list i) 7) (equal? "-shadow" (substring (list-ref wall-c-wall-string-list i) (- (list-ref c-wall-str-length-list i) 7) (list-ref c-wall-str-length-list i)))) (begin (define s1 (substring (list-ref wall-c-wall-string-list i) 0 (- (list-ref c-wall-str-length-list i) 7))) (define sm "/def/bc/mz/zone-name/ ") (define s2 " ") (define smnew (string-append sm (number->string (list-ref coupled-wall-list i)) s2 s1)) (ti-menu-load-string smnew) ) ) ) ) (if (and (eq? 'solid (thread-type (get-thread (list-ref (inquire-adjacent-threads (list-ref coupled-wall-list i)) 0)))) (eq? 'fluid (thread-type (get-thread (list-ref (inquire-adjacent-threads (list-ref coupled-wall-list i)) 1))))) (begin (if (not (equal? "-shadow" (substring (list-ref wall-c-wall-string-list i) (- (list-ref c-wall-str-length-list i) 7) (list-ref c-wall-str-length-list i)))) (begin (define s1 "-shadow") (define s2 " ") (define sm "/def/bc/mz/zone-name/ ") (define smnew (string-append sm (number->string (list-ref coupled-wall-list i)) s2 (list-ref wall-c-wall-string-list i) s1)) (ti-menu-load-string smnew) ) ) ) ) ) ) ) ;; *****************************scheme function ends********************************* |
||
|