Parameter study

Post Reply
miran
Posts: 22
Joined: Wed Apr 29, 2020 7:15 pm

Parameter study

Post by miran » Wed Jun 17, 2020 9:23 am

Hi,

Is it possible to set up a parameter study in STKO? Say I have a model which is subjected to a harmonic load with a certain frequency (time series). However, i wish to analyze the same model but I only wish to change the time series. Is it possible to set up such procedures so that several a .mpco-file are generated for each analysis?
Regards,

Miran Cemalovic
PhD Candidate
Department of Structural Engineering
Norwegian University of Science and Technology (NTNU)
NO-7491 Trondheim, Norway
https://www.ntnu.edu/employees/mirancem

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

Re: Parameter study

Post by STKO Team » Wed Jun 17, 2020 1:44 pm

Dear Miran,

Parameteric analysis are not built-in in STKO at the moment, though we are currently working on it and it will be available soon.
Now you can achieve the same using some "customCommad" (TCL script) analysis step.
Basically you need to create a TCL script that "opens" the parametric loop, and sets up the parametric objects (in your case the timeSeries and the recorder...).
After that you can add all your regular analysis steps.
Finally you need another simple TCL script that "closes" the parametric loop and wipes the opensees workspace.

Here is an example:
PARAM_TEST.zip
(73.94 KiB) Downloaded 48 times

miran
Posts: 22
Joined: Wed Apr 29, 2020 7:15 pm

Re: Parameter study

Post by miran » Sun Oct 18, 2020 4:23 pm

Hi again,

I posted this a while back, but I haven't had a chance to test this properly until recently. I believe I follow the logic behind your script, except for the last part where you name the .mpco-files. Not sure if I understand this completely. When I try to implement the code in my model, I get the an error related to exactly this. See screenshot below.

I have made some small changes from the original script, i.e. changed the timeseries and model domain to three dimensions and six dofs). I have renamed the rec-input to match the custom script.

I should also mention that I am trying to run the loop while using OpenSees MP. Perhaps this is not possible as the script is written now?

Any tip or suggestion on how to solve this would be very much appreciated.

stko_rec.JPG
stko_rec.JPG (64.76 KiB) Viewed 204 times
stko_error.JPG
stko_error.JPG (59.97 KiB) Viewed 204 times
Attachments
pile_soil.7z
(1017.94 KiB) Downloaded 4 times
Regards,

Miran Cemalovic
PhD Candidate
Department of Structural Engineering
Norwegian University of Science and Technology (NTNU)
NO-7491 Trondheim, Norway
https://www.ntnu.edu/employees/mirancem

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

Re: Parameter study

Post by STKO Team » Mon Oct 19, 2020 8:50 am

This is simple due to the fact that partitioned models renames the output MPCO and MPCO.CDATA files using another string to identify the partition number.

Just change the last lines of the Initial Loop from this:

Code: Select all

# this is the name STKO gave it... make sure to use the escape character before the $ char!!
set STKO_file_name "PARAM_RESULT_\$param_id.mpco.cdata"
# this is the new name, DON'T use the escape character, to the param_id will be eval by TCL!
set current_file_name "PARAM_RESULT_$param_id.mpco.cdata"
file copy -force $STKO_file_name $current_file_name
to this:

Code: Select all

set PID [getPID]
# this is the name STKO gave it... make sure to use the escape character before the $ char!!
set STKO_file_name "PARAM_RESULT_\$param_id.part-$PID.mpco.cdata"
# this is the new name, DON'T use the escape character, to the param_id will be eval by TCL!
set current_file_name "PARAM_RESULT_$param_id.part-$PID.mpco.cdata"
file copy -force $STKO_file_name $current_file_name
Let me know if it solves your problems

miran
Posts: 22
Joined: Wed Apr 29, 2020 7:15 pm

Re: Parameter study

Post by miran » Tue Oct 27, 2020 1:18 pm

Hi,

I have implemented you suggestion, but I still get the same error: error copying "PARAM_RESULT_$param_id.part-4.mpco.cdata": no such file or directory

As far as I can see, the code is not dependent on the file name? I have tested with the same name as your original file, but I still get the same error. I have attached the file with the new code block.
Attachments
pile_soil.zip
(3.21 MiB) Downloaded 4 times
Regards,

Miran Cemalovic
PhD Candidate
Department of Structural Engineering
Norwegian University of Science and Technology (NTNU)
NO-7491 Trondheim, Norway
https://www.ntnu.edu/employees/mirancem

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

Re: Parameter study

Post by STKO Team » Tue Oct 27, 2020 2:26 pm

Dear Miran,
It looks strane because in my case it is running just fine. Could you please show how you call OpenSees, and in what folder? Do you have the mpco.cdata files with the "$param_id" in the string?

This is the OpenSees output:

Code: Select all

"RUNNING AS PARALLEL"


         OpenSees -- Open System For Earthquake Engineering Simulation
                 Pacific Earthquake Engineering Research Center
                        Version 3.2.2 64-Bit

      (c) Copyright 1999-2016 The Regents of the University of California
                              All Rights Reserved
  (Copyright and Disclaimer @ http://www.berkeley.edu/OpenSees/copyright.html)


InitialStateAnalysisWrapper nDmaterial - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
BEGIN PARAMETRIC ANALYSIS LOOP ...
InitialStateAnalysisWrapper nDmaterial - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
BEGIN PARAMETRIC ANALYSIS LOOP ...
InitialStateAnalysisWrapper nDmaterial - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
BEGIN PARAMETRIC ANALYSIS LOOP ...
InitialStateAnalysisWrapper nDmaterial - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
BEGIN PARAMETRIC ANALYSIS LOOP ...
InitialStateAnalysisWrapper nDmaterial - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
BEGIN PARAMETRIC ANALYSIS LOOP ...
InitialStateAnalysisWrapper nDmaterial - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
BEGIN PARAMETRIC ANALYSIS LOOP ...
   RUNNING PARAMETRIC ANALYSIS 0 ...
   RUNNING PARAMETRIC ANALYSIS 0 ...
   RUNNING PARAMETRIC ANALYSIS 0 ...
   RUNNING PARAMETRIC ANALYSIS 0 ...
   RUNNING PARAMETRIC ANALYSIS 0 ...
   RUNNING PARAMETRIC ANALYSIS 0 ...
loading "hdf5.so" ...
loading "hdf5.so" ...
MPCORecorder: done loading HDF5
loaded symbol "H5check_version".
loaded symbol "H5open".
loaded symbol "H5Screate_simple".
loaded symbol "H5Sclose".
loaded symbol "H5Acreate2".
loaded symbol "H5Awrite".
loaded symbol "H5Aclose".
loaded symbol "H5Tcopy".
loaded symbol "H5Tset_size".
loaded symbol "H5Tset_strpad".
loaded symbol "H5Gcreate2".
loaded symbol "H5Gclose".
loaded symbol "H5Dcreate2".
loaded symbol "H5Dclose".
loaded symbol "H5Dwrite".
loaded symbol "H5Pcreate".
loaded symbol "H5Pclose".
loaded symbol "H5Pset_link_creation_order".
loaded symbol "H5Pset_libver_bounds".
loaded symbol "H5Fcreate".
loaded symbol "H5Fflush".
loaded symbol "H5Fclose".
loaded symbol "H5Fstart_swmr_write".
loaded symbol "H5T_STD_I32LE_g".
loaded symbol "H5T_NATIVE_INT_g".
loaded symbol "H5T_IEEE_F64LE_g".
loaded symbol "H5T_NATIVE_DOUBLE_g".
loaded symbol "H5T_C_S1_g".
loaded symbol "H5P_CLS_FILE_CREATE_ID_g".
loaded symbol "H5P_CLS_FILE_ACCESS_ID_g".
loaded symbol "H5P_CLS_GROUP_CREATE_ID_g".
SSPbrick element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
SSPbrick element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
MPCO recorder - Written by ASDEA Software Technology: M.Petracca, G.Camata
ASDEA Software Technology: https://asdeasoft.net
STKO (Scientific ToolKit for OpenSees): https://asdeasoft.net/stko/
If you use this tool, please cite us:
Petracca, M., Candeloro, F., & Camata, G. (2017). "STKO user manual". ASDEA Software Technology, Pescara Italy.
SSPbrick element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
SSPbrick element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
SSPbrick element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
MPCO recorder - Written by ASDEA Software Technology: M.Petracca, G.Camata
ASDEA Software Technology: https://asdeasoft.net
STKO (Scientific ToolKit for OpenSees): https://asdeasoft.net/stko/
If you use this tool, please cite us:
Petracca, M., Candeloro, F., & Camata, G. (2017). "STKO user manual". ASDEA Software Technology, Pescara Italy.
SSPbrick element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington
MPCORecorder: done loading HDF5
loaded symbol "H5check_version".
loaded symbol "H5open".
loaded symbol "H5Screate_simple".
loaded symbol "H5Sclose".
loaded symbol "H5Acreate2".
loaded symbol "H5Awrite".
loaded symbol "H5Aclose".
loaded symbol "H5Tcopy".
loaded symbol "H5Tset_size".
loaded symbol "H5Tset_strpad".
loaded symbol "H5Gcreate2".
loaded symbol "H5Gclose".
loaded symbol "H5Dcreate2".
loaded symbol "H5Dclose".
loaded symbol "H5Dwrite".
loaded symbol "H5Pcreate".
loaded symbol "H5Pclose".
loaded symbol "H5Pset_link_creation_order".
loaded symbol "H5Pset_libver_bounds".
loaded symbol "H5Fcreate".
loaded symbol "H5Fflush".
loaded symbol "H5Fclose".
loaded symbol "H5Fstart_swmr_write".
loaded symbol "H5T_STD_I32LE_g".
loaded symbol "H5T_NATIVE_INT_g".
loaded symbol "H5T_IEEE_F64LE_g".
loaded symbol "H5T_NATIVE_DOUBLE_g".
loaded symbol "H5T_C_S1_g".
loaded symbol "H5P_CLS_FILE_CREATE_ID_g".
loaded symbol "H5P_CLS_FILE_ACCESS_ID_g".
loaded symbol "H5P_CLS_GROUP_CREATE_ID_g".
loading "hdf5.so" ...
MPCO recorder - Written by ASDEA Software Technology: M.Petracca, G.Camata
ASDEA Software Technology: https://asdeasoft.net
STKO (Scientific ToolKit for OpenSees): https://asdeasoft.net/stko/
If you use this tool, please cite us:
Petracca, M., Candeloro, F., & Camata, G. (2017). "STKO user manual". ASDEA Software Technology, Pescara Italy.
MPCO recorder - Written by ASDEA Software Technology: M.Petracca, G.Camata
ASDEA Software Technology: https://asdeasoft.net
STKO (Scientific ToolKit for OpenSees): https://asdeasoft.net/stko/
If you use this tool, please cite us:
Petracca, M., Candeloro, F., & Camata, G. (2017). "STKO user manual". ASDEA Software Technology, Pescara Italy.
loading "hdf5.so" ...
loading "hdf5.so" ...
MPCORecorder: done loading HDF5
loaded symbol "H5check_version".
loaded symbol "H5open".
loaded symbol "H5Screate_simple".
loaded symbol "H5Sclose".
loaded symbol "H5Acreate2".
loaded symbol "H5Awrite".
loaded symbol "H5Aclose".
loaded symbol "H5Tcopy".
loaded symbol "H5Tset_size".
loaded symbol "H5Tset_strpad".
loaded symbol "H5Gcreate2".
loaded symbol "H5Gclose".
loaded symbol "H5Dcreate2".
loaded symbol "H5Dclose".
loaded symbol "H5Dwrite".
loaded symbol "H5Pcreate".
loaded symbol "H5Pclose".
loaded symbol "H5Pset_link_creation_order".
loaded symbol "H5Pset_libver_bounds".
loaded symbol "H5Fcreate".
loaded symbol "H5Fflush".
loaded symbol "H5Fclose".
loaded symbol "H5Fstart_swmr_write".
loaded symbol "H5T_STD_I32LE_g".
loaded symbol "H5T_NATIVE_INT_g".
loaded symbol "H5T_IEEE_F64LE_g".
loaded symbol "H5T_NATIVE_DOUBLE_g".
loaded symbol "H5T_C_S1_g".
loaded symbol "H5P_CLS_FILE_CREATE_ID_g".
loaded symbol "H5P_CLS_FILE_ACCESS_ID_g".
loaded symbol "H5P_CLS_GROUP_CREATE_ID_g".
MPCORecorder: done loading HDF5
loaded symbol "H5check_version".
loaded symbol "H5open".
loaded symbol "H5Screate_simple".
loaded symbol "H5Sclose".
loaded symbol "H5Acreate2".
loaded symbol "H5Awrite".
loaded symbol "H5Aclose".
loaded symbol "H5Tcopy".
loaded symbol "H5Tset_size".
loaded symbol "H5Tset_strpad".
loaded symbol "H5Gcreate2".
loaded symbol "H5Gclose".
loaded symbol "H5Dcreate2".
loaded symbol "H5Dclose".
loaded symbol "H5Dwrite".
loaded symbol "H5Pcreate".
loaded symbol "H5Pclose".
loaded symbol "H5Pset_link_creation_order".
loaded symbol "H5Pset_libver_bounds".
loaded symbol "H5Fcreate".
loaded symbol "H5Fflush".
loaded symbol "H5Fclose".
loaded symbol "H5Fstart_swmr_write".
loaded symbol "H5T_STD_I32LE_g".
loaded symbol "H5T_NATIVE_INT_g".
loaded symbol "H5T_IEEE_F64LE_g".
loaded symbol "H5T_NATIVE_DOUBLE_g".
loaded symbol "H5T_C_S1_g".
loaded symbol "H5P_CLS_FILE_CREATE_ID_g".
loaded symbol "H5P_CLS_FILE_ACCESS_ID_g".
loaded symbol "H5P_CLS_GROUP_CREATE_ID_g".
MPCORecorder: done loading HDF5
loaded symbol "H5check_version".
loaded symbol "H5open".
loaded symbol "H5Screate_simple".
loaded symbol "H5Sclose".
loaded symbol "H5Acreate2".
loaded symbol "H5Awrite".
loaded symbol "H5Aclose".
loaded symbol "H5Tcopy".
loaded symbol "H5Tset_size".
loaded symbol "H5Tset_strpad".
loaded symbol "H5Gcreate2".
loaded symbol "H5Gclose".
loaded symbol "H5Dcreate2".
loaded symbol "H5Dclose".
loaded symbol "H5Dwrite".
loaded symbol "H5Pcreate".
loaded symbol "H5Pclose".
loaded symbol "H5Pset_link_creation_order".
loaded symbol "H5Pset_libver_bounds".
loaded symbol "H5Fcreate".
loaded symbol "H5Fflush".
loaded symbol "H5Fclose".
loaded symbol "H5Fstart_swmr_write".
loaded symbol "H5T_STD_I32LE_g".
loaded symbol "H5T_NATIVE_INT_g".
loaded symbol "H5T_IEEE_F64LE_g".
loaded symbol "H5T_NATIVE_DOUBLE_g".
loaded symbol "H5T_C_S1_g".
loaded symbol "H5P_CLS_FILE_CREATE_ID_g".
loaded symbol "H5P_CLS_FILE_ACCESS_ID_g".
loaded symbol "H5P_CLS_GROUP_CREATE_ID_g".
MPCO recorder - Written by ASDEA Software Technology: M.Petracca, G.Camata
ASDEA Software Technology: https://asdeasoft.net
STKO (Scientific ToolKit for OpenSees): https://asdeasoft.net/stko/
If you use this tool, please cite us:
Petracca, M., Candeloro, F., & Camata, G. (2017). "STKO user manual". ASDEA Software Technology, Pescara Italy.
loading "hdf5.so" ...
MPCORecorder: done loading HDF5
loaded symbol "H5check_version".
loaded symbol "H5open".
loaded symbol "H5Screate_simple".
loaded symbol "H5Sclose".
loaded symbol "H5Acreate2".
loaded symbol "H5Awrite".
loaded symbol "H5Aclose".
loaded symbol "H5Tcopy".
loaded symbol "H5Tset_size".
loaded symbol "H5Tset_strpad".
loaded symbol "H5Gcreate2".
loaded symbol "H5Gclose".
loaded symbol "H5Dcreate2".
loaded symbol "H5Dclose".
loaded symbol "H5Dwrite".
loaded symbol "H5Pcreate".
loaded symbol "H5Pclose".
loaded symbol "H5Pset_link_creation_order".
loaded symbol "H5Pset_libver_bounds".
loaded symbol "H5Fcreate".
loaded symbol "H5Fflush".
loaded symbol "H5Fclose".
loaded symbol "H5Fstart_swmr_write".
loaded symbol "H5T_STD_I32LE_g".
loaded symbol "H5T_NATIVE_INT_g".
loaded symbol "H5T_IEEE_F64LE_g".
loaded symbol "H5T_NATIVE_DOUBLE_g".
loaded symbol "H5T_C_S1_g".
loaded symbol "H5P_CLS_FILE_CREATE_ID_g".
loaded symbol "H5P_CLS_FILE_ACCESS_ID_g".
loaded symbol "H5P_CLS_GROUP_CREATE_ID_g".
MPCO recorder - Written by ASDEA Software Technology: M.Petracca, G.Camata
ASDEA Software Technology: https://asdeasoft.net
STKO (Scientific ToolKit for OpenSees): https://asdeasoft.net/stko/
If you use this tool, please cite us:
Petracca, M., Candeloro, F., & Camata, G. (2017). "STKO user manual". ASDEA Software Technology, Pescara Italy.
Increment: 1. time_increment = 0.005. Current time = 0.0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
Increment: 1 - Iterations: 1 - Norm: 2.37184163817385388424e-05 ( 50.0 % )
Increment: 2. time_increment = 0.005. Current time = 0.005
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
Increment: 2 - Iterations: 1 - Norm: 4.16758499447868516717e-04 ( 100.0 % )
Target time has been reached. Current time = 0.01
SUCCESS.
   RUNNING PARAMETRIC ANALYSIS 1 ...
   RUNNING PARAMETRIC ANALYSIS 1 ...
   RUNNING PARAMETRIC ANALYSIS 1 ...
   RUNNING PARAMETRIC ANALYSIS 1 ...
   RUNNING PARAMETRIC ANALYSIS 1 ...
   RUNNING PARAMETRIC ANALYSIS 1 ...
Increment: 1. time_increment = 0.005. Current time = 0.0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
Increment: 1 - Iterations: 1 - Norm: 2.37184163817385388424e-05 ( 50.0 % )
Increment: 2. time_increment = 0.005. Current time = 0.005
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
Increment: 2 - Iterations: 1 - Norm: 4.16758499447868516717e-04 ( 100.0 % )
Target time has been reached. Current time = 0.01
SUCCESS.
   RUNNING PARAMETRIC ANALYSIS 2 ...
   RUNNING PARAMETRIC ANALYSIS 2 ...
   RUNNING PARAMETRIC ANALYSIS 2 ...
   RUNNING PARAMETRIC ANALYSIS 2 ...
   RUNNING PARAMETRIC ANALYSIS 2 ...
   RUNNING PARAMETRIC ANALYSIS 2 ...
Increment: 1. time_increment = 0.005. Current time = 0.0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
Increment: 1 - Iterations: 1 - Norm: 2.37184163817385388424e-05 ( 50.0 % )
Increment: 2. time_increment = 0.005. Current time = 0.005
ID::resize() - size specified 0 <= 0
ID::resize() - size specified 0 <= 0
Increment: 2 - Iterations: 1 - Norm: 4.16758499451424211952e-04 ( 100.0 % )
Target time has been reached. Current time = 0.01
SUCCESS.
PARAMETRIC ANALYSIS LOOP FINISHED
ANALYSIS SUCCESSFULLY FINISHED
Process Terminating 0
PARAMETRIC ANALYSIS LOOP FINISHED
ANALYSIS SUCCESSFULLY FINISHED
Process Terminating 1
PARAMETRIC ANALYSIS LOOP FINISHED
ANALYSIS SUCCESSFULLY FINISHED
Process Terminating 2
PARAMETRIC ANALYSIS LOOP FINISHED
ANALYSIS SUCCESSFULLY FINISHED
Process Terminating 3
PARAMETRIC ANALYSIS LOOP FINISHED
ANALYSIS SUCCESSFULLY FINISHED
Process Terminating 4
PARAMETRIC ANALYSIS LOOP FINISHED
ANALYSIS SUCCESSFULLY FINISHED
Process Terminating 5
destroying lib handle: 0x7ffa49e10000 ... 0
destroying lib handle: 0x7ffa49e10000 ... 0
destroying lib handle: 0x7ffa49e10000 ... 0
destroying lib handle: 0x7ffa49e10000 ... 0
destroying lib handle: 0x7ffa49e10000 ... 0
destroying lib handle: 0x7ffa49e10000 ... 0
Premere un tasto per continuare . . .
And this is what I have in my folder using 6 processes:
Immagine 2020-10-27 152425.png
Immagine 2020-10-27 152425.png (60.35 KiB) Viewed 183 times

miran
Posts: 22
Joined: Wed Apr 29, 2020 7:15 pm

Re: Parameter study

Post by miran » Tue Oct 27, 2020 3:08 pm

Solved it! I thought I had deleted all the files from the analysis using the previous code in the analysis folder, but there were some files I neglected. When I deleted those files, the analyses ran as intended.

Thank you so much for the assistance with this, it will save me a ton of time in the future :D
Regards,

Miran Cemalovic
PhD Candidate
Department of Structural Engineering
Norwegian University of Science and Technology (NTNU)
NO-7491 Trondheim, Norway
https://www.ntnu.edu/employees/mirancem

miran
Posts: 22
Joined: Wed Apr 29, 2020 7:15 pm

Re: Parameter study

Post by miran » Fri Oct 30, 2020 9:31 am

Hi again,

I was a bit to quick to claim victory here.

The code block in your previous example works great for SP, but I cannot get it to work correctly with MP.

Using MP, the analyses are preformed, but the parametric timeSeries is not updated. In my model, I have also defined a parametric rayleigh, which in fact does get updated as far as I can tell.

If I have understood this correctly, this is what happens: When using MP, the STKO code calls upon definitions.tcl which contains the dummy definition of timeSeries several times after the dummy timeSeries is removed and redefined. In your original example model, this does not happen using SP.

fig_def.JPG
fig_def.JPG (33.98 KiB) Viewed 166 times

I have tried to work around this by adding the removal and redefinition of timeSeries just before the load is added, but I get an error that tells me that timeSeries with tag equal to 1 is not defined. I honestly do not understand why (?).

The next thing I tried was to simply empty definitions.tcl as shown below. This did not work either, producing the same error that tells me that timeSeries with tag equal to 1 is not defined.

fig_empty2.JPG
fig_empty2.JPG (11.51 KiB) Viewed 166 times
fig_empty.JPG
fig_empty.JPG (37.91 KiB) Viewed 166 times

Intuitively, the natural solution would be to add a custom script under "Definitions" that contains the code block for timeSeries and thus evaluates it correctly according to the STKO code, but I see that it is not possible to add a custom script under "Definitions" . As a side note, would you consider enabling a custom command in the entire Work Tree?

fig_bc.JPG
fig_bc.JPG (24.12 KiB) Viewed 166 times

Do you have any suggestion on how to solve this? I have attached my model.
Attachments
pile_soil.zip
(3.21 MiB) Downloaded 5 times
Regards,

Miran Cemalovic
PhD Candidate
Department of Structural Engineering
Norwegian University of Science and Technology (NTNU)
NO-7491 Trondheim, Norway
https://www.ntnu.edu/employees/mirancem

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

Re: Parameter study

Post by STKO Team » Fri Oct 30, 2020 12:40 pm

replace this code in your BEGIN LOOP:

Code: Select all

puts "BEGIN PARAMETRIC ANALYSIS LOOP ..."

# I moved this on top, because we need it to write the definitions.tcl file only
# on process 0
set PID [getPID]

# declare 9 time series and rayleigh damping commands, 1 for each analysis
set time_series_list {\
	"timeSeries Trig 1 0.0 1.0 0.6283" \
	"timeSeries Trig 1 0.0 1.0 0.3142" \
	"timeSeries Trig 1 0.0 1.0 0.2094" \
	"timeSeries Trig 1 0.0 1.0 0.1571" \
	"timeSeries Trig 1 0.0 1.0 0.1257" \
	"timeSeries Trig 1 0.0 1.0 0.1047" \
	"timeSeries Trig 1 0.0 1.0 0.0898" \
	"timeSeries Trig 1 0.0 1.0 0.0785" \
	"timeSeries Trig 1 0.0 1.0 0.0698" \
}

set rayleigh_list {\
	"rayleigh 0.83333 0.00167 0 0" \
	"rayleigh 1.66667 0.00083 0 0" \
	"rayleigh 2.50000 0.00056 0 0" \
	"rayleigh 3.33333 0.00042 0 0" \
	"rayleigh 4.16667 0.00033 0 0" \
	"rayleigh 5.00000 0.00028 0 0" \
	"rayleigh 5.83333 0.00024 0 0" \
	"rayleigh 6.66667 0.00021 0 0" \
	"rayleigh 7.50000 0.00019 0 0" \
}

# open the TCL for loop
for {set i 0} {$i < 3} {incr i} {

puts "   RUNNING PARAMETRIC ANALYSIS $i ..."
# in this first part of the foor-loop body we can setup some variables
# for the i-th analyis

# since the previous loop iteration called wipe, we need to re-source
# what STKO sources in main.tcl before the analysis_step.tcl
# this first "model" command should be written by you, then if the model changes due to other
# elements required other ndf, STKO already takes care of doing it in the other sourced tcl files.
if {$i > 0} {
	model basic -ndm 3 -ndf 6
	# source definitions
	source definitions.tcl
	# source materials
	source materials.tcl
	# source sections
	source sections.tcl
	# source node
	source nodes.tcl
	# source element
	source elements.tcl
}


#set f [open "definitions.tcl" "a+"]
#chan truncate $f 0

# TIME SERIES IS PARAMETRIC:
# first remove the dummy timeSeries 1 in "defintions.tcl", it was there
# just to reference it in the loadPatterns. now we need to overwrite it...
remove timeSeries 1
# create the i-th time series evaluating the i-th timeseries command string
set ith_time_series [lindex $time_series_list $i]
#eval $ith_time_series
#NOTE:
# do not evaluate it manually here. Since OpenSees removes (internally) all time series
# whenever we change the model builder (and STKO needs to do it when the ndm changes, for example in this file
# when adding the LK boundaries (3D-3DOFs) while the initial model was (3D-6DOFs)).
# for this reason STKO re-source the definitions.tcl file everytime the model changes, to properly re-apply all
# time series defined by the user.
# however, with your approach, the re-sourcing of the original definitions.tcl file will re-apply the dummy timeseries.
# All you need to do, is to write your new command in the definitions.tcl file!
if {$PID == 0} {
	set def_file [open "definitions.tcl" "w"]
	puts $def_file $ith_time_series
	close $def_file
}
barrier
source definitions.tcl
# from now on, everytime STKO re-source it, it will contain the exact time series for this loop iteration!

# DAMPING IS PARAMETRIC:
# damping is not yet defined, so we just have to define rayleigh damping
# to match the hamrmonic load frecuency evaluated in each loop.
# create the i-th rayleigh evaluating the i-th rayleigh command string
set ith_rayleigh [lindex $rayleigh_list $i]
eval $ith_rayleigh

# RECORDER IS PARAMETRIC:
# create the param_id variable that will be in the name of the recorder
set param_id $i

# this is a trick... when STKO writes the mpco recorder command, it also writes
# a support *.mpco.cdata file with the same name of the recorder. However in STKO the 
# recorder name has a suffix = $param_id, that will be evaluated by TCL when creating the
# *.mpco file, but not at the time STKO writes the *.mpco.cdata file. So we can
# simply copy the one created by STKO and rename it accordingly.

# this is the name STKO gave it... make sure to use the escape character before the $ char!!
set STKO_file_name "PARAM_RESULT_\$param_id.part-$PID.mpco.cdata"
# this is the new name, DON'T use the escape character, to the param_id will be eval by TCL!
set current_file_name "PARAM_RESULT_$param_id.part-$PID.mpco.cdata"
file copy -force $STKO_file_name $current_file_name

# here STKO will put all the other Analysi Steps...
# ==================================================================================




miran
Posts: 22
Joined: Wed Apr 29, 2020 7:15 pm

Re: Parameter study

Post by miran » Mon Nov 02, 2020 12:51 pm

Now it works perfectly! Thanks again!
Regards,

Miran Cemalovic
PhD Candidate
Department of Structural Engineering
Norwegian University of Science and Technology (NTNU)
NO-7491 Trondheim, Norway
https://www.ntnu.edu/employees/mirancem

Post Reply