|
[Sponsors] |
How to get a value from a data file bound to a variable in Scheme? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 24, 2011, 15:05 |
How to get a value from a data file bound to a variable in Scheme?
|
#1 |
New Member
Alexander M
Join Date: Aug 2011
Location: Germany
Posts: 5
Rep Power: 15 |
Hello everyone,
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. (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) ) ) ) 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! Alexander |
|
August 30, 2011, 09:21 |
|
#2 |
Member
Join Date: Apr 2009
Posts: 46
Rep Power: 17 |
Code:
(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")) |
|
August 31, 2011, 07:04 |
|
#3 |
New Member
Alexander M
Join Date: Aug 2011
Location: Germany
Posts: 5
Rep Power: 15 |
Thank you very much!
|
|
|
|
Similar Threads | ||||
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 18:51 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |
Results saving in CFD | hawk | Main CFD Forum | 16 | July 21, 2005 21:51 |
Replace periodic by inlet-outlet pair | lego | CFX | 3 | November 5, 2002 21:09 |