From 1c95618c060bbf24ae8826de42db59925fca95ed Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:34:54 -0700 Subject: [PATCH 01/11] abs - updating example file for CI --- Examples/qfem-0006/src/input.json | 50 ++++++++++++++++++------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/Examples/qfem-0006/src/input.json b/Examples/qfem-0006/src/input.json index 5c51c5d2..0c76c2be 100644 --- a/Examples/qfem-0006/src/input.json +++ b/Examples/qfem-0006/src/input.json @@ -1,8 +1,10 @@ { - "UQ": { - "calibrationMethodData": { - "calibrationDataFile": "{Current_Dir}/minimumValue.txt", - "convergenceTol": 1e-10, + "UQ": + { + "calibrationMethodData": + { + "calibrationDataFile": "{Current_Dir}/minimumValue.txt", + "convergenceTol": 1E-10, "factors": "", "maxIterations": 50, "method": "NL2SOL" @@ -10,7 +12,8 @@ "uqEngine": "Dakota", "uqType": "Parameters Estimation" }, - "randomVariables": [ + "randomVariables": + [ { "distribution": "ContinuousDesign", "initialpoint": 0, @@ -34,27 +37,34 @@ "variableClass": "Design" } ], - "FEM":{ - }, - "EDP": [ + "FEM": + {}, + "EDP": + [ { "name": "f" } ], "$schema": "https://raw.githubusercontent.com/NHERI-SimCenter/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSeesPy", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "Rosen.py", - "parametersScript": "RosenParams.py", - "PA_Path": "{Current_Dir}/" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "Rosen.py", + "parametersScript": "RosenParams.py", + "PA_Path": "{Current_Dir}/", + "postprocessScript": "" + } + } } -} +} \ No newline at end of file From 72824e3dfdc1a41e7e493a040bd8c23e068df6f4 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:19:21 -0700 Subject: [PATCH 02/11] abs - updating example files for CI --- Examples/qfem-0001/src/input.json | 51 +++-- Examples/qfem-0002/src/input.json | 46 ++-- Examples/qfem-0003/src/input.json | 48 ++-- Examples/qfem-0004/src/input.json | 45 ++-- Examples/qfem-0005/src/input.json | 44 ++-- Examples/qfem-0007/src/input.json | 43 ++-- Examples/qfem-0008/src/input.json | 43 ++-- Examples/qfem-0009/src/input.json | 51 +++-- Examples/qfem-0010/src/input.json | 45 ++-- Examples/qfem-0014/src/input.json | 38 ++-- Examples/qfem-0015/src/input.json | 38 ++-- Examples/qfem-0016/src/input.json | 34 +-- Examples/qfem-0017/src/input.json | 40 ++-- Examples/qfem-0018/src/input.json | 57 +++-- Examples/qfem-0019/src/input.json | 40 ++-- Examples/qfem-0021/src/input.json | 37 +-- Examples/qfem-0022/src/input.json | 37 +-- Examples/qfem-0023/src/input.json | 38 ++-- Examples/qfem-0024/src/inputs.json | 50 +++-- Examples/qfem-0025/src/input.json | 37 +-- Examples/qfem-0026/src/input.json | 45 ++-- Examples/qfem-0027/src/input.json | 50 +++-- Examples/qfem-0028/src/input.json | 41 ++-- Examples/qfem-0029/src/input.json | 346 +++++++++++++++++++++++++++++ 24 files changed, 951 insertions(+), 393 deletions(-) create mode 100644 Examples/qfem-0029/src/input.json diff --git a/Examples/qfem-0001/src/input.json b/Examples/qfem-0001/src/input.json index b48759a9..f45172e7 100644 --- a/Examples/qfem-0001/src/input.json +++ b/Examples/qfem-0001/src/input.json @@ -1,6 +1,8 @@ { - "UQ": { - "samplingMethodData": { + "UQ": + { + "samplingMethodData": + { "method": "LHS", "samples": 50, "seed": 949 @@ -8,9 +10,10 @@ "uqEngine": "Dakota", "uqType": "Forward Propagation" }, - "FEM": { - }, - "EDP": [ + "FEM": + {}, + "EDP": + [ { "name": "Node_3_Disp_2" }, @@ -18,14 +21,15 @@ "name": "Node_2_Disp_2" } ], - "randomVariables": [ + "randomVariables": + [ { "name": "E", "title": "elastic modulus", - "distribution": "Lognormal", + "distribution": "Lognormal", "refCount": 1, "mean": 205.0, - "stdDev": 15.0, + "stdDev": 15.0, "value": "RV.E", "variableClass": "Uncertain" }, @@ -35,7 +39,7 @@ "distribution": "Normal", "mean": 25.0, "refCount": 1, - "stdDev": 3.0, + "stdDev": 3.0, "value": "RV.P", "variableClass": "Uncertain" }, @@ -61,19 +65,24 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "TrussModel.tcl", - "postprocessScript": "TrussPost.tcl", - "PS_Path": "{Current_Dir}/" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "TrussModel.tcl", + "postprocessScript": "", + "PS_Path": "{Current_Dir}/" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0002/src/input.json b/Examples/qfem-0002/src/input.json index d4cfb546..782e3c3f 100644 --- a/Examples/qfem-0002/src/input.json +++ b/Examples/qfem-0002/src/input.json @@ -1,8 +1,10 @@ { - "FEM": { - }, - "UQ": { - "samplingMethodData": { + "FEM": + {}, + "UQ": + { + "samplingMethodData": + { "method": "LHS", "samples": 200, "seed": 949 @@ -10,7 +12,8 @@ "uqEngine": "Dakota", "uqType": "Forward Propagation" }, - "EDP": [ + "EDP": + [ { "name": "Node_3_Disp_2" }, @@ -18,7 +21,8 @@ "name": "Node_2_Disp_2" } ], - "randomVariables": [ + "randomVariables": + [ { "name": "E", "title": "elastic modulus", @@ -63,19 +67,25 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSeesPy", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "TrussModel.py", - "parametersScript": "TrussParams.py", - "PA_Path": "{Current_Dir}/" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "TrussModel.py", + "parametersScript": "TrussParams.py", + "PA_Path": "{Current_Dir}/", + "postprocessScript": "" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0003/src/input.json b/Examples/qfem-0003/src/input.json index 7e2ee8ed..8a30e48b 100644 --- a/Examples/qfem-0003/src/input.json +++ b/Examples/qfem-0003/src/input.json @@ -1,12 +1,15 @@ { - "UQ": { - "reliabilityMethodData": { + "UQ": + { + "reliabilityMethodData": + { "integrationMethod": "Second Order", "levelType": "Probability Levels", "localMethod": "Most Probable Point", "method": "Local Reliability", "mpp_Method": "no_approx", - "probabilityLevel": [ + "probabilityLevel": + [ 0.02, 0.2, 0.4, @@ -18,14 +21,16 @@ "uqEngine": "Dakota", "uqType": "Reliability Analysis" }, - "FEM": { - }, - "EDP": [ + "FEM": + {}, + "EDP": + [ { "name": "Node_3_Disp_2" } ], - "randomVariables": [ + "randomVariables": + [ { "name": "E", "title": "elastic modulus", @@ -70,19 +75,24 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "TrussModel.tcl", - "postprocessScript": "TrussPost.tcl", - "PS_Path": "{Current_Dir}/" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "TrussModel.tcl", + "postprocessScript": "TrussPost.tcl", + "PS_Path": "{Current_Dir}/" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0004/src/input.json b/Examples/qfem-0004/src/input.json index 5f3e5d48..08abd803 100644 --- a/Examples/qfem-0004/src/input.json +++ b/Examples/qfem-0004/src/input.json @@ -1,6 +1,8 @@ { - "UQ": { - "samplingMethodData": { + "UQ": + { + "samplingMethodData": + { "method": "LHS", "samples": 1000, "seed": 175 @@ -8,9 +10,10 @@ "uqEngine": "Dakota", "uqType": "Sensitivity Analysis" }, - "FEM": { - }, - "EDP": [ + "FEM": + {}, + "EDP": + [ { "name": "Node_3_Disp_2" }, @@ -18,7 +21,8 @@ "name": "Node_2_Disp_2" } ], - "randomVariables": [ + "randomVariables": + [ { "name": "E", "title": "elastic modulus", @@ -63,19 +67,24 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "TrussModel.tcl", - "postprocessScript": "TrussPost.tcl", - "PS_Path": "{Current_Dir}/" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "TrussModel.tcl", + "postprocessScript": "TrussPost.tcl", + "PS_Path": "{Current_Dir}/" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0005/src/input.json b/Examples/qfem-0005/src/input.json index 4a9d4365..11ca2595 100644 --- a/Examples/qfem-0005/src/input.json +++ b/Examples/qfem-0005/src/input.json @@ -1,6 +1,8 @@ { - "UQ": { - "samplingMethodData": { + "UQ": + { + "samplingMethodData": + { "method": "LHS", "samples": 200, "seed": 949 @@ -8,14 +10,16 @@ "uqEngine": "Dakota", "uqType": "Forward Propagation" }, - "FEM":{ - }, - "EDP": [ + "FEM": + {}, + "EDP": + [ { "name": "f" } ], - "randomVariables": [ + "randomVariables": + [ { "name": "X", "title": "first variable", @@ -38,19 +42,25 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSeesPy", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "rosenbrock.py", - "parametersScript": "params.py", - "PA_Path": "{Current_Dir}/" - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "rosenbrock.py", + "parametersScript": "params.py", + "PA_Path": "{Current_Dir}/", + "postprocessScript": "" + } } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0007/src/input.json b/Examples/qfem-0007/src/input.json index 105469f2..11f41c08 100644 --- a/Examples/qfem-0007/src/input.json +++ b/Examples/qfem-0007/src/input.json @@ -1,16 +1,19 @@ { - "UQ": { - "calibrationMethodData": { - "convergenceTol": 1e-10, + "UQ": + { + "calibrationMethodData": + { + "convergenceTol": 1E-10, "factors": "", "maxIterations": 1000, "method": "NL2SOL", - "calibrationDataFile": "{Current_Dir}/eigData.csv" + "calibrationDataFile": "{Current_Dir}/eigData.csv" }, "uqEngine": "Dakota", "uqType": "Parameters Estimation" }, - "randomVariables": [ + "randomVariables": + [ { "name": "Ic1", "distribution": "ContinuousDesign", @@ -34,7 +37,8 @@ "variableClass": "Design" } ], - "EDP": [ + "EDP": + [ { "name": "lambda" }, @@ -43,18 +47,23 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "fem.tcl", - "postprocessScript": "" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "fem.tcl", + "postprocessScript": "" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0008/src/input.json b/Examples/qfem-0008/src/input.json index 71aa7e86..13f57e6d 100644 --- a/Examples/qfem-0008/src/input.json +++ b/Examples/qfem-0008/src/input.json @@ -1,19 +1,22 @@ { - "UQ": { - "bayesianCalibrationMethodData": { + "UQ": + { + "bayesianCalibrationMethodData": + { "burnInSamples": 0, - "calibrationDataFile": "{Current_Dir}/eigData.csv", + "calibrationDataFile": "{Current_Dir}/eigData.csv", "chainSamples": 100, "chains": 4, "jumpStep": 5, "method": "DREAM", "seed": 107 }, - "parallelExecution": true, + "parallelExecution": true, "uqEngine": "Dakota", "uqType": "Inverse Problem" }, - "randomVariables": [ + "randomVariables": + [ { "name": "Ic1", "distribution": "Uniform", @@ -35,7 +38,8 @@ "variableClass": "Uncertain" } ], - "EDP": [ + "EDP": + [ { "name": "lambda" }, @@ -44,18 +48,23 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "fem.tcl", - "postprocessScript": "" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "fem.tcl", + "postprocessScript": "" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0009/src/input.json b/Examples/qfem-0009/src/input.json index 6cebde80..4bc39364 100644 --- a/Examples/qfem-0009/src/input.json +++ b/Examples/qfem-0009/src/input.json @@ -1,21 +1,26 @@ { - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "SimCenter-UQ", - "ApplicationData": { - } + "ApplicationData": + {} }, - "FEM":{ - "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "TrussModel.tcl", - "postprocessScript": "TrussPost.tcl", - "PS_Path": "{Current_Dir}/" - } - } + "FEM": + { + "Application": "OpenSees", + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "TrussModel.tcl", + "postprocessScript": "TrussPost.tcl", + "PS_Path": "{Current_Dir}/" + } + } }, - "EDP": [ + "EDP": + [ { "name": "Node_3_Disp_2" }, @@ -23,8 +28,10 @@ "name": "Node_2_Disp_2" } ], - "UQ": { - "samplingMethodData": { + "UQ": + { + "samplingMethodData": + { "method": "Monte Carlo", "samples": 500, "seed": 536 @@ -32,7 +39,8 @@ "uqEngine": "SimCenter-UQ", "uqType": "Sensitivity Analysis" }, - "correlationMatrix": [ + "correlationMatrix": + [ 1, 0, 0, @@ -50,11 +58,12 @@ 0.5, 1 ], - "FEM":{ - }, + "FEM": + {}, "localAppDir": "", "python": "", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Weibull", "inputType": "Parameters", @@ -98,4 +107,4 @@ "variableClass": "Uncertain" } ] -} +} \ No newline at end of file diff --git a/Examples/qfem-0010/src/input.json b/Examples/qfem-0010/src/input.json index 53f5e0de..bed5b7aa 100644 --- a/Examples/qfem-0010/src/input.json +++ b/Examples/qfem-0010/src/input.json @@ -1,6 +1,8 @@ { - "UQ": { - "samplingMethodData": { + "UQ": + { + "samplingMethodData": + { "method": "LHS", "samples": 200, "seed": 949 @@ -8,9 +10,10 @@ "uqEngine": "Dakota", "uqType": "Forward Propagation" }, - "FEM":{ - }, - "EDP": [ + "FEM": + {}, + "EDP": + [ { "name": "Node_3_Disp_2" }, @@ -18,7 +21,8 @@ "name": "Node_2_Disp_2" } ], - "randomVariables": [ + "randomVariables": + [ { "name": "E", "title": "elastic modulus", @@ -63,19 +67,24 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "FEAPpv", - "ApplicationData": { - "inputFile": "TrussTemplate.txt", - "IF_Path": "{Current_Dir}/", - "postprocessScript": "postprocess.py", - "PS_Path": "{Current_Dir}/" - } - } + "ApplicationData": + { + "inputFile": "TrussTemplate.txt", + "IF_Path": "{Current_Dir}/", + "postprocessScript": "postprocess.py", + "PS_Path": "{Current_Dir}/" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0014/src/input.json b/Examples/qfem-0014/src/input.json index 157718c8..6aa290e2 100644 --- a/Examples/qfem-0014/src/input.json +++ b/Examples/qfem-0014/src/input.json @@ -1,19 +1,25 @@ { - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "UCSD-UQ", - "ApplicationData": { - } + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "model.tcl" - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "model.tcl", + "postprocessScript": "" + } } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "lambda", @@ -25,7 +31,8 @@ "type": "scalar" } ], - "UQ": { + "UQ": + { "calDataFile": "eigData.csv", "calDataFilePath": "{Current_Dir}/.", "logLikelihoodFile": "", @@ -37,7 +44,8 @@ }, "localAppDir": "/Users/aakash/SimCenter/quoFEM/backend", "python": "/Users/aakash/.pyenv/shims/python", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -60,7 +68,7 @@ } ], "remoteAppDir": "/home1/00477/tg457427/SimCenterBackendApplications/v2.3.0", - "uqResults": { - }, + "uqResults": + {}, "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0015/src/input.json b/Examples/qfem-0015/src/input.json index 513bcb9f..a05bf47e 100644 --- a/Examples/qfem-0015/src/input.json +++ b/Examples/qfem-0015/src/input.json @@ -1,8 +1,11 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSeesPy", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/.", "PA_Path": "{Current_Dir}/.", "mainScript": "CWH.py", @@ -10,13 +13,15 @@ "postprocessScript": "" } }, - "UQ": { + "UQ": + { "Application": "SimCenter-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "InterstoryDrift_x", @@ -28,10 +33,12 @@ "type": "scalar" } ], - "FEM": { - }, - "UQ": { - "surrogateMethodInfo": { + "FEM": + {}, + "UQ": + { + "surrogateMethodInfo": + { "DoEmethod": "None", "accuracyLimit": 0.02, "advancedOpt": true, @@ -55,7 +62,8 @@ }, "isSurrogate": false, "localAppDir": "C:/Users/SimCenter/Sangri/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -200,7 +208,7 @@ "remoteAppDir": "C:/Users/SimCenter/Sangri/SimCenterBackendApplications", "resultType": "SimCenterUQResultsSampling", "runType": "runningLocal", - "summary": [ - ], + "summary": + [], "workingDir": "C:/Users/SimCenter/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0016/src/input.json b/Examples/qfem-0016/src/input.json index d168d9c8..29b0bffa 100644 --- a/Examples/qfem-0016/src/input.json +++ b/Examples/qfem-0016/src/input.json @@ -1,21 +1,26 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/", "PS_Path": "{Current_Dir}/", "mainScript": "ShearBuilding_NL.tcl", "postprocessScript": "postprocess.tcl" } }, - "UQ": { + "UQ": + { "Application": "SimCenter-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "Node_2_Disp_1_Mean", @@ -27,10 +32,12 @@ "type": "scalar" } ], - "FEM": { - }, - "UQ": { - "surrogateMethodInfo": { + "FEM": + {}, + "UQ": + { + "surrogateMethodInfo": + { "DoEmethod": "None", "accuracyLimit": 0.02, "advancedOpt": true, @@ -54,7 +61,8 @@ }, "isSurrogate": true, "localAppDir": "C:/Users/SimCenter/Sangri/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -110,4 +118,4 @@ "resultType": "SimCenterUQResultsSurrogate", "runType": "runningLocal", "workingDir": "C:/Users/SimCenter/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0017/src/input.json b/Examples/qfem-0017/src/input.json index e5988bce..ffb1e8be 100644 --- a/Examples/qfem-0017/src/input.json +++ b/Examples/qfem-0017/src/input.json @@ -1,37 +1,45 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/.", "PS_Path": "{Current_Dir}/.", "mainScript": "TrussModel.tcl", "postprocessScript": "TrussPost.tcl" } }, - "UQ": { + "UQ": + { "Application": "Custom-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "Node_3_Disp_2", "type": "scalar" } ], - "FEM": { - }, - "UQ": { + "FEM": + {}, + "UQ": + { "Config File": "{Current_Dir}/UQpySimpleExample.json", - "Parameters": [ + "Parameters": + [ { "name": "Sampling Method", "type": "ComboBox", "value": "MCS", - "values": [ + "values": + [ "MCS" ] }, @@ -67,7 +75,8 @@ } ] }, - "correlationMatrix": [ + "correlationMatrix": + [ 1, 0, 0, @@ -86,7 +95,8 @@ 1 ], "localAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -132,4 +142,4 @@ "runDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir/tmp.SimCenter", "runType": "runningLocal", "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0018/src/input.json b/Examples/qfem-0018/src/input.json index 47f10e22..94f253b6 100644 --- a/Examples/qfem-0018/src/input.json +++ b/Examples/qfem-0018/src/input.json @@ -1,29 +1,37 @@ { - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": { - } + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "matTestAllParamsReadStrain.tcl" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "matTestAllParamsReadStrain.tcl", + "postprocessScript": "" + } + } }, - "EDP": [ + "EDP": + [ { "length": 342, "name": "stress", "type": "field" } ], - "FEM":{ - }, - "UQ": { - "calibrationMethodData": { + "FEM": + {}, + "UQ": + { + "calibrationMethodData": + { "calibrationDataFile": "{Current_Dir}/calDataField.csv", "convergenceTol": 0.0001, "factors": "", @@ -36,7 +44,8 @@ }, "localAppDir": "/Users/aakash/SimCenter/quoFEM/backend", "python": "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3", - "randomVariables": [ + "randomVariables": + [ { "distribution": "ContinuousDesign", "initialpoint": 500, @@ -63,7 +72,7 @@ "distribution": "ContinuousDesign", "initialpoint": 0.5, "inputType": "Parameters", - "lowerbound": 1e-6, + "lowerbound": 0.000001, "name": "b", "refCount": 0, "upperbound": 1, @@ -74,7 +83,7 @@ "distribution": "ContinuousDesign", "initialpoint": 1, "inputType": "Parameters", - "lowerbound": 1e-6, + "lowerbound": 0.000001, "name": "cR1", "refCount": 0, "upperbound": 2, @@ -85,7 +94,7 @@ "distribution": "ContinuousDesign", "initialpoint": 1, "inputType": "Parameters", - "lowerbound": 1e-6, + "lowerbound": 0.000001, "name": "cR2", "refCount": 0, "upperbound": 2, @@ -96,7 +105,7 @@ "distribution": "ContinuousDesign", "initialpoint": 0.25, "inputType": "Parameters", - "lowerbound": 1e-6, + "lowerbound": 0.000001, "name": "a1", "refCount": 0, "upperbound": 0.5, @@ -107,7 +116,7 @@ "distribution": "ContinuousDesign", "initialpoint": 0.25, "inputType": "Parameters", - "lowerbound": 1e-6, + "lowerbound": 0.000001, "name": "a3", "refCount": 0, "upperbound": 0.5, @@ -116,7 +125,7 @@ } ], "remoteAppDir": "/home1/00477/tg457427/SimCenterBackendApplications/v2.3.0", - "uqResults": { - }, + "uqResults": + {}, "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0019/src/input.json b/Examples/qfem-0019/src/input.json index 6e302b9b..0e0141fd 100644 --- a/Examples/qfem-0019/src/input.json +++ b/Examples/qfem-0019/src/input.json @@ -1,26 +1,33 @@ { - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "UCSD-UQ", - "ApplicationData": { - } + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "matTestAllParamsReadStrain.tcl" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "matTestAllParamsReadStrain.tcl", + "postprocessScript": "" + } + } }, - "EDP": [ + "EDP": + [ { "length": 342, "name": "stress", "type": "field" } ], - "UQ": { + "UQ": + { "calDataFile": "calDataField.csv", "calDataFilePath": "{Current_Dir}/.", "logLikelihoodFile": "", @@ -32,7 +39,8 @@ }, "localAppDir": "/Users/aakash/SimCenter/quoFEM/backend", "python": "/Users/aakash/.pyenv/shims/python", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -105,7 +113,7 @@ } ], "remoteAppDir": "/home1/00477/tg457427/SimCenterBackendApplications/v2.3.0", - "uqResults": { - }, + "uqResults": + {}, "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0021/src/input.json b/Examples/qfem-0021/src/input.json index 589ddb70..cf830975 100644 --- a/Examples/qfem-0021/src/input.json +++ b/Examples/qfem-0021/src/input.json @@ -1,30 +1,37 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/.", "mainScript": "input_.tcl", "postprocessScript": "" } }, - "UQ": { + "UQ": + { "Application": "SimCenter-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "Node_3_Disp_2", "type": "scalar" } ], - "FEM": { - }, - "UQ": { - "surrogateMethodInfo": { + "FEM": + {}, + "UQ": + { + "surrogateMethodInfo": + { "DoEmethod": "IMSEw", "accuracyLimit": 0.02, "advancedOpt": true, @@ -46,14 +53,16 @@ "uqEngine": "SimCenterUQ", "uqType": "Train GP Surrogate Model" }, - "correlationMatrix": [ + "correlationMatrix": + [ 1, 0, 0, 1 ], "localAppDir": "C:/Users/SimCenter/Sangri/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -78,4 +87,4 @@ "remoteAppDir": "C:/Users/SimCenter/Sangri/SimCenterBackendApplications", "runType": "runningLocal", "workingDir": "C:/Users/SimCenter/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0022/src/input.json b/Examples/qfem-0022/src/input.json index ec88f5af..a1be2f7a 100644 --- a/Examples/qfem-0022/src/input.json +++ b/Examples/qfem-0022/src/input.json @@ -1,22 +1,27 @@ { "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/", "mainScript": "TrussModel.tcl", "postprocessScript": "TrussPost.tcl", "PS_Path": "{Current_Dir}/" } }, - "UQ": { + "UQ": + { "Application": "SimCenter-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "Node_3_Disp_2", @@ -28,10 +33,12 @@ "type": "scalar" } ], - "FEM": { - }, - "UQ": { - "surrogateMethodInfo": { + "FEM": + {}, + "UQ": + { + "surrogateMethodInfo": + { "advancedOpt": false, "inpFile": "PLoM_variables.csv", "method": "Sampling and Simulation", @@ -40,7 +47,8 @@ "outputData": true, "parallelExecution": false, "preTrained": false, - "samplingMethod": { + "samplingMethod": + { "method": "LHS", "samples": 50, "seed": 150 @@ -49,7 +57,8 @@ "uqEngine": "SimCenterUQ", "uqType": "PLoM Model" }, - "randomVariables": [ + "randomVariables": + [ { "distribution": "Lognormal", "inputType": "Moments", @@ -91,4 +100,4 @@ "variableClass": "Uncertain" } ] -} +} \ No newline at end of file diff --git a/Examples/qfem-0023/src/input.json b/Examples/qfem-0023/src/input.json index cd2cdb96..337a3554 100644 --- a/Examples/qfem-0023/src/input.json +++ b/Examples/qfem-0023/src/input.json @@ -1,35 +1,42 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/", "mainScript": "matTestAllParamsReadStrain.tcl", "postprocessScript": "" } }, - "UQ": { + "UQ": + { "Application": "SimCenter-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 342, "name": "stress", "type": "field" } ], - "FEM": { - }, - "UQ": { + "FEM": + {}, + "UQ": + { "PCAvarianceRatio": 0.99, "RVdataGroup": "", "RVsensitivityGroup": "", "advancedOptions": true, "performPCA": "Automatic", - "samplingMethodData": { + "samplingMethodData": + { "method": "Monte Carlo", "samples": 300, "seed": 487 @@ -39,7 +46,8 @@ }, "isSurrogate": false, "localAppDir": "", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -114,7 +122,7 @@ "remoteAppDir": "", "resultType": "SimCenterUQResultsSampling", "runType": "runningLocal", - "summary": [ - ], + "summary": + [], "workingDir": "" -} +} \ No newline at end of file diff --git a/Examples/qfem-0024/src/inputs.json b/Examples/qfem-0024/src/inputs.json index 0481254b..a49c52eb 100644 --- a/Examples/qfem-0024/src/inputs.json +++ b/Examples/qfem-0024/src/inputs.json @@ -1,18 +1,23 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "MultiModel", - "ApplicationData": { + "ApplicationData": + { "appKey": "FEM" } }, - "UQ": { + "UQ": + { "Application": "UCSD-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "lambda", @@ -24,34 +29,39 @@ "type": "scalar" } ], - "FEM": { + "FEM": + { "modelToRun": "RV.MultiModel-FEM", - "models": [ + "models": + [ { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/.", "mainScript": "model_1.tcl", "postprocessScript": "" }, "belief": 1, - "data": { - } + "data": + {} }, { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/.", "mainScript": "model_2.tcl", "postprocessScript": "" }, "belief": 1, - "data": { - } + "data": + {} } ] }, - "UQ": { + "UQ": + { "calDataFile": "eigData.csv", "calDataFilePath": "{Current_Dir}/.", "logLikelihoodFile": "", @@ -63,7 +73,8 @@ "seed": 0, "uqType": "Transitional Markov chain Monte Carlo" }, - "correlationMatrix": [ + "correlationMatrix": + [ 1, 0, 0, @@ -75,7 +86,8 @@ 1 ], "localAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -110,4 +122,4 @@ "remoteAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", "runType": "runningLocal", "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0025/src/input.json b/Examples/qfem-0025/src/input.json index 339cb3c0..5c26129d 100644 --- a/Examples/qfem-0025/src/input.json +++ b/Examples/qfem-0025/src/input.json @@ -1,8 +1,11 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSeesPy", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/.", "PA_Path": "{Current_Dir}/.", "mainScript": "rosenbrock.py", @@ -10,23 +13,27 @@ "postprocessScript": "" } }, - "UQ": { + "UQ": + { "Application": "SimCenter-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "f", "type": "scalar" } ], - "FEM": { - }, - "UQ": { - "surrogateMethodInfo": { + "FEM": + {}, + "UQ": + { + "surrogateMethodInfo": + { "DoEmethod": "None", "accuracyLimit": 0.02, "advancedOpt": true, @@ -50,12 +57,14 @@ "uqEngine": "SimCenterUQ", "uqType": "Train GP Surrogate Model" }, - "correlationMatrix": [ + "correlationMatrix": + [ 1 ], "isSurrogate": true, "localAppDir": "C:/Users/SimCenter/Sangri/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -71,4 +80,4 @@ "resultType": "SimCenterUQResultsSurrogate", "runType": "runningLocal", "workingDir": "C:/Users/SimCenter/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0026/src/input.json b/Examples/qfem-0026/src/input.json index af4ee827..2f94c6d2 100644 --- a/Examples/qfem-0026/src/input.json +++ b/Examples/qfem-0026/src/input.json @@ -1,6 +1,8 @@ { - "UQ": { - "reliabilityMethodData": { + "UQ": + { + "reliabilityMethodData": + { "reliabilityMethod": "Subset Simulation", "mcmcMethod": "Metropolis-Hastings", "samplesPerSubset": "1000", @@ -11,14 +13,16 @@ "uqEngine": "UQpy", "uqType": "Reliability Analysis" }, - "FEM": { - }, - "EDP": [ + "FEM": + {}, + "EDP": + [ { "name": "Node_3_Disp_2" } ], - "randomVariables": [ + "randomVariables": + [ { "name": "E", "title": "elastic modulus", @@ -63,19 +67,24 @@ } ], "$schema": "https://raw.githubusercontent.com/claudioperez/SimCenterDocumentation/examples/docs/common/user_manual/schemas/quoFEM_Schema.json", - "Applications": { - "UQ": { + "Applications": + { + "UQ": + { "Application": "UQpy", - "ApplicationData": {} + "ApplicationData": + {} }, - "FEM": { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { - "MS_Path": "{Current_Dir}/", - "mainScript": "TrussModel.tcl", - "postprocessScript": "TrussPost.tcl", - "PS_Path": "{Current_Dir}/" - } - } + "ApplicationData": + { + "MS_Path": "{Current_Dir}/", + "mainScript": "TrussModel.tcl", + "postprocessScript": "TrussPost.tcl", + "PS_Path": "{Current_Dir}/" + } + } } -} +} \ No newline at end of file diff --git a/Examples/qfem-0027/src/input.json b/Examples/qfem-0027/src/input.json index e7f53448..6fd023eb 100644 --- a/Examples/qfem-0027/src/input.json +++ b/Examples/qfem-0027/src/input.json @@ -1,56 +1,67 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "MultiModel", - "ApplicationData": { + "ApplicationData": + { "appKey": "FEM" } }, - "UQ": { + "UQ": + { "Application": "Dakota-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 1, "name": "MaxBaseShear", "type": "scalar" } ], - "FEM": { + "FEM": + { "modelToRun": "RV.MultiModel-FEM", - "models": [ + "models": + [ { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/model1", "PS_Path": "{Current_Dir}/model1", "mainScript": "ShearBuilding_NL_1.tcl", "postprocessScript": "postprocess.tcl" }, "belief": 1, - "data": { - } + "data": + {} }, { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/model2", "PS_Path": "{Current_Dir}/model2", "mainScript": "ShearBuilding_NL_2.tcl", "postprocessScript": "postprocess.tcl" }, "belief": 1, - "data": { - } + "data": + {} } ] }, - "UQ": { + "UQ": + { "parallelExecution": true, - "samplingMethodData": { + "samplingMethodData": + { "method": "LHS", "samples": 100, "seed": 811 @@ -59,7 +70,8 @@ "uqType": "Forward Propagation" }, "localAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Uniform", "inputType": "Parameters", @@ -125,4 +137,4 @@ "resultType": "SimCenterUQResultsSampling", "runType": "runningLocal", "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0028/src/input.json b/Examples/qfem-0028/src/input.json index 7b07d22c..7d6e9edc 100644 --- a/Examples/qfem-0028/src/input.json +++ b/Examples/qfem-0028/src/input.json @@ -1,20 +1,25 @@ { - "Applications": { - "FEM": { + "Applications": + { + "FEM": + { "Application": "OpenSees", - "ApplicationData": { + "ApplicationData": + { "MS_Path": "{Current_Dir}/model", "mainScript": "matTestAllParamsReadStrain.tcl", "postprocessScript": "" } }, - "UQ": { + "UQ": + { "Application": "UCSD-UQ", - "ApplicationData": { - } + "ApplicationData": + {} } }, - "EDP": [ + "EDP": + [ { "length": 342, "name": "1_A64_output_data", @@ -196,12 +201,14 @@ "type": "field" } ], - "FEM": { - }, - "UQ": { + "FEM": + {}, + "UQ": + { "Calibration Data File Name": "output_data.txt", "Calibration Datasets Directory": "{Current_Dir}/CouponCyclicTestData_every_20th_point", - "List Of Dataset Subdirectories": [ + "List Of Dataset Subdirectories": + [ "{Current_Dir}/CouponCyclicTestData_every_20th_point/1_A64", "{Current_Dir}/CouponCyclicTestData_every_20th_point/2_A65", "{Current_Dir}/CouponCyclicTestData_every_20th_point/3_A66", @@ -248,7 +255,8 @@ "parallelExecution": true, "uqType": "Metropolis Within Gibbs Sampler" }, - "correlationMatrix": [ + "correlationMatrix": + [ 1, 0, 0, @@ -300,7 +308,8 @@ 1 ], "localAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", - "randomVariables": [ + "randomVariables": + [ { "distribution": "Normal", "inputType": "Parameters", @@ -375,7 +384,7 @@ "remoteAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", "resultType": "SimCenterUQResultsSampling", "runType": "runningLocal", - "summary": [ - ], + "summary": + [], "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" -} +} \ No newline at end of file diff --git a/Examples/qfem-0029/src/input.json b/Examples/qfem-0029/src/input.json new file mode 100644 index 00000000..bbd48848 --- /dev/null +++ b/Examples/qfem-0029/src/input.json @@ -0,0 +1,346 @@ +{ + "Applications": + { + "FEM": + { + "Application": "MultiModel", + "ApplicationData": + { + "appKey": "FEM" + } + }, + "UQ": + { + "Application": "UCSD-UQ", + "ApplicationData": + {} + } + }, + "EDP": + [ + { + "length": 342, + "name": "stress", + "type": "field" + } + ], + "FEM": + { + "modelToRun": "RV.MultiModel-FEM", + "models": + [ + { + "Application": "OpenSees", + "ApplicationData": + { + "MS_Path": "{Current_Dir}/.", + "mainScript": "Steel01.tcl", + "postprocessScript": "" + }, + "belief": 1, + "data": + {} + }, + { + "Application": "OpenSees", + "ApplicationData": + { + "MS_Path": "{Current_Dir}/.", + "mainScript": "Steel02.tcl", + "postprocessScript": "" + }, + "belief": 1, + "data": + {} + } + ] + }, + "UQ": + { + "calDataFile": "calDataField.csv", + "calDataFilePath": "{Current_Dir}/.", + "logLikelihoodFile": "", + "logLikelihoodPath": "", + "numExperiments": 1, + "numParticles": 100, + "parallelExecution": true, + "readUserDefinedCovarianceData": false, + "seed": 0, + "uqType": "Transitional Markov chain Monte Carlo" + }, + "correlationMatrix": + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ], + "localAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", + "randomVariables": + [ + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 300, + "name": "Fy_1", + "refCount": 1, + "upperbound": 700, + "value": "RV.Fy_1", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 150000, + "name": "E0_1", + "refCount": 1, + "upperbound": 250000, + "value": "RV.E0_1", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0, + "name": "b_1", + "refCount": 1, + "upperbound": 0.2, + "value": "RV.b_1", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0, + "name": "a1_1", + "refCount": 1, + "upperbound": 0.2, + "value": "RV.a1_1", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0, + "name": "a3_1", + "refCount": 1, + "upperbound": 0.2, + "value": "RV.a3_1", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 300, + "name": "Fy_2", + "refCount": 1, + "upperbound": 700, + "value": "RV.Fy_2", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 150000, + "name": "E0_2", + "refCount": 1, + "upperbound": 250000, + "value": "RV.E0_2", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0, + "name": "b_2", + "refCount": 1, + "upperbound": 0.2, + "value": "RV.b_2", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0.5, + "name": "cR1_2", + "refCount": 1, + "upperbound": 0.9, + "value": "RV.cR1_2", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0, + "name": "cR2_2", + "refCount": 1, + "upperbound": 0.2, + "value": "RV.cR2_2", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0, + "name": "a1_2", + "refCount": 1, + "upperbound": 0.2, + "value": "RV.a1_2", + "variableClass": "Uncertain" + }, + { + "distribution": "Uniform", + "inputType": "Parameters", + "lowerbound": 0, + "name": "a3_2", + "refCount": 1, + "upperbound": 0.2, + "value": "RV.a3_2", + "variableClass": "Uncertain" + } + ], + "remoteAppDir": "/Users/aakash/SimCenter/SimCenterBackendApplications", + "resultType": "UCSD_Results", + "runType": "runningLocal", + "workingDir": "/Users/aakash/Documents/quoFEM/LocalWorkDir" +} \ No newline at end of file From d1738fc19557c7215b9e873867e1014d3787112a Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:34:41 -0700 Subject: [PATCH 03/11] abs - restoring postprocessScript file name --- Examples/qfem-0001/src/input.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/qfem-0001/src/input.json b/Examples/qfem-0001/src/input.json index f45172e7..0063577a 100644 --- a/Examples/qfem-0001/src/input.json +++ b/Examples/qfem-0001/src/input.json @@ -80,7 +80,7 @@ { "MS_Path": "{Current_Dir}/", "mainScript": "TrussModel.tcl", - "postprocessScript": "", + "postprocessScript": "TrussPost.tcl", "PS_Path": "{Current_Dir}/" } } From 0472bfb0ecb7b1aba67553aca125d47c778953fa Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:49:09 -0700 Subject: [PATCH 04/11] abs - updating the shell script to run quoFEM examples for CI --- run_examples.sh | 107 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 18 deletions(-) mode change 100644 => 100755 run_examples.sh diff --git a/run_examples.sh b/run_examples.sh old mode 100644 new mode 100755 index a1c11346..7a0567a8 --- a/run_examples.sh +++ b/run_examples.sh @@ -3,29 +3,100 @@ echo In folder $PWD # Clone the examples -git clone --branch master --depth 1 https://github.com/NHERI-SimCenter/quoFEM.git +git clone --branch master https://github.com/NHERI-SimCenter/quoFEM.git -# Create the working directoy -mkdir tmp.SimCenter -mkdir tmp.SimCenter/templatedir -cp -a $PWD/Examples/qfem-0001/src/. $PWD/tmp.SimCenter/templatedir/ +make sure all packages are installed +python3 -m pip install --upgrade pip +python3 -m pip install nheri-simcenter --upgrade +python3 -m pip install GPy==1.13.2 -sudo apt-get install jq +# Read JSON from file +json_file="$PWD/quoFEM/Examples/Examples.json" -inputfile=$PWD/Examples/qfem-0001/src/input.json +# Install jq and sed only if they are not already installed +if ! command -v jq &> /dev/null; then + sudo apt-get install -y jq +fi -echo "doing jq =================" -echo $(cat $inputfile | jq '. + { "runDir": "'"$PWD/tmp.SimCenter"'" }') > $inputfile -echo $(cat $inputfile | jq '. + { "localAppDir": "'"$PWD/SimCenterBackendApplications"'" }') > $inputfile -echo $(cat $inputfile | jq '. + { "remoteAppDir": "'"$PWD/SimCenterBackendApplications"'" }') > $inputfile -echo $(cat $inputfile | jq '. + { "runType": "runningLocal" }') > $inputfile -echo "did jq ===================" +if ! command -v sed &> /dev/null; then + sudo apt-get install -y sed +fi -echo "catting the thing now ===================" -cat $inputfile +rm -rf cache +mkdir cache +# Iterate over array elements +jq -c '.Examples[]' "$json_file" | while read -r example; do -ls $PWD/tmp.SimCenter/templatedir + name=$(echo "$example" | jq -r '.name') + description=$(echo "$example" | jq -r '.description') + inputfile=$(echo "$example" | jq -r '.inputFile') + + inputfile="$PWD/quoFEM/Examples/$inputfile" + srcDir="$(dirname $inputfile)" + examplenumber="$(dirname $srcDir)" + examplenumber="$(basename $examplenumber)" -# Run the example in the backend -python $PWD/SimCenterBackendApplications/applications/Workflow/qWHALE.py "runningLocal" $inputfile $PWD/SimCenterBackendApplications/applications/Workflow/WorkflowApplications.json + echo "===========================================" + echo "Example Number: $examplenumber" + echo "Example Name: $name" + echo "Example Description: $description" + echo "Input File: $inputfile" + echo "srcDir: $srcDir" + echo "---------------------------" + echo "copying files" + + rm -rf tmp.SimCenter + mkdir tmp.SimCenter + mkdir tmp.SimCenter/templatedir + dstDir=$PWD/tmp.SimCenter/templatedir + cp -a $srcDir/. $dstDir/ + + if [[ "$examplenumber" == "qfem-0027" ]]; then + # do some stuff + mv $dstDir/model1/* $dstDir/ && rmdir $dstDir/model1 + mv $dstDir/model2/* $dstDir/ && rmdir $dstDir/model2 + fi + if [[ "$examplenumber" == "qfem-0028" ]]; then + mv $dstDir/CouponCyclicTestData_every_20th_point/* $dstDir/ && rmdir $dstDir/CouponCyclicTestData_every_20th_point + mv $dstDir/model/* $dstDir/ && rmdir $dstDir/model + fi + + inputfile="$dstDir/$(basename "$inputfile")" + + echo "Adding json params to input file..." + echo $(cat $inputfile | jq '. + { "runDir": "'"$PWD/tmp.SimCenter"'" }') > $inputfile + echo $(cat $inputfile | jq '. + { "localAppDir": "'"$PWD/SimCenterBackendApplications"'" }') > $inputfile + echo $(cat $inputfile | jq '. + { "remoteAppDir": "'"$PWD/SimCenterBackendApplications"'" }') > $inputfile + echo $(cat $inputfile | jq '. + { "runType": "runningLocal" }') > $inputfile + + sed -i '' "s|{Current_Dir}|$dstDir|g" "$inputfile" + + #echo "Input file contents:" + #python3 -m json.tool $inputfile + + #echo "Template dir contents" + #ls $PWD/tmp.SimCenter/templatedir + + + # Run the example in the backend + echo "Running python:" + echo "===============" + python3 $PWD/SimCenterBackendApplications/applications/Workflow/qWHALE.py "runningLocal" $inputfile $PWD/SimCenterBackendApplications/applications/Workflow/WorkflowApplications.json + mkdir "cache/tmp.SimCenter.$examplenumber/" + cp -r tmp.SimCenter/. "cache/tmp.SimCenter.$examplenumber/" +done + +# Check with archives have a dakotaTab.out file +echo "" +echo "" +echo "======================================" +for dir in $PWD/cache/*; do + if [ -f "$dir/dakotaTab.out" ] || [ -f "$dir/posterior_samples_table.out" ] || [ -f "$dir/dakota_mcmc_tabular.dat" ]; then + echo "$dir: PASS" + # Do something if the file exists + else + echo "$dir: FAIL" + # Do something else if the file does not exist + fi +done \ No newline at end of file From 4f96228de74e4c4cf5190957efeec652b006e721 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:58:27 -0700 Subject: [PATCH 05/11] abs - fixing comment --- run_examples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_examples.sh b/run_examples.sh index 7a0567a8..d30ad2ea 100755 --- a/run_examples.sh +++ b/run_examples.sh @@ -5,7 +5,7 @@ echo In folder $PWD # Clone the examples git clone --branch master https://github.com/NHERI-SimCenter/quoFEM.git -make sure all packages are installed +# make sure all packages are installed python3 -m pip install --upgrade pip python3 -m pip install nheri-simcenter --upgrade python3 -m pip install GPy==1.13.2 From ad4338c2af5f8b35066db7497060f1d573ab1017 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:10:05 -0700 Subject: [PATCH 06/11] abs - python file for running all examples for CI --- run_examples.py | 265 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 run_examples.py diff --git a/run_examples.py b/run_examples.py new file mode 100644 index 00000000..c1049e11 --- /dev/null +++ b/run_examples.py @@ -0,0 +1,265 @@ +import os +import subprocess +import json +import shutil +import logging +import sys + + +class StreamToLogger(object): + """Class that redirects stream to a logger.""" + + def __init__(self, logger, level=logging.INFO): + self.logger = logger + self.level = level + + def write(self, message): + if message.strip(): # Only log non-empty messages + self.logger.log(self.level, message) + + def flush(self): + pass # No operation needed for flush + + +def setup_logging(log_file="run_examples_output.txt"): + """Sets up logging to both console and a log file.""" + logging.basicConfig( + level=logging.DEBUG, # Set the level to DEBUG to capture all messages + format="%(levelname)s - %(message)s", + ) + + # Create a file handler for logging to a file + file_handler = logging.FileHandler(log_file, mode="w") + file_handler.setLevel(logging.DEBUG) # Ensure file handler captures all messages + file_handler.setFormatter( + logging.Formatter("%(levelname)s - %(message)s") + ) + + # Create a console handler for logging to stdout + console_handler = logging.StreamHandler() + console_handler.setLevel(logging.DEBUG) # Set console handler to DEBUG as well + console_handler.setFormatter( + logging.Formatter("%(asctime)s - %(levelname)s - %(message)s") + ) + + # Add the handlers to the root logger + logging.getLogger().addHandler(file_handler) + logging.getLogger().addHandler(console_handler) + + # Redirect stdout and stderr to the logger + sys.stdout = StreamToLogger(logging.getLogger(), level=logging.INFO) + sys.stderr = StreamToLogger(logging.getLogger(), level=logging.ERROR) + + +def copy_files(src_dir, dst_dir): + """Copy all files and subdirectories from src_dir to dst_dir.""" + if os.path.exists(src_dir) and os.path.isdir(src_dir): + for filename in os.listdir(src_dir): + src_file = os.path.join(src_dir, filename) + dst_file = os.path.join(dst_dir, filename) + try: + if os.path.isfile(src_file): + shutil.copy2(src_file, dst_file) # copy2 preserves metadata + elif os.path.isdir(src_file): + shutil.copytree(src_file, dst_file, dirs_exist_ok=True) + except Exception as e: + logging.error(f"Error copying {src_file} to {dst_file}: {e}") + else: + logging.warning( + f"Source directory {src_dir} does not exist or is not a directory." + ) + + +def delete_directory(directory): + """Deletes the specified directory and all its contents.""" + if os.path.exists(directory) and os.path.isdir(directory): + shutil.rmtree(directory) + logging.info(f"Deleted directory: {directory}") + else: + logging.warning( + f"Directory {directory} does not exist or is not a directory." + ) + + +def create_cache_directory(cache_dir): + """Create the cache directory, removing it first if it exists.""" + try: + if os.path.exists(cache_dir): + shutil.rmtree(cache_dir) + os.makedirs(cache_dir) + logging.info(f"Created cache directory: {cache_dir}") + except Exception as e: + logging.error(f"Error creating cache directory {cache_dir}: {e}") + + +def process_example(example, base_dir, tmp_dir, cache_dir): + """Process a single example from the JSON configuration.""" + name = example.get("name") + description = example.get("description") + input_file = os.path.join(base_dir, "quoFEM", "Examples", example.get("inputFile", "")) + src_dir = os.path.dirname(input_file) + example_number = os.path.basename(os.path.dirname(src_dir)) + + logging.info("="*80) + logging.info(f"Processing Example Name: {name}") + logging.info(f"Example Number: {example_number}") + logging.info(f"Description: {description}") + logging.info(f"Input File: {input_file}") + logging.info(f"Source Directory: {src_dir}") + + if os.path.exists(tmp_dir): + delete_directory(tmp_dir) + os.makedirs(os.path.join(tmp_dir, "templatedir")) + + dst_dir = os.path.join(tmp_dir, "templatedir") + copy_files(src_dir, dst_dir) + + # Special handling for specific examples + if example_number in ["qfem-0027", "qfem-0028"]: + handle_special_examples(dst_dir, example_number) + + input_file = os.path.join(dst_dir, os.path.basename(input_file)) + add_json_params(input_file, dst_dir, base_dir) + + # Run the backend application and capture output + logging.info("Running Python application...") + try: + # Capture stdout and stderr in the log + result = subprocess.run( + [ + "python3", + os.path.join( + base_dir, + "SimCenterBackendApplications/applications/Workflow/qWHALE.py", + ), + "runningLocal", + input_file, + os.path.join( + base_dir, + "SimCenterBackendApplications/applications/Workflow/WorkflowApplications.json", + ), + ], + check=True, + stdout=subprocess.PIPE, # Capture standard output + stderr=subprocess.PIPE, # Capture standard error + ) + + # Log the captured standard output if it exists + if result.stdout: + logging.info("Subprocess Output:\n%s", result.stdout.decode()) + + # Log the captured standard error if it exists + if result.stderr: + logging.warning("Subprocess Warnings/Info:\n%s", result.stderr.decode()) + + except subprocess.CalledProcessError as e: + logging.error( + f"Error running application: {e}\nOutput: {e.output.decode()}\nError Output: {e.stderr.decode()}" + ) + + # Save output to cache + cache_tmp = os.path.join(cache_dir, f"tmp.SimCenter.{example_number}") + shutil.copytree(tmp_dir, cache_tmp, dirs_exist_ok=True) + logging.info(f"Saved output to cache: {cache_tmp}") + + +def handle_special_examples(dst_dir, example_number): + """Handle specific file operations for certain example numbers.""" + if example_number == "qfem-0027": + copy_files(os.path.join(dst_dir, "model1"), dst_dir) + copy_files(os.path.join(dst_dir, "model2"), dst_dir) + delete_directory(os.path.join(dst_dir, "model1")) + delete_directory(os.path.join(dst_dir, "model2")) + elif example_number == "qfem-0028": + copy_files( + os.path.join(dst_dir, "CouponCyclicTestData_every_20th_point"), dst_dir + ) + copy_files(os.path.join(dst_dir, "model"), dst_dir) + delete_directory( + os.path.join(dst_dir, "CouponCyclicTestData_every_20th_point") + ) + delete_directory(os.path.join(dst_dir, "model")) + + +def add_json_params(input_file, dst_dir, base_dir): + """Add necessary parameters to the input JSON file.""" + logging.info("Adding JSON parameters to input file...") + try: + with open(input_file, "r") as f: + input_json = json.load(f) + + input_json["runDir"] = os.path.join(base_dir, "tmp.SimCenter") + input_json["localAppDir"] = os.path.join( + base_dir, "SimCenterBackendApplications" + ) + input_json["remoteAppDir"] = os.path.join( + base_dir, "SimCenterBackendApplications" + ) + input_json["runType"] = "runningLocal" + + with open(input_file, "w") as f: + json.dump(input_json, f, indent=2) + + # Replace "{Current_Dir}" with dst_dir in the input file content + with open(input_file, "r") as f: + filedata = f.read() + + filedata = filedata.replace("{Current_Dir}", dst_dir) + + with open(input_file, "w") as f: + f.write(filedata) + except Exception as e: + logging.error(f"Error modifying JSON parameters in {input_file}: {e}") + + +def check_output_files(cache_dir): + """Check for output files in the cache directory and report their status.""" + logging.info("Checking output files...") + for dirpath in os.listdir(cache_dir): + dir_full_path = os.path.join(cache_dir, dirpath) + if any( + os.path.exists(os.path.join(dir_full_path, f)) + for f in [ + "dakotaTab.out", + "posterior_samples_table.out", + "dakota_mcmc_tabular.dat", + ] + ): + logging.info(f"{dir_full_path}: PASS") + else: + logging.warning(f"{dir_full_path}: FAIL") + + +def main(): + """Main entry point of the script.""" + setup_logging() + + # Constants + pwd = os.getcwd() + json_file = os.path.join(pwd, "quoFEM/Examples/Examples.json") + cache_dir = os.path.join(pwd, "cache") + tmp_dir = os.path.join(pwd, "tmp.SimCenter") + + logging.info(f"In folder {pwd}") + + # Create cache directory + create_cache_directory(cache_dir) + + # Read the JSON file + try: + with open(json_file, "r") as f: + examples = json.load(f).get("Examples", []) + except Exception as e: + logging.error(f"Error reading JSON file {json_file}: {e}") + return + + # Process each example + for example in examples: + process_example(example, pwd, tmp_dir, cache_dir) + + # Check for output files + check_output_files(cache_dir) + + +if __name__ == "__main__": + main() From 35b191cdd97b207f7b94d30eb29d6719d438e7f6 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:12:47 -0700 Subject: [PATCH 07/11] abs - yaml file for running examples for CI, to be merged with steps to install the backend --- run_examples.yaml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 run_examples.yaml diff --git a/run_examples.yaml b/run_examples.yaml new file mode 100644 index 00000000..79f9c5c1 --- /dev/null +++ b/run_examples.yaml @@ -0,0 +1,43 @@ +name: Python CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install nheri-simcenter + pip install GPy==1.13.2 + + - name: Run the script + run: python run_examples.py # This assumes the python script is called 'run_examples.py' + + - name: Upload output + if: success() + uses: actions/upload-artifact@v2 + with: + name: output + path: output.out + + - name: Upload cache directory + if: success() + uses: actions/upload-artifact@v2 + with: + name: cache + path: cache # This assumes the cache directory is named 'cache' From fe9d831f8f6c9b5f59b2e4e8db2f6225684b3db9 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:10:15 -0700 Subject: [PATCH 08/11] abs - splitting the running examples and checking output to different modules --- check_output.py | 102 +++++++++++++++++++++++ run_examples.py | 38 ++++----- run_examples.yaml => run_examples_ci.yml | 0 3 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 check_output.py rename run_examples.yaml => run_examples_ci.yml (100%) diff --git a/check_output.py b/check_output.py new file mode 100644 index 00000000..16429d4b --- /dev/null +++ b/check_output.py @@ -0,0 +1,102 @@ +import os +import logging +import sys + + +class StreamToLogger(object): + """Class that redirects stream to a logger.""" + + def __init__(self, logger, level=logging.INFO): + self.logger = logger + self.level = level + + def write(self, message): + if message.strip(): # Only log non-empty messages + self.logger.log(self.level, message) + + def flush(self): + pass # No operation needed for flush + + +def setup_logging(log_file="check_output_log.txt"): + """Sets up logging to both console and a log file.""" + + # Clear any existing handlers + for handler in logging.getLogger().handlers[:]: + logging.getLogger().removeHandler(handler) + + # Set up the root logger with a default level and format + logging.basicConfig( + level=logging.DEBUG, # Set the level to DEBUG to capture all messages + format="%(asctime)s - %(levelname)s - %(message)s", + datefmt="%H:%M:%S", + ) + + # Create a file handler for logging to a file + file_handler = logging.FileHandler(log_file, mode="w") + file_handler.setLevel(logging.DEBUG) # Ensure file handler captures all messages + file_handler.setFormatter( + logging.Formatter( + "%(asctime)s - %(levelname)s - %(message)s", datefmt="%H:%M:%S" + ) + ) + + # Create a console handler for logging to stdout + console_handler = logging.StreamHandler() + console_handler.setLevel(logging.DEBUG) # Set console handler to DEBUG as well + console_handler.setFormatter( + logging.Formatter( + "%(asctime)s - %(levelname)s - %(message)s", datefmt="%H:%M:%S" + ) + ) + + # Add the handlers to the root logger + logging.getLogger().addHandler(file_handler) + logging.getLogger().addHandler(console_handler) + + # Redirect stdout and stderr to the logger + sys.stdout = StreamToLogger(logging.getLogger(), level=logging.INFO) + sys.stderr = StreamToLogger(logging.getLogger(), level=logging.ERROR) + + +def check_output_files(cache_dir): + """Check for output files in the cache directory and report their status.""" + logging.info("Checking output files...") + all_passed = True + for dirpath in os.listdir(cache_dir): + dir_full_path = os.path.join(cache_dir, dirpath) + if any( + os.path.exists(os.path.join(dir_full_path, f)) + for f in [ + "dakotaTab.out", + "posterior_samples_table.out", + "dakota_mcmc_tabular.dat", + ] + ): + logging.info(f"{dir_full_path}: PASS") + else: + logging.warning(f"{dir_full_path}: FAIL") + all_passed = False + return all_passed + + +def main(): + setup_logging() + + # Constants + pwd = os.getcwd() + cache_dir = os.path.join(pwd, "cache") + + # Check for output files + all_passed = check_output_files(cache_dir) + + if all_passed: + logging.info("All output files are present.") + exit(0) + else: + logging.error("Some output files are missing.") + exit(1) + + +if __name__ == "__main__": + main() diff --git a/run_examples.py b/run_examples.py index c1049e11..94230306 100644 --- a/run_examples.py +++ b/run_examples.py @@ -23,23 +23,34 @@ def flush(self): def setup_logging(log_file="run_examples_output.txt"): """Sets up logging to both console and a log file.""" + + # Clear any existing handlers + for handler in logging.getLogger().handlers[:]: + logging.getLogger().removeHandler(handler) + + # Set up the root logger with a default level and format logging.basicConfig( level=logging.DEBUG, # Set the level to DEBUG to capture all messages - format="%(levelname)s - %(message)s", + format="%(asctime)s - %(levelname)s - %(message)s", + datefmt="%H:%M:%S", ) # Create a file handler for logging to a file file_handler = logging.FileHandler(log_file, mode="w") file_handler.setLevel(logging.DEBUG) # Ensure file handler captures all messages file_handler.setFormatter( - logging.Formatter("%(levelname)s - %(message)s") + logging.Formatter( + "%(asctime)s - %(levelname)s - %(message)s", datefmt="%H:%M:%S" + ) ) # Create a console handler for logging to stdout console_handler = logging.StreamHandler() console_handler.setLevel(logging.DEBUG) # Set console handler to DEBUG as well console_handler.setFormatter( - logging.Formatter("%(asctime)s - %(levelname)s - %(message)s") + logging.Formatter( + "%(asctime)s - %(levelname)s - %(message)s", datefmt="%H:%M:%S" + ) ) # Add the handlers to the root logger @@ -212,24 +223,6 @@ def add_json_params(input_file, dst_dir, base_dir): logging.error(f"Error modifying JSON parameters in {input_file}: {e}") -def check_output_files(cache_dir): - """Check for output files in the cache directory and report their status.""" - logging.info("Checking output files...") - for dirpath in os.listdir(cache_dir): - dir_full_path = os.path.join(cache_dir, dirpath) - if any( - os.path.exists(os.path.join(dir_full_path, f)) - for f in [ - "dakotaTab.out", - "posterior_samples_table.out", - "dakota_mcmc_tabular.dat", - ] - ): - logging.info(f"{dir_full_path}: PASS") - else: - logging.warning(f"{dir_full_path}: FAIL") - - def main(): """Main entry point of the script.""" setup_logging() @@ -257,9 +250,6 @@ def main(): for example in examples: process_example(example, pwd, tmp_dir, cache_dir) - # Check for output files - check_output_files(cache_dir) - if __name__ == "__main__": main() diff --git a/run_examples.yaml b/run_examples_ci.yml similarity index 100% rename from run_examples.yaml rename to run_examples_ci.yml From e6df3bf32451b092b32f8a2b187a95109d012376 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:11:04 -0700 Subject: [PATCH 09/11] abs - updating the examples CI yaml file --- run_examples_ci.yml | 48 +++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/run_examples_ci.yml b/run_examples_ci.yml index 79f9c5c1..af46c0e9 100644 --- a/run_examples_ci.yml +++ b/run_examples_ci.yml @@ -1,43 +1,53 @@ -name: Python CI +name: Cross-Platform Examples Test on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python 3.9 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.9' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install nheri-simcenter - pip install GPy==1.13.2 + python -m pip install nheri-simcenter + python -m pip install GPy==1.13.2 - - name: Run the script - run: python run_examples.py # This assumes the python script is called 'run_examples.py' + - name: Run the examples + run: python run_examples.py - - name: Upload output - if: success() - uses: actions/upload-artifact@v2 + - name: Check output files + run: python check_output.py + + - name: Upload output log + uses: actions/upload-artifact@v3 + with: + name: output-log-${{ matrix.os }} + path: run_examples_output.txt + + - name: Upload check output log + uses: actions/upload-artifact@v3 with: - name: output - path: output.out + name: check-output-log-${{ matrix.os }} + path: check_output_log.txt - name: Upload cache directory - if: success() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: cache - path: cache # This assumes the cache directory is named 'cache' + name: cache-${{ matrix.os }} + path: cache \ No newline at end of file From d3fa01bb3edbc633feab62cb0b03ec0eed7f0477 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:08:15 -0700 Subject: [PATCH 10/11] abs - updating the folder names for working in docker --- .../{1_A64 => 01_A64}/input_data.txt | 0 .../{1_A64 => 01_A64}/output_data.txt | 0 .../{2_A65 => 02_A65}/input_data.txt | 0 .../{2_A65 => 02_A65}/output_data.txt | 0 .../{3_A66 => 03_A66}/input_data.txt | 0 .../{3_A66 => 03_A66}/output_data.txt | 0 .../{4_A67 => 04_A67}/input_data.txt | 0 .../{4_A67 => 04_A67}/output_data.txt | 0 .../{5_A68 => 05_A68}/input_data.txt | 0 .../{5_A68 => 05_A68}/output_data.txt | 0 .../{6_A69 => 06_A69}/input_data.txt | 0 .../{6_A69 => 06_A69}/output_data.txt | 0 .../{7_A74 => 07_A74}/input_data.txt | 0 .../{7_A74 => 07_A74}/output_data.txt | 0 .../{8_A75 => 08_A75}/input_data.txt | 0 .../{8_A75 => 08_A75}/output_data.txt | 0 .../{9_A76 => 09_A76}/input_data.txt | 0 .../{9_A76 => 09_A76}/output_data.txt | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{1_A64 => 01_A64}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{1_A64 => 01_A64}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{2_A65 => 02_A65}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{2_A65 => 02_A65}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{3_A66 => 03_A66}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{3_A66 => 03_A66}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{4_A67 => 04_A67}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{4_A67 => 04_A67}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{5_A68 => 05_A68}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{5_A68 => 05_A68}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{6_A69 => 06_A69}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{6_A69 => 06_A69}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{7_A74 => 07_A74}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{7_A74 => 07_A74}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{8_A75 => 08_A75}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{8_A75 => 08_A75}/output_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{9_A76 => 09_A76}/input_data.txt (100%) rename Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/{9_A76 => 09_A76}/output_data.txt (100%) diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/1_A64/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/01_A64/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/1_A64/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/01_A64/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/1_A64/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/01_A64/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/1_A64/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/01_A64/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/2_A65/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/02_A65/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/2_A65/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/02_A65/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/2_A65/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/02_A65/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/2_A65/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/02_A65/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/3_A66/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/03_A66/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/3_A66/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/03_A66/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/3_A66/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/03_A66/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/3_A66/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/03_A66/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/4_A67/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/04_A67/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/4_A67/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/04_A67/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/4_A67/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/04_A67/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/4_A67/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/04_A67/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/5_A68/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/05_A68/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/5_A68/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/05_A68/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/5_A68/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/05_A68/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/5_A68/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/05_A68/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/6_A69/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/06_A69/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/6_A69/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/06_A69/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/6_A69/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/06_A69/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/6_A69/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/06_A69/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/7_A74/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/07_A74/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/7_A74/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/07_A74/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/7_A74/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/07_A74/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/7_A74/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/07_A74/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/8_A75/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/08_A75/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/8_A75/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/08_A75/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/8_A75/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/08_A75/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/8_A75/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/08_A75/output_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/9_A76/input_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/09_A76/input_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/9_A76/input_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/09_A76/input_data.txt diff --git a/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/9_A76/output_data.txt b/Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/09_A76/output_data.txt similarity index 100% rename from Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/9_A76/output_data.txt rename to Examples/qfem-0028/src/CouponCyclicTestData_every_20th_point/09_A76/output_data.txt From e9578188774b4e82dbbdad96e3fbaee938ede621 Mon Sep 17 00:00:00 2001 From: bsaakash <11618528+bsaakash@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:12:12 -0700 Subject: [PATCH 11/11] abs - updating the names of the data files and edps --- Examples/qfem-0028/src/input.json | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Examples/qfem-0028/src/input.json b/Examples/qfem-0028/src/input.json index 7d6e9edc..3b9098db 100644 --- a/Examples/qfem-0028/src/input.json +++ b/Examples/qfem-0028/src/input.json @@ -22,47 +22,47 @@ [ { "length": 342, - "name": "1_A64_output_data", + "name": "01_A64_output_data", "type": "field" }, { "length": 347, - "name": "2_A65_output_data", + "name": "02_A65_output_data", "type": "field" }, { "length": 342, - "name": "3_A66_output_data", + "name": "03_A66_output_data", "type": "field" }, { "length": 246, - "name": "4_A67_output_data", + "name": "04_A67_output_data", "type": "field" }, { "length": 348, - "name": "5_A68_output_data", + "name": "05_A68_output_data", "type": "field" }, { "length": 349, - "name": "6_A69_output_data", + "name": "06_A69_output_data", "type": "field" }, { "length": 342, - "name": "7_A74_output_data", + "name": "07_A74_output_data", "type": "field" }, { "length": 347, - "name": "8_A75_output_data", + "name": "08_A75_output_data", "type": "field" }, { "length": 342, - "name": "9_A76_output_data", + "name": "09_A76_output_data", "type": "field" }, { @@ -209,15 +209,15 @@ "Calibration Datasets Directory": "{Current_Dir}/CouponCyclicTestData_every_20th_point", "List Of Dataset Subdirectories": [ - "{Current_Dir}/CouponCyclicTestData_every_20th_point/1_A64", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/2_A65", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/3_A66", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/4_A67", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/5_A68", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/6_A69", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/7_A74", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/8_A75", - "{Current_Dir}/CouponCyclicTestData_every_20th_point/9_A76", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/01_A64", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/02_A65", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/03_A66", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/04_A67", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/05_A68", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/06_A69", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/07_A74", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/08_A75", + "{Current_Dir}/CouponCyclicTestData_every_20th_point/09_A76", "{Current_Dir}/CouponCyclicTestData_every_20th_point/10_A77", "{Current_Dir}/CouponCyclicTestData_every_20th_point/11_A78", "{Current_Dir}/CouponCyclicTestData_every_20th_point/12_A79",