Change output file name in custom command

Post Reply
Carlotta
Posts: 8
Joined: Fri Apr 01, 2022 2:40 pm

Change output file name in custom command

Post by Carlotta » Sun Nov 27, 2022 4:02 pm

Dear Team STKO,
I have a question regarding the creation of output files using custom command:
I added two regions of nodes using the selection sets created on purpose, then I used the costum command to record acceleration at nodes. In the selection sets I added more then one node (I added a selection set for each vertical I have to investigate with three or two nodes) and in the custom command I set to obtain a different file for each node using the node id, as it was done in one of your webinars.
Would it be possible to differentiate output files by position instead of node id? Let me explain: for each node in the slection set, I would like to obtain an output file called e.g.
" f 0 _ sup "
f0 for identifying the veritical
sup for identify the node (sup for supirior nodes - int for interface nodes - bed for bedrock nodes)
Image
Is this possible by writing a script in the costum command?
Or should I make a selection set, a list and a costum command for each node?
Below I attached the files of the whole model.
Thank you in advance.
Attachments
2D_DY_B_06_02_L.zip
(413.83 KiB) Downloaded 19 times

STKO Team
Posts: 2068
Joined: Tue Oct 29, 2019 8:45 am

Re: Change output file name in custom command

Post by STKO Team » Mon Nov 28, 2022 8:13 am

I'll give you a hint:

in Tcl, after you get the node_id in the loop, you can use the nodeCoord OpenSees's command to get the coordinates:

Code: Select all

set node_id [lindex $list_f $i]
set node_coord [nodeCoord $node_id]
set node_x [expr [lindex $node_coord 0]]
set node_y [expr [lindex $node_coord 1]]
Now you can use them to change the recorder's name

Carlotta
Posts: 8
Joined: Fri Apr 01, 2022 2:40 pm

Re: Change output file name in custom command

Post by Carlotta » Sun Dec 04, 2022 4:50 pm

Thank you very much!
I tried to solve it this way, I attach the file below.
Image
I have another question: is it possible to create a single folder that collects all these .out files and has a specific name, as in the recorder?
Attachments
2D_DY_B_06_02_L.zip
(416.88 KiB) Downloaded 20 times

STKO Team
Posts: 2068
Joined: Tue Oct 29, 2019 8:45 am

Re: Change output file name in custom command

Post by STKO Team » Wed Dec 07, 2022 10:42 am

Just create another CustomCommand analysis step before your custom recorders, using the TCL mkdir command:

Code: Select all

file mkdir  "your_folder_name" 
Then, in each recorder modify this:

Code: Select all

eval "recorder Node -file "your_folder_name/f0_$a.out" -time -node $node_id -dof 1 accel"

Post Reply