|
[Sponsors] |
How to do a counter to exit loop in scheme language? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 22, 2013, 08:20 |
How to do a counter to exit loop in scheme language?
|
#1 |
New Member
rayolau
Join Date: Aug 2012
Posts: 23
Rep Power: 14 |
Hi all! I need help with this code scheme.
I want that in each iteration, Fluid expected to create a profile (1.prof), and then, when there is this file, read the file 1.prof, and got on a correct boundary condition. After this, another profile is deleted. At the moment, my code wait 1.prof file creation, and when this file exists, read 1.prof profile and put in the boundary condition I want. However, this process is repeated again and again and never get to clear another profile and continue to the next iteration. To make the wait for the file to each iteration, I put the file.smc as a command that repeats at each iteration. Does anyone know how to make a counter waiting for the profile creation 1.prof repeat x times, then leave the "loop"? Thanks in advance =) My scheme code is this: Code:
(define nit 1) (let loop () ; to continue, must exist profile 1.prof (if (file-exists? "C:\path\1.prof") (ti-menu-load-string "file read-profile C:\path\1.prof")) ;if file exists --> put the profile in the bc (if (file-exists? "C:\path\1.prof") (ti-menu-load-string "define/boundary-conditions/..."")) ; set profile in bc (if (file-exists? "C:\path\1.prof") (set! nit (+ nit 1))) ; counter (cx-pause 1) (loop)) ;delete other profile (if (file-exists? ""C:\path\5.prof") (system "del C:\path\5.prof")) ; |
|
May 23, 2013, 09:15 |
|
#2 |
Member
Join Date: Apr 2009
Posts: 46
Rep Power: 17 |
You can add an if-condition to your tail recursion.
Code:
(let loop () ; ... (if (< nit 10) (begin (cx-pause 1) (loop)))) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] Problem with Gmsh | nishant_hull | OpenFOAM Meshing & Mesh Conversion | 23 | August 5, 2015 03:09 |
[CAD formats] my stl surface is seen as just a line | rcastilla | OpenFOAM Meshing & Mesh Conversion | 2 | January 6, 2010 02:30 |
Scheme lprogramming language question | Hendawi | FLUENT | 2 | October 3, 2008 04:15 |
NACA0012 geometry/design software needed | Franny | Main CFD Forum | 13 | July 7, 2007 16:57 |
FLUENT scheme language | Luca | FLUENT | 2 | October 21, 2004 05:51 |