Read Scheme File

  • 291 Views
  • Last Post 21 November 2018
  • Topic Is Solved
Max4 posted this 20 November 2018

Hi,

I have write a Scheme file (see below) to change the boundary condition of inlet and outlet depending on time.

  (iif (> (rpgetvar' flow-time) 0.033) (
  (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
  (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
  (ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")

  (iif (> (rpgetvar' flow-time) 0.066) (
  (ti-menu-load-string "define/boundary-conditions/zone-type 5 mass-flow-inlet ")
  (ti-menu-load-string "define/boundary-conditions mass-flow-inlet 5 yes yes no 0.01 no 0 no yes")
  (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")

The problem is, when I try to read this file, I obtain the following error:

   Error: eof inside list

   Error Object: (if (> current_time 0.066) ((ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")))

I have checked the folder name, direction, file name and there isn´t any problem with this.

Should I define the current time ? If ys, how? The condition if (> current_time 0.033) is true at the same time as if (> current_time 0.066) . Is it a problem ?

 

Regards,

Maxime

Order By: Standard | Newest | Votes
Kremella posted this 20 November 2018

Hello,

You do not have to define these. They are macros already present in Fluent. Also, try rpgetvar 'flowtime and not rpgetvar' flowtime. However, I do not think there is a different between using this or current_time (someone please correct me if I am wrong).

Try to use the loop such that only one if statement is true. Based on your algorithm, two if statements can be true if t > 0.066. If I understand if condition, you need to have your algorithm such that only one statement is applicable for any given time.

I hope this helps.

Best Regards,

Karthik

 

Max4 posted this 20 November 2018

Hello,

Thank you for your answer. I have just found this about the If-Statement for Scheme file:

My Scheme is as follow:

(if (> (rpgetvar 'flow-time) 0.033)
(ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
(ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
(ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")
)

When I read this file I have this error, because I have 3 arguments instead of 2. It works when I just use the below scheme:

(if (> (rpgetvar 'flow-time) 0.033)
(ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")

May I use two If statements for the condition t > 0.033 ?

Error: if syntax: Too many arguments

Regards,

Maxime

Kremella posted this 20 November 2018

Hi,

Can you try the following?

(if (.....)

   (begin

      (ti-menu-.....(.....))

      (ti-menu-......(.....))

      (ti-menu-......(....))

  )

)

Please let me know how this works.

Thanks.

Best,

Karthik

Max4 posted this 20 November 2018

I´ve done as you proposed (see below) and the reading of the .scm works. Thank you.

(if (> (rpgetvar 'flow-time) 0.033)
 (
   (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
   (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
   (ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")
 
)

I read this for loading the .scm in order to use it, but I can´t find it.

 

Regards,

Maxime

Max4 posted this 20 November 2018

Moreover, I find this in order to avoid the two true If-Statement :

 

Maxime

abenhadj posted this 20 November 2018

No you need to read the scheme file as /file read-journal or just create procedures out of the scheme files and then just read the scheme file one and execute the procedure by just (procedure-name).

Best regards,

Amine

Max4 posted this 20 November 2018

I have read the .scm with the TUI-Commands: /file read-journal xxx.scm and then I load it in Calculation Activities -> Execute Commands -> (load " xxx.scm") for each Time-Step.

Thank you all for your answers.

Regards,

Maxime

abenhadj posted this 20 November 2018

Please set then this topic as solved and mark the answer which helped to resolve the question. Thanks.

Best regards,

Amine

Max4 posted this 21 November 2018

Below, the Scheme file which I use to solve my problem with the If-Statement. If 'flow-time is 0.067 (delta t=0.001s in my case), then it calls only actions below ((> (rpgetvar 'flow-time) 0.066) and not actions from the following condition ((> (rpgetvar 'flow-time) 0.033).

(cond
    ((> (rpgetvar 'flow-time) 0.066)
         (ti-menu-load-string "define/boundary-conditions/zone-type 5 velocity-inlet ")
         (ti-menu-load-string "define/boundary-conditions velocity-inlet 5 no no yes yes no 1 no 0")
         (ti-menu-load-string "define/boundary-conditions/zone-type 6 wall")
    )
    ((> (rpgetvar 'flow-time) 0.033)
         (ti-menu-load-string "define/boundary-conditions/zone-type 5 wall")
         (ti-menu-load-string "define/boundary-conditions/zone-type 6 pressure-outlet ")
         (ti-menu-load-string "define/boundary-conditions pressure-outlet 6 yes no 0 no yes yes no no")
    )
)

Then I read this file from the TUI-Commands (/file read-journal xxx.scm) and load it in the Execute Commands for each-time-step ( load "xxx.scm" ).

 

Regards,

Maxime

Close