|August 24, 2011, 14:05||
How to get a value from a data file bound to a variable in Scheme?
Join Date: Aug 2011
Posts: 5Rep Power: 7
I am a student from Germany and have the following problem.
During the simulation Fluent is writing the current of each iteration into a data file "I_anode.out".
I now want the value back into scheme to be able to do some calculations with it and feed Fluent a new mass-flow-rate befor the next iteration step.
I have found a an example how to read values back into scheme by Mirko Javurek and changed it for my purpose.
((p (open-input-file "I_anode.out")))
((x (read p) (read p)))
(or (number? x) (eof-object? x))
(if (number? x) x #f)
The problem is that only the number is shown in the TUI and I do not have a variable to do calculations with. I tried a few ideas myself but was not able to bind the current value to a variable.
I would really appreciate if someone could help me to rewrite the program so I could to do some further calculations.
Thank you for your help!
|August 30, 2011, 08:21||
Join Date: Apr 2009
Posts: 46Rep Power: 9
(define read-data-from-file (lambda (fn) (let ((p (open-input-file "I_anode.out"))) (do ((x (read p) (read p))) ( (or (number? x) (eof-object? x)) (close-input-port p) (if (number? x) x #f) ) ) ) ) ) (define your-var (read-data-from-file "I_anode.out"))
|Thread||Thread Starter||Forum||Replies||Last Post|
|OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3||flakid||OpenFOAM Installation||16||December 28, 2010 09:48|
|DecomposePar links against liblamso0 with OpenMPI||jens_klostermann||OpenFOAM Bugs||11||June 28, 2007 17:51|
|Axisymmetrical mesh||Rasmus Gjesing (Gjesing)||OpenFOAM Native Meshers: blockMesh||10||April 2, 2007 14:00|
|Results saving in CFD||hawk||Main CFD Forum||16||July 21, 2005 20:51|
|Replace periodic by inlet-outlet pair||lego||CFX||3||November 5, 2002 21:09|