how can I write these data in an out file?

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
cicilixiaoran
Posts: 26
Joined: Sun Aug 16, 2009 11:30 pm
Location: beijing jiaotong university

how can I write these data in an out file?

Post by cicilixiaoran »

hello everyone, hello vesna,
I have another problem.I get a strain in every load step, how can I write these strain in an out file?
I write this command:
set outFileID [open data/strain.out w]
puts $outFileID $strain
But finally when i open the strain.out file, I only get the strain of the first load step. what is wrong? Can you give me an example again? Thank you for your help.
vesna
Posts: 3033
Joined: Tue May 23, 2006 11:23 am
Location: UC Berkeley

Post by vesna »

You can use element recorder command to record strain. Here is an example that records the strain at fiber location (0.1, 0.1) of section 1 for elements 1 and 3.

recorder Element -file Strain.out -ele 1 3 section 1 fiber 0.10 0.10 strain
cicilixiaoran
Posts: 26
Joined: Sun Aug 16, 2009 11:30 pm
Location: beijing jiaotong university

Post by cicilixiaoran »

Dear vesna,

thank you for your help.

set outFileID [open filetoread.out "r"]
set b [read $outFileID]
close $outFileID
set a [lindex $b 1]
puts "a is $a"
Through the above command, I can get the second data "a" in the first lode step. That puts "a is $a" is putting out to the screen, if I want to write it in a new out file "strain.out", how to do it? And the next load step, I get the filetoread.out again, and get a second data "a" again from the filetoread.out, I want write it in this strain.out again. Finally, in the strain.out file, I can get all second data "a" from the filetoread.out generated from every load step. How to do it? Thank you.

Best regards

cicilixiaoran
vesna
Posts: 3033
Joined: Tue May 23, 2006 11:23 am
Location: UC Berkeley

Post by vesna »

Here is the way to open file for writing and to append to it value "a":

set strain "strain.out"
set Strain [open $strain "a"]
puts $Strain " $a"
close $Strain
cicilixiaoran
Posts: 26
Joined: Sun Aug 16, 2009 11:30 pm
Location: beijing jiaotong university

Post by cicilixiaoran »

Dear vesna,

I successfully do it according to your suggestion.Thank you very much!

Best regards
cicilixiaoran
Post Reply