Hanlin-Dong / SmartAnalyze

Helper function to boost OpenSees analyze.
MIT License
21 stars 10 forks source link

Write Value While in SmartAnalyze #3

Open AmyMcCall opened 2 years ago

AmyMcCall commented 2 years ago

Hanlin-Dong,

I am still working with the SmartAnalyze function and would like to be able to report in an external file whether SmartAnalyze failed or passed it's analysis. Within SmartAnalyze, this is indicated in the SmartAnalyzeTransient function in the "for seg in range(1, int(npts)+1):" loop.

When I try to open a file and write to it, within this loop, nothing happens. I also, cannot define a global variable and set its value within this loop.

Can you help me with this? Hopefully the image attached below.

Thanks,

Amy

image

AmyMcCall commented 2 years ago

Can anyone help me with this issue?

Hanlin-Dong commented 2 years ago

Hi Amy, I'm not very sure why this happens. But you should not call open that many times. The correct way should be: call open at the very beginning, then call write within the loop, and call close at the very end. If you want to monitor the process, each time after you open and write, a close should be called. I recommend you to use the terminal redirect operator > to setup a pipe and stream the stdout and stderr to a file. It seems easier and logs the OpenSees outputs as well. You can google how to use it. Hanlin