Hi
I have a structure and an earthquake record.
I want to analyze my structure under two intensities of earthquake (i=1,2), the first analysis should be done on the first processor (processor id =0) and the second one should be done on the second processor (processor id = 1) simultaneously.
here is my code:
set np [getNP]
set pid [getPID]
set count 0
for {set i 1} {$i<=2} {incr i 1} {
if {[expr $num % $np]==$pid} {
*modelScript*
*gravityAnalysis*
set ScaleFactor [expr $i]
set accelx "Series -dt $dt -filePath earthquake.txt -factor [expr $ScaleFactor*$g]"
pattern UniformExcitation 1 1 -accel $accelx
*dynamicAnalysis*
}
incr count 1
}
command for start running in the
mpiexec -np 2 OpenSeesMP code.tcl
But it seems that both processors are running with the same intensity and results are equal.
what is the problem?
Thanks.
IDA Analysis Using OpenSeesMP
Moderator: selimgunay
Re: IDA Analysis Using OpenSeesMP
Hi samansadeghii,
It seems that you have an error in your script. You have given your counter the name of `count`, but when assigning the pid, you used:
``` if {[expr $num % $np]==$pid} { ```
You should change it to:
``` if {[expr $count % $np]==$pid} { ```
This should solve the problem. I could also suggest using a foreach structure (rather than for) similar to this:
```
set Scalefactors {1 2}
foreach Scalefactor $Scalefactors {
if {[expr $count % $np] == $pid} {
# modelScript
# gravityAnalysis
set accelx "Series -dt $dt -filePath earthquake.txt -factor [expr $ScaleFactor*$g]"
pattern UniformExcitation 1 1 -accel $accelx
# dynamicAnalysis
}
incr count 1
}
```
I think it has the advantage of being easier to read, you can reduce the lines of code (you don't have to set Scalefactor within the loop) and it will be easier to add scalefactors if you decide to in the future.
Hope this can help,
James
It seems that you have an error in your script. You have given your counter the name of `count`, but when assigning the pid, you used:
``` if {[expr $num % $np]==$pid} { ```
You should change it to:
``` if {[expr $count % $np]==$pid} { ```
This should solve the problem. I could also suggest using a foreach structure (rather than for) similar to this:
```
set Scalefactors {1 2}
foreach Scalefactor $Scalefactors {
if {[expr $count % $np] == $pid} {
# modelScript
# gravityAnalysis
set accelx "Series -dt $dt -filePath earthquake.txt -factor [expr $ScaleFactor*$g]"
pattern UniformExcitation 1 1 -accel $accelx
# dynamicAnalysis
}
incr count 1
}
```
I think it has the advantage of being easier to read, you can reduce the lines of code (you don't have to set Scalefactor within the loop) and it will be easier to add scalefactors if you decide to in the future.
Hope this can help,
James