Skip to content

Commit

Permalink
Merge pull request #134 from JustinBonus/master
Browse files Browse the repository at this point in the history
Update ClaymoreUW MPM,  FOAMySees, and StochasticWaves front-ends
  • Loading branch information
fmckenna authored Jan 10, 2025
2 parents 4dcb51a + 2fbc5b1 commit 9d43ff4
Show file tree
Hide file tree
Showing 46 changed files with 16,458 additions and 2,452 deletions.
6 changes: 3 additions & 3 deletions EVENTS/HydroEventSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
//*********************************************************************************

enum class Event_b : bool {
GeoClawOpenFOAM_b = false,
WaveDigitalFlume_b = false,
GeoClawOpenFOAM_b = true,
WaveDigitalFlume_b = true,
CoupledDigitalTwin_b = true,
ClaymoreUW_b = true,
BasicClaymoreUW_b = true,
BasicClaymoreUW_b = false,
TaichiEvent_b = true,
CelerisTaichiEvent_b = true,
StochasticWaves_b = true,
Expand Down
103 changes: 46 additions & 57 deletions EVENTS/MPM/AlgorithmMPM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ AlgorithmMPM::AlgorithmMPM(QWidget *parent)
int maxWidth = 1280;

QStringList numericalMethodList; numericalMethodList << "particles" << "meshes";
numericalMethod = new SC_ComboBox("NumericalMethod", numericalMethodList);
numericalMethod = new SC_ComboBox("type", numericalMethodList);
layout->addWidget(new QLabel("Numerical Form"),numRow, 0, 1, 1, Qt::AlignRight);
layout->addWidget(numericalMethod, numRow++, 1, 1, 2);
layout->itemAt(layout->count()-1)->widget()->setMaximumWidth(maxWidth);
Expand Down Expand Up @@ -94,22 +94,22 @@ AlgorithmMPM::AlgorithmMPM(QWidget *parent)

ASFLIPGroupBox->setVisible(true);

ASFLIP_alpha = new SC_DoubleLineEdit("alpha", 0.0);
ASFLIP_alpha = new SC_DoubleLineEdit("ASFLIP_alpha", 0.0);
ASFLIPLayout->addWidget(new QLabel("Velocity Ratio, A"),numBodyRow, 0, 1, 1, Qt::AlignRight);
ASFLIPLayout->addWidget(ASFLIP_alpha, numBodyRow, 1, 1, 2);
ASFLIPLayout->itemAt(ASFLIPLayout->count()-1)->widget()->setMaximumWidth(maxWidth);
ASFLIPLayout->addWidget(new QLabel("[0, 1]"),numBodyRow++, 3, 1, 1);
for (int i=0; i<3; ++i) ASFLIPLayout->itemAt(ASFLIPLayout->count()-(1+i))->widget()->setToolTip("ASFLIP advection ratio, alpha. Mixes PIC particle velocity (damped) with FLIP velocity (noisey) to balance stability and advection accuracy. Value of zero is no advection, value of one is full advection. For stiff simulations, the range of 0.0 to 0.9 is generally recommended. See Bonus 2023 (Dissertation), Chapter 5, and Fei et al. 2021 (ASFLIP Paper) for more details.");

// ASFLIPLayout->addToolTip("alpha = 0.5 is a good starting point.");
ASFLIP_betaMin = new SC_DoubleLineEdit("beta_min", 0.0);
ASFLIP_betaMin = new SC_DoubleLineEdit("ASFLIP_beta_min", 0.0);
ASFLIPLayout->addWidget(new QLabel("Min. Position Ratio, b"),numBodyRow, 0, 1, 1, Qt::AlignRight);
ASFLIPLayout->addWidget(ASFLIP_betaMin, numBodyRow, 1, 1, 2);
ASFLIPLayout->itemAt(ASFLIPLayout->count()-1)->widget()->setMaximumWidth(maxWidth);
ASFLIPLayout->addWidget(new QLabel("[0, min(1,B)]"),numBodyRow++, 3, 1, 1);
for (int i=0; i<3; ++i) ASFLIPLayout->itemAt(ASFLIPLayout->count()-(1+i))->widget()->setToolTip("ASFLIP advection position ratio maximum, Max(Beta). Upper-bound for the linear mix of PIC particle position (damped) with FLIP position (noisey) to balance stability, advection accuracy. Further, partially decouples particle motion from the filtered, sticky MPM grid when a condition is met (e.g. 2 percent volumetric tension on a near-surface particle). Can significantly improve contact between material bodies that are separating or sliding. Value of zero reverts to MPM's sticky contact, value of one fully applies PIC-FLIP velocity modes (throttled by velocity ratio, alpha) on individual particles to their position update. For material bodies that may need non-sticky contact, the range of 0.0 to 0.05 is reasonable but caution is recommended as there is a high-risk for instabilities and penetratative impacts. See Bonus 2023 (Dissertation), Chapter 5, and Fei et al. 2021 (ASFLIP Paper) for more details.");

ASFLIP_betaMax = new SC_DoubleLineEdit("beta_max", 0.0);
ASFLIP_betaMax = new SC_DoubleLineEdit("ASFLIP_beta_max", 0.0);
ASFLIPLayout->addWidget(new QLabel("Max. Position Ratio, B"),numBodyRow, 0, 1, 1, Qt::AlignRight);
ASFLIPLayout->addWidget(ASFLIP_betaMax, numBodyRow, 1, 1, 2);
ASFLIPLayout->itemAt(ASFLIPLayout->count()-1)->widget()->setMaximumWidth(maxWidth);
Expand All @@ -129,7 +129,7 @@ AlgorithmMPM::AlgorithmMPM(QWidget *parent)
FBARGroupBox->setVisible(true);


FBAR_psi = new SC_DoubleLineEdit("FBAR_ratio", 0.0);
FBAR_psi = new SC_DoubleLineEdit("FBAR_psi", 0.0);
FBARLayout->addWidget(new QLabel("Antilocking Ratio"),numBodyRow, 0, 1, 1, Qt::AlignRight);
FBARLayout->addWidget(FBAR_psi, numBodyRow, 1, 1, 2);
FBARLayout->itemAt(FBARLayout->count()-1)->widget()->setMaximumWidth(maxWidth);
Expand Down Expand Up @@ -255,16 +255,20 @@ AlgorithmMPM::~AlgorithmMPM()

void AlgorithmMPM::clear(void)
{
// theOpenSeesPyScript->clear();
// theSurfaceFile->clear();
numericalMethod->setCurrentIndex(0);
particlesPerCell->clear();
useASFLIP->setChecked(true);
useFBAR->setChecked(true);
ASFLIP_alpha->clear();
ASFLIP_betaMin->clear();
ASFLIP_betaMax->clear();
FBAR_psi->clear();
useFBAR_fusedG2P2G->setChecked(true);
}

bool
AlgorithmMPM::outputToJSON(QJsonObject &jsonObject)
{
// theOpenSeesPyScript->outputToJSON(jsonObject);
// theSurfaceFile->outputToJSON(jsonObject);

// Note: ClaymoreUW will also need these defined in the JSON model/body object, not just the nested JSON partition/device object
// Future schema
QJsonObject algorithmObject;
Expand All @@ -278,70 +282,55 @@ AlgorithmMPM::outputToJSON(QJsonObject &jsonObject)
algorithmObject["ASFLIP_beta_max"] = ASFLIP_betaMax->text().toDouble();
algorithmObject["FBAR_psi"] = FBAR_psi->text().toDouble();
jsonObject["algorithm"] = algorithmObject;

// ClaymoreUW artifacts, Global algorithm settings. TODO: Deprecate
// jsonObject["type"] = numericalMethod->currentText();
// jsonObject["ppc"] = particlesPerCell->text().toDouble();
// jsonObject["use_ASFLIP"] = useASFLIP->isChecked();
// jsonObject["use_FBAR"] = useFBAR->isChecked();
// jsonObject["FBAR_fused_kernel"] = useFBAR_fusedG2P2G->isChecked(); // TODO: Rename
// jsonObject["alpha"] = ASFLIP_alpha->text().toDouble(); // TODO: Rename
// jsonObject["beta_min"] = ASFLIP_betaMin->text().toDouble(); // TODO: Rename
// jsonObject["beta_max"] = ASFLIP_betaMax->text().toDouble(); // TODO: Rename
// jsonObject["FBAR_ratio"] = FBAR_psi->text().toDouble(); // TODO: Rename?

return true;
}

bool
AlgorithmMPM::inputFromJSON(QJsonObject &jsonObject)
{

this->clear(); // Clear all bodies


if (jsonObject.contains("algorithm")) {
QJsonObject algorithmObject = jsonObject["algorithm"].toObject();
if (algorithmObject.contains("type")) {
QString type = algorithmObject["type"].toString();
int index = numericalMethod->findText(type);
if (index != -1) {
numericalMethod->setCurrentIndex(index);
}
}
if (algorithmObject.contains("ppc")) {
particlesPerCell->setText(QString::number(algorithmObject["ppc"].toDouble()));
}
if (algorithmObject.contains("use_ASFLIP")) {
useASFLIP->setChecked(algorithmObject["use_ASFLIP"].toBool());
}
if (algorithmObject.contains("use_FBAR")) {
useFBAR->setChecked(algorithmObject["use_FBAR"].toBool());
}
if (algorithmObject.contains("FBAR_fused_kernel")) {
useFBAR_fusedG2P2G->setChecked(algorithmObject["FBAR_fused_kernel"].toBool());
}
if (algorithmObject.contains("ASFLIP_alpha")) {
ASFLIP_alpha->setText(QString::number(algorithmObject["ASFLIP_alpha"].toDouble()));
}
if (algorithmObject.contains("ASFLIP_beta_min")) {
ASFLIP_betaMin->setText(QString::number(algorithmObject["ASFLIP_beta_min"].toDouble()));
}
if (algorithmObject.contains("ASFLIP_beta_max")) {
ASFLIP_betaMax->setText(QString::number(algorithmObject["ASFLIP_beta_max"].toDouble()));
}
if (algorithmObject.contains("FBAR_psi")) {
FBAR_psi->setText(QString::number(algorithmObject["FBAR_psi"].toDouble()));
if (jsonObject.contains("type")) {
QString type = jsonObject["type"].toString();
int index = numericalMethod->findText(type);
if (index != -1) {
numericalMethod->setCurrentIndex(index);
}
}
if (jsonObject.contains("ppc")) {
particlesPerCell->setText(QString::number(jsonObject["ppc"].toDouble()));
}
if (jsonObject.contains("use_ASFLIP")) {
useASFLIP->setChecked(jsonObject["use_ASFLIP"].toBool());
}
if (jsonObject.contains("use_FBAR")) {
useFBAR->setChecked(jsonObject["use_FBAR"].toBool());
}
if (jsonObject.contains("FBAR_fused_kernel")) {
useFBAR_fusedG2P2G->setChecked(jsonObject["FBAR_fused_kernel"].toBool());
}
if (jsonObject.contains("ASFLIP_alpha")) {
ASFLIP_alpha->setText(QString::number(jsonObject["ASFLIP_alpha"].toDouble()));
}
if (jsonObject.contains("ASFLIP_beta_min")) {
ASFLIP_betaMin->setText(QString::number(jsonObject["ASFLIP_beta_min"].toDouble()));
}
if (jsonObject.contains("ASFLIP_beta_max")) {
ASFLIP_betaMax->setText(QString::number(jsonObject["ASFLIP_beta_max"].toDouble()));
}
if (jsonObject.contains("FBAR_psi")) {
FBAR_psi->setText(QString::number(jsonObject["FBAR_psi"].toDouble()));
}

return true;
}

bool
AlgorithmMPM::copyFiles(QString &destDir)
{
// if (theOpenSeesPyScript->copyFile(destDir) != true)
// return false;
// return theSurfaceFile->copyFile(destDir);
Q_UNUSED(destDir);
return true;
}

Expand Down
Loading

0 comments on commit 9d43ff4

Please sign in to comment.