CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Get Zone-ID and Change the B.C. with a Journal File (https://www.cfd-online.com/Forums/fluent-udf/231997-get-zone-id-change-b-c-journal-file.html)

berkozaydin November 26, 2020 04:07

Get Zone-ID and Change the B.C. with a Journal File
 
Hello guys,

I have difficulty to import the zone-ids :). I tried to write this kind of journal file. My aim is to find zone ids which are written in the flowVector and change their boundary conditions wall to the interface. This has to be in do loop.

Here is my code:

(define flowVector (vector "ch_channel_alt" "ch_channel_ust" "ch_plate_alt" "ch_plate_ust" "dhw_channel_alt"
"dhw_channel_ust" "dhw_plate1_alt" "dhw_plate1_ust" "dhw_plate2_alt" "dhw_plate2_ust"))

(define length (vector-length flowVector))

(do ((f 0 (+ f 1))) ((> f length))
(begin
(define fV (vector-ref flowVector f))
(define c1 (zone-name->id 'fV))
/define/boundary-conditions/modify-zones/zone-type c1 interface))

And also here is my output:

Error: eval: unbound variable
Error Object: /define/boundary-conditions/modify-zones/zone-type

Error: eval: invalid function
Error Object: 10


Thanks!

pakk November 26, 2020 05:20

You are mixing journal file and scheme.
The line where you modify the zone should also be in scheme. There is a Fluent-specific scheme command to send text to the TUI, I forgot the name but it is in the help. Use that one.

berkozaydin November 26, 2020 05:45

Quote:

Originally Posted by pakk (Post 788928)
You are mixing journal file and scheme.
The line where you modify the zone should also be in scheme. There is a Fluent-specific scheme command to send text to the TUI, I forgot the name but it is in the help. Use that one.

Thanks a lot!
I tried to write this code instead of using /define/boundary...

(ti-menu-load-string (format #f "/define/boundary-conditions/modify-zones/zone-type ~a" c1))

Probably, I have some mistakes in this code. But, I am not sure where they are.

AlexanderZ November 26, 2020 18:18

looks like, there is no operations with "vector" in fluent compilation

Code:

(define (make-new-rpvar name default type)(rp-var-define name default type #f))
(make-new-rpvar 'flowVector '(ch_channel_alt ch_channel_ust ch_plate_alt ch_plate_ust dhw_channel_alt dhw_channel_ust dhw_plate1_alt dhw_plate1_ust dhw_plate2_alt dhw_plate2_ust) 'string-list)

(do ((i 0 (1+ i)) (j (rpgetvar 'flowVector) (cdr j)))
        ((null? j)) ; if j is '(), just end the loop
        (begin
                (ti-menu-load-string (format #f  "define boundary-conditions modify-zones zone-type ~a\n" (zone-name->id (car j))) )
        )
)



All times are GMT -4. The time now is 22:28.