CFD Online URL
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

variables is scheme

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 14, 2011, 14:00
Question variables is scheme
  #1
New Member
 
Ali
Join Date: Mar 2011
Posts: 27
Rep Power: 5
ali hemmati is on a distinguished road
Hello,
I have problem with using variables in loops. The problem is how to define a global variable which can get a value in loop. It may seem silly, but running the following code, I found that Fluent deletes value of any variable just after the loop runs for the second time.
Code:
(define x)
;;loop
(do (( cntr 0 (+ cntr 1) )) ((> cntr 10))
  (if (= cntr 0)
    (begin
      (define x 10))
    (begin
      (define x (+ x 1))
      (display x))
  )
)
How can I define variable 'x' ?

Last edited by ali hemmati; April 15, 2011 at 08:53.
ali hemmati is offline   Reply With Quote

Old   July 20, 2011, 01:41
Default
  #2
Member
 
fox000002's Avatar
 
Join Date: Apr 2009
Posts: 46
Rep Power: 7
fox000002 is on a distinguished road
Code:
(define x) 
;;loop
 (do (( cntr 0 (+ cntr 1) )) ((> cntr 10))  
   (if (= cntr 0)    
      (set! x 10)   
     (begin
        (set! x (+ x 1))
        (display x)) ))
fox000002 is offline   Reply With Quote

Reply

Tags
global variable, scheme, set a value

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
how to understand high resolution scheme and high order scheme iilw1314 Main CFD Forum 3 September 30, 2010 11:43
Implementation of QUICK scheme Romuald Skoda Main CFD Forum 10 August 3, 2010 13:23
AUSM scheme ? Central Scheme boling Main CFD Forum 5 September 9, 2009 20:06
Definition of limiter function for central dirrerencing scheme sebastian_vogl OpenFOAM Running, Solving & CFD 0 January 5, 2009 12:08
extrapolation in MUSCL scheme Chandra Main CFD Forum 6 February 14, 2007 12:21


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