CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

variables is scheme

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2011, 14:00
Question variables is scheme
  #1
New Member
 
Ali
Join Date: Mar 2011
Posts: 27
Rep Power: 15
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: 16
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 Search this Thread
Search this Thread:

Advanced Search
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 Off
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 7 April 12, 2022 13:29
Implementation of QUICK scheme Romuald Skoda Main CFD Forum 11 November 6, 2017 22:20
AUSM scheme ? Central Scheme boling Main CFD Forum 7 January 7, 2016 03:41
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 09:18.