|
[Sponsors] |
March 31, 2020, 04:45 |
Write projected area into variable
|
#1 |
New Member
Join Date: Mar 2020
Posts: 2
Rep Power: 0 |
Hello everyone,
I am currently working on a script to fully automate a straight line vehicle CFD-simulation to do quicker design iterations. In order to calculate the coefficients cl and cd correctly I have to automate the task of calculating the projected frontal area of the car onto the x-plane, store it as some kind of variable and access this variable/value when defining the reference values later. I already know how to calculate the value via my script but I fail to assign the single value to a variable for easy access. I have also tried to output the value to a .txt-file that could be read in later but the problem is, that not just the value but additional text is stored in that file making it hard to just access the desired value. Here is my code so far: ;;OPTION01: WRITE VALUE TO .TXT FILE ;;projected area on x-plane evaluation (define projectedsurfaces '(wing01 wing02 endplate)) ;calculate the projected area on x-plane and write it to .txt file (with-output-to-file "projectedxarea.txt" (lambda () (ti-menu-load-string "report projected-surface-area projectedsurfaces 0.001 1 0 0"))) ;;The output .txt-file will look like this: ;report projected-surface-area projectedsurfaces 0.001 1 0 0 ; Area of surfaces (9 8 7 6) projected onto plane (1, 0, 0): 0.00041090155 ;;OPTION02: OUTPUT VALUE TO CONSOLE/TUI AND ACCESS FROM HERE(?) (define projectedsurfaces '(wing01 wing02 endplate)) (ti-menu-load-string "report projected-surface-area projectedsurfaces 0.001 1 0 0") I only need the value "0.00041090155" to work with. I will be very grateful for any help. Thank's in advance. Best regards |
|
March 31, 2020, 08:22 |
Solved it
|
#2 |
New Member
Join Date: Mar 2020
Posts: 2
Rep Power: 0 |
Sorry for bothering, I was able to transfer knowledge I collected in other threads. The solution to my problem is as follows:
;variable for projected area on x-plane (define projectedsurfaces '(wing01 wing02 endplate)) ;;define reference values ;area (define projectedxarea (ti-menu-load-string (format #f "report reference-values area ~a " (pick-a-real "report projected-surface-area projectedsurfaces 0.001 1 0 0")))'int #f) (display projectedxarea) It's a combination of the "ti-menu-load-string"-, the "format"- and "pick-a-real"-commands. In the end 'int #f converts the string to an int, which can then be used inside the reference values. Best regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mesh file for flow over a circular cylinder | Ardalan | Main CFD Forum | 7 | December 15, 2020 14:06 |
Non overlap area fractions | saisanthoshm88 | CFX | 11 | September 17, 2015 19:42 |
Water subcooled boiling | Attesz | CFX | 7 | January 5, 2013 04:32 |
Write the cell area of a patch | Andrea_85 | OpenFOAM | 5 | July 27, 2011 09:29 |
Replace periodic by inlet-outlet pair | lego | CFX | 3 | November 5, 2002 21:09 |