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/)
-   -   Setting a parameter as bound in a loop (https://www.cfd-online.com/Forums/fluent-udf/214830-setting-parameter-bound-loop.html)

FrankR February 14, 2019 11:10

Setting a parameter as bound in a loop
 
Dear Community,

I need Scheme for programming for ANSYS FLUENT.

How can I set a parameter
imax = 3

and then use it as upper bound in a loop:

(do ((i 1 (+ i 1)))((> i imax))
[do something here]
)

This loop is run repeatedly in my script, thus a single definition of the upper bound would be extremely helpful.

I experimented with the commands let and define, but to no avail.

Thank you dearly,
kind regards

FrankR

AlexanderZ February 14, 2019 21:10

define your imax variable above this loop same way as you define any other rpvar

for example
Code:

(define (make-new-rpvar name default type)(if (not (rp-var-object name))(rp-var-define name default type #f)))
(make-new-rpvar 'imax 3 'int)
(do ((i 1 (+ i 1)))((> i imax))
[do something here]
)

best regards

FrankR February 15, 2019 03:55

Dear AlexanderZ

thank you for your advice.

Sincerely

FrankR


All times are GMT -4. The time now is 09:50.