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

Scheme Programming: problem writing "set!" for multiple variables

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 16, 2016, 13:05
Default Scheme Programming: problem writing "set!" for multiple variables
  #1
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
Hello all,

I am using Scheme to control Flow Rate Weighting with time for my outlets with outflow boundary condition. I have managed to write the code for controlling only one outlet. Now I want to extend my code as it can control more than one outlet. My code is attached as a txt file!
I can read it successfully but when I run it, I receive this error in text user interface:
Error: set!: not a symbol
Error Object: (flow-wt-1 flow-wt-2)

Can anybody tell me what am I doing wrong?
Attached Files
File Type: txt outflow1 3.txt (478 Bytes, 9 views)
nsaeidi is offline   Reply With Quote

Old   June 16, 2016, 15:58
Default
  #2
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
If anybody interested I sorted out my problem. Here is the code:

(define flow-wt-1 0.0)
(define flow-wt-2 0.0)
(define run1
( lambda(flow-time)
(set! flow-time (/ flow-time 10))
(if (< flow-time 181)
(set! flow-wt-1 '1.0)
(set! flow-wt-1 '0.0))
(ti-menu-load-string (format #f "def bc outflow 6 ~a" flow-wt-1))
(ti-menu-load-string (format #f "def bc outflow 7 ~a" flow-wt-1))
)
)
(define run2
( lambda(flow-time)
(set! flow-time (/ flow-time 10))
(if (> flow-time 180)
(set! flow-wt-2 '1.0)
(set! flow-wt-2 '0.0))
(ti-menu-load-string (format #f "def bc outflow 8 ~a" flow-wt-2))
)
)

It needs to be called in the Execute Commands by defining two commands at each time steps:
(run1 ( rpgetvar 'flow-time)) and (run2 ( rpgetvar 'flow-time))

Last edited by nsaeidi; June 29, 2016 at 15:39.
nsaeidi is offline   Reply With Quote

Reply

Tags
outflow bc, scheme files, set!


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
Problem using Central differencing scheme with LES in CFX selvam2487 CFX 8 April 11, 2016 14:15
Need HELP in writing UDF for a dynamic mesh problem farrux Fluent UDF and Scheme Programming 0 July 3, 2015 03:53
Differencing Scheme for Advection Problem Simon Smokes Main CFD Forum 2 April 8, 2015 11:59
A problem about AUSM scheme! hitleo Main CFD Forum 0 May 30, 2005 09:05
problem about numerical scheme in LES. libin Main CFD Forum 4 July 1, 2004 05:32


All times are GMT -4. The time now is 13:35.