CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

How to do a counter to exit loop in scheme language?

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   May 22, 2013, 07:20
Default How to do a counter to exit loop in scheme language?
New Member
Join Date: Aug 2012
Posts: 23
Rep Power: 7
rayolau is on a distinguished road
Hi all! I need help with this code scheme.

I want that in each iteration, Fluid expected to create a profile (, and then, when there is this file, read the file, and got on a correct boundary condition. After this, another profile is deleted.

At the moment, my code wait file creation, and when this file exists, read 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 repeat x times, then leave the "loop"?

Thanks in advance =)
My scheme code is this:
(define nit 1)
(let loop ()

    ; to continue, must exist profile
(if (file-exists? "C:\path\") (ti-menu-load-string "file read-profile C:\path\"))
;if file exists --> put the profile in the bc
(if (file-exists? "C:\path\") (ti-menu-load-string "define/boundary-conditions/...""))  ; set profile in bc
(if (file-exists? "C:\path\") (set! nit (+ nit 1)))  ; counter
(cx-pause 1)

;delete other profile
(if (file-exists? ""C:\path\") (system "del C:\path\"))  ;
rayolau is offline   Reply With Quote

Old   May 23, 2013, 08:15
fox000002's Avatar
Join Date: Apr 2009
Posts: 46
Rep Power: 10
fox000002 is on a distinguished road
You can add an if-condition to your tail recursion.

(let loop ()
  ; ...
  (if (< nit 10)
       (cx-pause 1)
fox000002 is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Gmsh nishant_hull Open Source Meshers: Gmsh, Netgen, CGNS, ... 23 August 5, 2015 02:09
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 03:15
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57
FLUENT scheme language Luca FLUENT 2 October 21, 2004 04:51

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