@@ -241,7 +241,8 @@ OpenSeesPreprocessor::processSections(ofstream &s) {
241241}
242242
243243int
244- OpenSeesPreprocessor::processNodes (ofstream &s){
244+ OpenSeesPreprocessor::processNodes (ofstream &s)
245+ {
245246
246247 int index;
247248 json_t *node;
@@ -325,7 +326,8 @@ OpenSeesPreprocessor::processNodes(ofstream &s){
325326}
326327
327328int
328- OpenSeesPreprocessor::processElements (ofstream &s){
329+ OpenSeesPreprocessor::processElements (ofstream &s)
330+ {
329331
330332 int index;
331333 json_t *element;
@@ -434,12 +436,21 @@ OpenSeesPreprocessor::processDamping(ofstream &s){
434436*/
435437
436438int
437- OpenSeesPreprocessor::processDamping (ofstream &s){
439+ OpenSeesPreprocessor::processDamping (ofstream &s) {
438440
439441 //
440442 // determine dampingRatio .. should be in SAM, use SIM if not there
441443 //
442-
444+ json_t *useDamping = json_object_get (rootSAM," useDamping" );
445+ if (useDamping != NULL && json_is_true (useDamping) == false ) {
446+ s << " # Damping not used in this analysis\n " ;
447+ return -1 ;
448+ } else {
449+ s << " # Damping used in this analysis\n " ;
450+ }
451+
452+
453+
443454 // get ratio from SAM, either mainbody or in Properties
444455 json_t *dampingT = json_object_get (rootSAM," dampingRatio" );
445456 if (dampingT == NULL ) {
@@ -933,17 +944,27 @@ OpenSeesPreprocessor::processEvents(ofstream &s){
933944 s << " analysis " << json_string_value (json_object_get (rootSIM," analysis" )) << " \n " ;
934945
935946
936- processDamping (s);
937-
938-
947+ int useDamping = processDamping (s);
948+
949+ if (useDamping == 0 ) {
950+ s << " set lambda1 [lindex $lambdaN 0]\n "
951+ << " set T1 [expr 2*3.14159/$lambda1]\n "
952+ << " set dTana [expr $T1/20.]\n "
953+ << " if {$dt < $dTana} {set dTana $dt}\n " ;
954+ s << " analyze [expr int($numStep*$dt/$dTana)] $dTana \n " ;
955+ s << " remove recorders \n " ;
956+ }
957+ else if (useDamping == -1 ) {
958+ // damping not used
959+ s << " analyze $numStep $dt \n " ;
960+ s << " remove recorders \n " ;
961+ } else {
962+ // not supported
963+ std::cerr << " OpenSeesPreprocessor - damping model not supported.\n " ;
964+ return -1 ;
965+ }
939966
940967 // s << "set lambdaN [eigen 1];\n"
941- s << " set lambda1 [lindex $lambdaN 0]\n "
942- << " set T1 [expr 2*3.14159/$lambda1]\n "
943- << " set dTana [expr $T1/20.]\n "
944- << " if {$dt < $dTana} {set dTana $dt}\n " ;
945- s << " analyze [expr int($numStep*$dt/$dTana)] $dTana \n " ;
946- s << " remove recorders \n " ;
947968 }
948969 }
949970
@@ -957,7 +978,9 @@ OpenSeesPreprocessor::processEvents(ofstream &s){
957978 edpList.end (); ++itEDP) {
958979 s << " " << *itEDP;
959980 }
960- s << " ]\n puts $output\n }\n call_python \n " ;
981+ s << " ]\n puts $output\n }" ;
982+ // remove calling python inside tcl since it broke the mpi
983+ // "\nset pid [getPID]\nif {$pid==0} {call_python} \nbarrier\n";
961984
962985 } else if (strstr (postprocessingScript, " .tcl" ) != NULL ) {
963986
@@ -993,6 +1016,63 @@ OpenSeesPreprocessor::processEvent(ofstream &s,
9931016 const char *eventType = json_string_value (json_object_get (event," type" ));
9941017 // std::cerr << "Processing Event type: " << eventType << "\n";
9951018
1019+ if (strcmp (eventType," DRM" ) == 0 ) {
1020+ const char *eventName = json_string_value (json_object_get (event," name" ));
1021+ std::string eventPath = json_string_value (json_object_get (event," filePath" ));
1022+ double factor = json_number_value (json_object_get (event," factor" ));
1023+ double crdScale = json_number_value (json_object_get (event," crd_scale" ));
1024+ double distanceTolerance = json_number_value (json_object_get (event," distance_tolerance" ));
1025+ int doCoordinateTransformation = json_integer_value (json_object_get (event," do_coordinate_transformation" ));
1026+ double T00 = json_number_value (json_object_get (event," T00" ));
1027+ double T01 = json_number_value (json_object_get (event," T01" ));
1028+ double T02 = json_number_value (json_object_get (event," T02" ));
1029+ double T10 = json_number_value (json_object_get (event," T10" ));
1030+ double T11 = json_number_value (json_object_get (event," T11" ));
1031+ double T12 = json_number_value (json_object_get (event," T12" ));
1032+ double T20 = json_number_value (json_object_get (event," T20" ));
1033+ double T21 = json_number_value (json_object_get (event," T21" ));
1034+ double T22 = json_number_value (json_object_get (event," T22" ));
1035+ double x00 = json_number_value (json_object_get (event," x00" ));
1036+ double x01 = json_number_value (json_object_get (event," x01" ));
1037+ double x02 = json_number_value (json_object_get (event," x02" ));
1038+ const char *system = json_string_value (json_object_get (event," system" ));
1039+ double numSteps = json_integer_value (json_object_get (event," numSteps" ));
1040+ double dT = json_number_value (json_object_get (event," dT" ));
1041+
1042+
1043+
1044+ if (strcmp (system," Remote" ) == 0 ||
1045+ strcmp (system," remote" ) == 0 ||
1046+ strcmp (system," REMOTE" ) == 0 ||
1047+ strcmp (system," DesignSafe" ) == 0 ||
1048+ strcmp (system," designsafe" ) == 0 ||
1049+ strcmp (system," DESIGNSAFE" ) == 0 )
1050+ {
1051+ // make the eventPath ..
1052+ eventPath = " ../" ;
1053+ }
1054+
1055+
1056+ // print out the DRM event
1057+ s << " #set maxPatternTag [getMaxPatternTag]\n " ;
1058+ s << " set maxPatternTag 1000;\n " ;
1059+ s << " set patternTag [expr $maxPatternTag + 1]\n " ;
1060+ // pattern H5DRM $patternTag "/path/to/H5DRM/dataset" $factor $crd_scale $distance_tolerance $do_coordinate_transformation $T00 $T01 $T02 $T10 $T11 $T12 $T20 $T21 $T22 $x00 $x01 $x02
1061+ s << " pattern H5DRM $patternTag \" " << eventPath << " \" " << " " << factor << " "
1062+ << crdScale << " " << distanceTolerance << " " << doCoordinateTransformation << " "
1063+ << T00 << " " << T01 << " " << T02 << " "
1064+ << T10 << " " << T11 << " " << T12 << " "
1065+ << T20 << " " << T21 << " " << T22 << " "
1066+ << x00 << " " << x01 << " " << x02 << " \n " ;
1067+ s << " set DRM_NAME \" " << eventName << " \"\n " ;
1068+ s << " set numStep " << numSteps << " \n " ;
1069+ s << " set dt " << dT << " \n " ;
1070+ analysisType = 1 ;
1071+ }
1072+
1073+
1074+
1075+
9961076 if (strcmp (eventType," Seismic" ) == 0 ||
9971077 strcmp (eventType," Wind" ) == 0 ||
9981078 strcmp (eventType," timeHistory" ) == 0 ||
0 commit comments