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

Need help to read a TSV file with Scheme code.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2016, 16:04
Question Need help to read a TSV file with Scheme code.
  #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 everybody,

I need some help to write a Scheme code that will take inputs from a TSV file at every time step of my FLUENT simulation and assign those values to OutFlow boundary conditions.
To be more clear, I want it to read first line of the TSV file at the first time step and assign each value in the line to each Outflow boundary condition. The same for second line at the second time step, until the simulation is over.

Here is a piece of code that I wrote which doesn't work:

(define n 0.0)
(with-input-from-file "doors.txt"
(define run
(lambda (flow-time)
(set! n (/ flow-time 10)) ;10 is the size of time-steps
(let iter (n list))
(let ((a b c) (string-split line #\space)))
(ti-menu-load-string (format #f "def bc outflow 6 ~a" a))
(ti-menu-load-string (format #f "def bc outflow 7 ~a" b))
(ti-menu-load-string (format #f "def bc outflow 8 ~a" c))
)
)
)

I'd really appreciate your comments and advices.

Regards,
nsaeidi is offline   Reply With Quote

Old   July 5, 2016, 14:15
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
I have got to this point:

(define a 0.0)
(define b 0.0)
(define c 0.0)
(define RUN
(with-input-from-file
"doorstatesnegar.txt"
(lambda ()
(let (line (read-line))
(if (not (eof-object? line))
(let (((a b c) (string-split line #\space)))
)
)
)
)
(ti-menu-load-string (format #f "def bc outflow 6 ~a" a))
(ti-menu-load-string (format #f "def bc outflow 7 ~a" b))
(ti-menu-load-string (format #f "def bc outflow 8 ~a" c))
(newline)
)
)


And this is the error that I receive:
Error: let syntax: binding is not a list Error Object: line


Any ideas?
nsaeidi is offline   Reply With Quote

Reply

Tags
reading tsv files, scheme files, scheme programming


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
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 17:34
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 14:55.