|
[Sponsors] |
Writing surface report to a file using journal file |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 15, 2021, 11:53 |
Writing surface report to a file using journal file
|
#1 |
New Member
Join Date: Apr 2021
Posts: 4
Rep Power: 5 |
Hi
I'm currently attempting something that should be relatively straightforward: I want to take an area-weighted average on a surface, and write that value to a file using a journal command. I want to do this from an existing data file, not as I'm running my calculation. This is easily achievable through the GUI by simply going through the report interface and clicking 'write' after I've calculated my average. However, I can't seem to find an equivalent journal command. (The report/surface-integrals tree doesn't have a write option, and the file tree doesn't seem to have a surface-integrals option) (The reason I'm doing this is simply that I have a large number of data files that I'd like to loop through and take the report from each of them) |
|
April 15, 2021, 22:33 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you don't need journal file to do that
it is possible to write to file integrals vs time: solution -> report-definition -> new -> surface-report -> area-weight average -> select variable and face -> OK now create output file: solution-> monitors -> report Files -> new -> select your variable -> define file name -> OK
__________________
best regards ****************************** press LIKE if this message was helpful |
|
April 16, 2021, 05:10 |
|
#3 |
New Member
Join Date: Apr 2021
Posts: 4
Rep Power: 5 |
Thanks for your response. Unfortunately I'm not sure its applicable to my case, as I already have the solution data files and I don't want to rerun the simulation.
I'm looking instead to write the value from a journal file as I already have a script to loop through the existing data files and perform the journal operations on them. I'd rather not go through each one manually writing out the value. |
|
April 19, 2021, 01:30 |
|
#4 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
to write output at the end of file:
Code:
(ti-menu-load-string (format #f " report surface-integrals area-weighted-avg *surface_name* () *variable* yes *filename.srp* ")) output will look like this Quote:
Code:
(pick-a-real (format #f "report surface-integrals area-weighted-avg *surface_name* () *variable* no")) Code:
;;;write to file (define call-with-output-file (lambda (filename proc) (let ((p (open-output-file filename "a"))) ;;; a means my_append (let ((v (proc p))) (close-output-port p) v))) ) ;;;write to file in format: Filename | Data (as a list) (define (write_this filename data) (call-with-output-file filename (lambda (p) (let f ((ls data)) (if (not (null? ls)) (begin (write (car ls) p) (write #\tab p) (f (cdr ls)) ) (newline p) )))) ) ;;;convert list from pairs (define (flatten x) (cond ((null? x) x) ((and (pair? x) (not (pair? (car x)))) (cond ((null? (car x)) (flatten (cdr x))) (else (cons (car x) (flatten (cdr x)))))) ((and (pair? x) (pair? (car x))) (flatten (cons (caar x) (cons (cdar x) (cdr x))))) (else (cons x '()))) ) ;;; put face name inside " " | example (get_surface_avg "surface_name") (define (get_surface_avg surface_name) (pick-a-real (format #f "report surface-integrals area-weighted-avg ~a () *variable* no" surface_name)) ) ;;; run this to execute (write_this "_surface_avg" (flatten (get_surface_avg "surface_name")))
__________________
best regards ****************************** press LIKE if this message was helpful |
||
April 19, 2021, 07:29 |
|
#5 |
New Member
Join Date: Apr 2021
Posts: 4
Rep Power: 5 |
Thanks so much for this - although actually I realise now that the option to write to file was always there under report and I simply wasn't going far enough to find it. Incidentally, I'm having a hard time finding much documentation on the scheme language. Do you have any good source of info on it?
|
|
April 20, 2021, 01:07 |
|
#6 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
https://www.researchgate.net/publica..._Dokumentation
there you can find literature list, but in German: Quote:
__________________
best regards ****************************** press LIKE if this message was helpful |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Installation Problem with OF 6 version | Aurel | OpenFOAM Community Contributions | 14 | November 18, 2020 16:18 |
OpenFoam "Permission denied" and "command not found" problems. | iyidaniel@yahoo.co.uk | OpenFOAM Running, Solving & CFD | 11 | January 2, 2018 06:47 |
Trouble compiling utilities using source-built OpenFOAM | Artur | OpenFOAM Programming & Development | 14 | October 29, 2013 10:59 |
centOS 5.6 : paraFoam not working | yossi | OpenFOAM Installation | 2 | October 9, 2013 01:41 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 11:44 |