CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Adding Custom Tab in FLUENT using Scheme Code (http://www.cfd-online.com/Forums/fluent-udf/68303-adding-custom-tab-fluent-using-scheme-code.html)

dhimans September 14, 2009 15:10

Adding Custom Tab in FLUENT using Scheme Code
 
Hi ,

I have a scheme code with which I can add a custom tab in FLUENT for inputting my GLOBAL variables for an automation code (again in Scheme).

The Tab works fine in GUI but I get junk values of those global variables when I try to retrieve them.

I want to be able to access the values of those global variables at all times.

The Code is -----------------------------------------------------------------------

Code:


 
;------------ Create RPVARS for Input parameters----------------------
(if (not (rp-var-object 'c_1))(rp-var-define 'c_1 550 'real #f))        ;corresponds to default mainstream gas temp
(if (not (rp-var-object 'c_2))(rp-var-define 'c_2 60 'real #f))        ;corresponds to default mainstream velocity
(if (not (rp-var-object 'c_3))(rp-var-define 'c_3 1.5 'real #f))        ;corresponds to default turbulent intensity
(if (not (rp-var-object 'c_4))(rp-var-define 'c_4 300 'real #f))        ;corresponds to default coolant gas temp 
;-------------------------------------------------------------------------------
 
(define Tgas)          ; 4 Global variables                   
(define Vgas)
(define I)
(define Tcool)
 
;--------------------------------------------------------------------------------
(define gui-icht                           
   
  (let ((panel #f))
 
          (define (update-cb  args)          ;update panel fields
  (cx-set-real-entry Tgas (rpgetvar 'c_1))
  (cx-set-real-entry Vgas (rpgetvar 'c_2))
  (cx-set-real-entry I (rpgetvar 'c_3))
  (cx-set-real-entry Tcool (rpgetvar 'c_4))
          )
 
      (define (apply-cb  args)
  (rpsetvar 'c_1 (cx-show-real-entry Tgas))
  (rpsetvar 'c_2 (cx-show-real-entry Vgas))
  (rpsetvar 'c_3 (cx-show-real-entry I))
  (rpsetvar 'c_4 (cx-show-real-entry Tcool)) 
        )
     
           
 
      (lambda (args)
         
(if (not panel) 
   
(let ((table) (form)) 
(set! panel (cx-create-panel "ICHT PANEL" apply-cb update-cb))
(set! table (cx-create-table panel "" 'border #f 'below 0 'right-of 0))
(set! form (cx-create-frame table "" 'border #f))
(set! Tgas (cx-create-real-entry table "Tg" 'width 14 'row 1 'col 0 ))
(set! Vgas (cx-create-real-entry table "Vg" 'width 14 'row 2 'col 0 ))
(set! I (cx-create-real-entry table "Tu%" 'width 14 'row 3 'col 0 ))
(set! Tcool (cx-create-real-entry table "Tc" 'width 14 'row 4 'col 0))

 
(set! *cx-exit-on-error* #f)
)
 
(cx-show-panel panel))
 
    ); END OF LET SCOPE
 
); END OF FUNCTION DEFINITION 
 
 
(let ((menu (cx-add-menu "ICHT-GUI-Beta" #\U ))); end of let list 
     
      (cx-add-item menu "PARAMATERS"  #\U #f cx-client? gui-icht)
      (cx-add-item menu "START PROGRAM" #\O #f and (lambda ()(load "main.scm"))); Starts the main automation code 
 
      (set! *cx-exit-on-error* #f)
 )
 
 
(set! *cx-exit-on-error* #f)

;-----------------------------------------------------------------------------

I wish to load the custom tab ... Update the values .. and Retrieve the values anywhere in the main program. But when I try doing that get a Junk Value.
;-----------------------------------------------------------------------------

Please help me out with this

Regards
Dhiman


All times are GMT -4. The time now is 20:01.