Skip to content

Commit

Permalink
Merge pull request #127 from JustinBonus/master
Browse files Browse the repository at this point in the history
Update for GitHub release Sep 30th, 2024, V4
  • Loading branch information
fmckenna authored Oct 1, 2024
2 parents c25f518 + 40a4fe6 commit 83be287
Show file tree
Hide file tree
Showing 21 changed files with 4,646 additions and 59 deletions.
37 changes: 37 additions & 0 deletions EDP/Frame9Model.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#units kip, in

# variable parameter
pset w 2200.0
pset k 1600.0


# constants
set g 386.1;
set b 1800.
set d 1800.
set h 1440.
set numStory 9
set bW 20000.0; # building Weight

# derived parameters
set sH [expr $h/(1.*$numStory)]; # story Height
set fM [expr $w/$g]; # floor translational mass
set sM 1.0e-3; # floor rotational mass

# build model
model Basic -ndm 3 -ndf 6
node 1 0. 0. 0.
fix 1 1 1 1 1 1 1
set E 29000.
set A 1e4
set I [expr $k*$sH*$sH*$sH/(12.*$E)]
geomTransf Linear 1 0 1 0
set G 1e4
set J 1e8

for {set i 1; set j 2} {$i <= $numStory} {incr i 1; incr j 1} {
node $j 0. 0. [expr $i*$sH] -mass $fM $fM $fM $sM $sM $sM
fix $j 0 0 1 1 1 0
element elasticBeamColumn $i $i $j $A $E $G $J $I $I 1
}

78 changes: 51 additions & 27 deletions EDP/HydroEDP_Selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <StandardWindEDP.h>
#include <StandardEarthquakeEDP.h>
#include "EDP/StandardHydroEDP.h"
#include "EDP/StandardTsunamiEDP.h"
#include "EDP/StandardStormSurgeEDP.h"
// #include "EDP/StandardTsunamiEDP.h"
// #include "EDP/StandardStormSurgeEDP.h"
#include "SurrogateEDP.h"
#include <UserDefinedEDP.h>


Expand All @@ -90,8 +91,9 @@ HydroEDP_Selection::HydroEDP_Selection(QWidget *parent)
edpSelection->addItem(tr("Standard Earthquake"));
edpSelection->addItem(tr("Standard Wind"));
edpSelection->addItem(tr("Standard Hydro"));
edpSelection->addItem(tr("Standard Tsunami"));
edpSelection->addItem(tr("Standard Storm Surge"));
// edpSelection->addItem(tr("Standard Tsunami"));
// edpSelection->addItem(tr("Standard Storm Surge"));
edpSelection->addItem(tr("None (only for surrogate)"));
edpSelection->addItem(tr("User Defined"));
edpSelection->setObjectName("EDPSelectionComboBox");

Expand All @@ -100,9 +102,10 @@ HydroEDP_Selection::HydroEDP_Selection(QWidget *parent)
edpSelection->setItemData(1, "Common earthquake engineering demand parameters (EDPs).", Qt::ToolTipRole);
edpSelection->setItemData(2, "Common wind engineering demand parameters (EDPs).", Qt::ToolTipRole);
edpSelection->setItemData(3, "Common hydrodynamic engineering demand parameters (EDPs).", Qt::ToolTipRole);
edpSelection->setItemData(4, "A tsunami event with measurement of established tsunami demand parameters (EDPs) for coastal structures (e.g. residential, commercial).", Qt::ToolTipRole);
edpSelection->setItemData(5, "A hurricane storm surge event with measurement of established hydrodynamic storm surge demand parameters (EDPs) for affected structures (e.g. residential, commercial).", Qt::ToolTipRole);
edpSelection->setItemData(6, "User-defined selection of engineering demand parameters (EDPs) for custom workflows.", Qt::ToolTipRole);
// edpSelection->setItemData(4, "A tsunami event with measurement of established tsunami demand parameters (EDPs) for coastal structures (e.g. residential, commercial).", Qt::ToolTipRole);
// edpSelection->setItemData(5, "A hurricane storm surge event with measurement of established hydrodynamic storm surge demand parameters (EDPs) for affected structures (e.g. residential, commercial).", Qt::ToolTipRole);
edpSelection->setItemData(4, "No EDPs will be generated, only surrogate data will be used.", Qt::ToolTipRole);
edpSelection->setItemData(5, "User-defined selection of engineering demand parameters (EDPs) for custom workflows.", Qt::ToolTipRole);
theSelectionLayout->addWidget(label);
theSelectionLayout->addWidget(edpSelection);
theSelectionLayout->addStretch();
Expand All @@ -122,21 +125,32 @@ HydroEDP_Selection::HydroEDP_Selection(QWidget *parent)
theStandardEarthquakeEDPs = new StandardEarthquakeEDP();
theStandardWindEDPs = new StandardWindEDP();
theStandardHydroEDPs = new StandardHydroEDP();
theStandardTsunamiEDPs = new StandardTsunamiEDP();
theStandardStormSurgeEDPs = new StandardStormSurgeEDP();
// theStandardTsunamiEDPs = new StandardTsunamiEDP();
// theStandardStormSurgeEDPs = new StandardStormSurgeEDP();
// theSurrogateEDPs = new SurrogateEDP();
theUserDefinedEDPs = new UserDefinedEDP();

theStackedWidget->addWidget(theStandardEDPs);
theStackedWidget->addWidget(theStandardEarthquakeEDPs);
theStackedWidget->addWidget(theStandardWindEDPs);
theStackedWidget->addWidget(theStandardHydroEDPs);
theStackedWidget->addWidget(theStandardTsunamiEDPs);
theStackedWidget->addWidget(theStandardStormSurgeEDPs);
// theStackedWidget->addWidget(theStandardTsunamiEDPs);
// theStackedWidget->addWidget(theStandardStormSurgeEDPs);
theStackedWidget->addWidget(theUserDefinedEDPs);
theStackedWidget->setCurrentIndex(0);

SurrogateEDP * theSurrogateEDPs_tmp = SurrogateEDP::getInstance();
theSurrogateEDPs = theSurrogateEDPs_tmp;

connect(theSurrogateEDPs_tmp, &SurrogateEDP::surrogateSelected, [=](){
edpSelection->setCurrentIndex(4);
});
theStackedWidget->addWidget(theSurrogateEDPs);


layout->addWidget(theStackedWidget);
this->setLayout(layout);

theStackedWidget->setCurrentIndex(0);
theCurrentEDP=theStandardEDPs;

connect(edpSelection, SIGNAL(currentIndexChanged(QString)), this,
Expand Down Expand Up @@ -191,17 +205,23 @@ void HydroEDP_Selection::edpSelectionChanged(const QString &arg1)
theCurrentEDP = theStandardHydroEDPs;
}

else if(arg1 == "Standard Tsunami" || arg1 == "StandardTsunamiEDP") {
// else if(arg1 == "Standard Tsunami" || arg1 == "StandardTsunamiEDP") {
// theStackedWidget->setCurrentIndex(4);
// theCurrentEDP = theStandardTsunamiEDPs;
// }

// else if(arg1 == "Standard Storm Surge" || arg1 == "StandardStormSurgeEDP") {
// theStackedWidget->setCurrentIndex(5);
// theCurrentEDP = theStandardStormSurgeEDPs;
// }

else if (arg1 == "None (only for surrogate)" || arg1 == "SurrogateEDP") {
theStackedWidget->setCurrentIndex(4);
theCurrentEDP = theStandardTsunamiEDPs;
theCurrentEDP = theSurrogateEDPs;
}

else if(arg1 == "Standard Storm Surge" || arg1 == "StandardStormSurgeEDP") {
theStackedWidget->setCurrentIndex(5);
theCurrentEDP = theStandardStormSurgeEDPs;
}
else if(arg1 == "User Defined" || arg1 == "UserDefinedEDP") {
theStackedWidget->setCurrentIndex(6);
theStackedWidget->setCurrentIndex(5);
theCurrentEDP = theUserDefinedEDPs;
}
else {
Expand Down Expand Up @@ -253,17 +273,21 @@ HydroEDP_Selection::inputAppDataFromJSON(QJsonObject &jsonObject)
(type == QString("StandardHydroEDP")) || (type == QString("Standard Hydro"))) {
index = 3;
}
else if ((type == QString("StandardTsunamiEDP")) ||
(type == QString("Standard Tsunami EDPs")) || (type == QString("Standard Tsunami"))) {
// else if ((type == QString("StandardTsunamiEDP")) ||
// (type == QString("Standard Tsunami EDPs")) || (type == QString("Standard Tsunami"))) {
// index = 4;
// }
// else if ((type == QString("StandardStormSurgeEDP")) ||
// (type == QString("Standard Storm Surge EDPs") || (type == QString("Standard Storm Surge")))) {
// index = 5;
// }
else if ((type == QString("SurrogateEDP")) ||
(type == QString("Surrogate EDPs")) || (type == QString("Surrogate")) || (type == QString("None (only for surrogate)"))) {
index = 4;
}
else if ((type == QString("StandardStormSurgeEDP")) ||
(type == QString("Standard Storm Surge EDPs") || (type == QString("Standard Storm Surge")))) {
index = 5;
}
}
else if ((type == QString("UserDefinedEDP")) ||
(type == QString("User Defined EDPs")) || (type == QString("User Defined"))) {
index = 6;
index = 5;
}
else {
errorMessage("HydroEDP_Selection - no valid type found");
Expand Down
8 changes: 5 additions & 3 deletions EDP/HydroEDP_Selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ class QStackedWidget;
// class StandardWindEDP;
// class StandardEarthquakeEDP;
// class StandardEDP;
// #include <SurrogateEDP.h>
// class UserDefinedEDP;
class UserDefinedApplication;

//class RandomVariablesContainer;

class HydroEDP_Selection : public SimCenterAppWidget
Expand Down Expand Up @@ -90,10 +92,10 @@ public slots:
SimCenterAppWidget *theStandardEarthquakeEDPs;
SimCenterAppWidget *theStandardWindEDPs;
SimCenterAppWidget *theStandardHydroEDPs;
SimCenterAppWidget *theStandardTsunamiEDPs;
SimCenterAppWidget *theStandardStormSurgeEDPs;
// SimCenterAppWidget *theStandardTsunamiEDPs;
// SimCenterAppWidget *theStandardStormSurgeEDPs;
SimCenterAppWidget *theSurrogateEDPs;
SimCenterAppWidget *theUserDefinedEDPs;

//RandomVariablesContainer *theRandomVariables;
};

Expand Down
93 changes: 70 additions & 23 deletions EDP/StandardHydroEDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

#include <RandomVariablesContainer.h>
// #include <InputWidgetParameters.h>
#include "SimCenterPreferences.h"
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QProcess>
#include <QString>
#include <QStringList>
#include <QTextStream>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>

#include <QStackedWidget>
#include <QComboBox>

#include <QLineEdit>

#include <cstring>
#include <vector>
Expand All @@ -63,6 +79,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <sstream>
#include <fstream>
#include <iostream>

using namespace std;
#include <QGridLayout>

Expand All @@ -86,10 +103,15 @@ StandardHydroEDP::StandardHydroEDP(QWidget *parent)
QGridLayout *scriptLayout = new QGridLayout();

// add stuff to enter Additional Input
QLabel *labelAI = new QLabel("Additional Input");
QLabel *labelAI = new QLabel("Additional Input / Recorder Script");
additionalInputLE = new QLineEdit;
// Set the background text to (Optional)
additionalInputLE->setPlaceholderText("(Optional)");
additionalInputLE->setPlaceholderText("(Optional. Check-in HydroUQ/Examples/EDP for example additional input scripts, e.g. OpenSees recorder tcl scripts.)");

QFileInfo fileAI(SimCenterPreferences::getInstance()->getAppDir() + QDir::separator() + "Examples" + QDir::separator() + "EDP" + QDir::separator() + "StandardHydroEDP_FrameRecorder.tcl");
additionalInputLE->setText(fileAI.absoluteFilePath());
additionalInputLE->setReadOnly(true);
additionalInputLE->setToolTip("This file is used to set-up the recorders / sensors / probes in the output of the structural response simulation, FEM, after the UQ workflow completes. Often it is a tcl script that contains the OpenSees recorder commands.");

QPushButton *chooseAdditionalInputButton = new QPushButton();
chooseAdditionalInputButton->setText(tr("Choose"));
Expand All @@ -99,11 +121,15 @@ StandardHydroEDP::StandardHydroEDP(QWidget *parent)
scriptLayout->addWidget(chooseAdditionalInputButton, 0, 4);

// add stuff to enter processing script
QLabel *labelPS = new QLabel("Processing Script");
QLabel *labelPS = new QLabel("Post-Processing / EDP Extractor Script");
processingScriptLE = new QLineEdit;
processingScriptLE->setText("StandardHydroEDP_PostProcess.py");
// Set the background text to (Optional)
processingScriptLE->setPlaceholderText("(Required. Check-in HydroUQ/Examples/EDP for example post-processing scripts, e.g. OpenSees post-processing tcl scripts.)");

QFileInfo fileLE(SimCenterPreferences::getInstance()->getAppDir() + QDir::separator() + "Examples" + QDir::separator() + "EDP" + QDir::separator() + "StandardHydroEDP_FramePost.tcl");
processingScriptLE->setText(fileLE.absoluteFilePath());
processingScriptLE->setReadOnly(true);
processingScriptLE->setToolTip("This script is used to process the output of the event simulation, EVT, to extract the Engineering Demand Parameters (EDPs) into a results.out file.");
processingScriptLE->setToolTip("This script is used to process the output of the structural response simulation, FEM, to extract the Engineering Demand Parameters (EDPs) into a file for analysis, results.out, after the UQ workflow completes.");


QPushButton *chooseProcessingScriptButton = new QPushButton();
Expand Down Expand Up @@ -179,30 +205,47 @@ StandardHydroEDP::StandardHydroEDP(QWidget *parent)
edp->setLayout(edpLayout);
edpLayout->addStretch();
// make QStrings for EDP input
QString edp1 = "max_force"; // max force on the structure or component
QString edp2 = "max_pressure"; // max pressure on the structure or component
QString edp3 = "total_impulse"; // total impulse on the structure or component, integral of force-time series

QString edp1 = "peak-floor-displacement_1_1";
// QString edp2 = "peak-interstory-drift";
QString edp3 = "peak-floor-acceleration_1_1";
// QString edp4 = "root-mean-square-acceleration";
QString edp5 = "peak-floor-force_1_1"; // max force on the structure or component
QString edp6 = "peak-floor-pressure_1_1"; // max pressure on the structure or component

// QString edp1 = "Disp";
// QString edp2 = "RMSA";
// QString edp3 = "Force";
// QString edp4 = "Pressure";

// QString edp7 = "total_floor_impulse"; // total impulse on the structure or component, integral of force-time series
// QString edp10 = "max_interstory_drift"; // interstory drift, i.e. max relative displacement of floor n+1 vs floor n...
// QString edp11 = "max_roof_drift"; // roof drift, i.e. max relative displacement of top floor to ground

// QString edp1 = "max_force"; // max force on the structure or component
// QString edp2 = "max_pressure"; // max pressure on the structure or component
// QString edp3 = "total_impulse"; // total impulse on the structure or component, integral of force-time series
// QString edp10 = "max_interstory_drift"; // interstory drift, i.e. max relative displacement of floor n+1 vs floor n...
// QString edp11 = "max_roof_drift"; // roof drift, i.e. max relative displacement of top floor to ground
// QString edp4 = "max_wave_velocity"; // max wave velocity at a characteristic location near the structure
// QString edp5 = "max_wave_height"; // max wave elevation at a characteristic location near the structure
// QString edp6 = "average_wave_velocity"; // average wave elevation at a characteristic location near the structure
// QString edp7 = "average_wave_height"; // average wave elevation at a characteristic location near the structure
// QString edp8 = "total_wave_duration"; // wave duration based on exceeding a threshold of some variable at a characteristic location near the structure
// QString edp9 = "total_wave_momentum_flux"; // wave momentum flux based at a characteristic location near the structure
QString edp10 = "max_interstory_drift"; // interstory drift, i.e. max relative displacement of floor n+1 vs floor n...
QString edp11 = "max_roof_drift"; // roof drift, i.e. max relative displacement of top floor to ground
// QString edp12 = "max_abs_acceleration"; // absolute maximum of acceleration
// QString edp13 = "max_rel_disp"; // floor relative displacement

this->addEDP(edp1);
this->addEDP(edp2);
// this->addEDP(edp2);
this->addEDP(edp3);
// this->addEDP(edp4);
// this->addEDP(edp5);
// this->addEDP(edp6);
// this->addEDP(edp4);
this->addEDP(edp5);
this->addEDP(edp6);
// this->addEDP(edp7);
// this->addEDP(edp8);
this->addEDP(edp10);
this->addEDP(edp11);
// this->addEDP(edp10);
// this->addEDP(edp11);

sa->setWidget(edp);
layout->addWidget(sa);
Expand Down Expand Up @@ -282,12 +325,14 @@ StandardHydroEDP::outputToJSON(QJsonObject &jsonObject)
QFileInfo fileInfoPS(fileName);
if (fileInfoPS.exists()) {

jsonObject["fileNameAI"]= fileInfoPS.fileName();
jsonObject["filePathAI"]=fileInfoPS.path();
jsonObject["fileNameAI"] = fileInfoPS.fileName();
jsonObject["filePathAI"] = fileInfoPS.path();

} else {
this->errorMessage("StandardHydroEDP :: additional script does not exist");
}
} else {
this->errorMessage("StandardHydroEDP :: no additional script");
}


Expand Down Expand Up @@ -336,11 +381,11 @@ StandardHydroEDP::inputFromJSON(QJsonObject &jsonObject)
processingScriptLE->setText(QDir(filePath).filePath(fileName));

} else {
this->errorMessage("StandardHydroEDP ::inputFromJSON no filePathPS exists");
this->errorMessage("StandardHydroEDP ::inputFromJSON no filefilePathPS exists");
}

} else {
this->errorMessage("StandardHydroEDP ::inputFromJSON no NamePS exists");
this->errorMessage("StandardHydroEDP ::inputFromJSON no fileNamePS exists");
}

if (jsonObject.contains("fileNameAI")) {
Expand All @@ -356,8 +401,10 @@ StandardHydroEDP::inputFromJSON(QJsonObject &jsonObject)
} else {
this->errorMessage("StandardHydroEDP ::inputFromJSON no filePathAI exists");
}
}

} else {
this->errorMessage("StandardHydroEDP ::inputFromJSON no fileNameAI exists");
}


if (jsonObject.contains("EDP")) {
Expand Down Expand Up @@ -430,15 +477,15 @@ StandardHydroEDP::copyFiles(QString &dirName) {
}
}
else {
this->errorMessage(QString("ERROR: copyFiles: no processing script"));
this->errorMessage(QString("ERROR: copyFiles: failed to copy post-procesing script in EDP tab:") + filename);
return false;
}

filename = additionalInputLE->text();
if (!filename.isEmpty()) {

if (this->copyFile(filename, dirName) == false) {
this->errorMessage(QString("ERROR: copyFiles: failed to copy") + filename);
this->errorMessage(QString("ERROR: copyFiles: failed to copy additional input script in EDP tab:") + filename);
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion EDP/StandardHydroEDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <QVector>
#include <QGridLayout>
#include <QComboBox>

class QLineEdit;
class EDP;
// class InputWidgetParameters;

Expand Down
Loading

0 comments on commit 83be287

Please sign in to comment.