Skip to content

Commit

Permalink
Merge pull request #87 from yisangriB/master
Browse files Browse the repository at this point in the history
quoFEM 3.2 ready
  • Loading branch information
fmckenna authored Sep 30, 2022
2 parents 9144498 + 0144e5c commit c5acd35
Show file tree
Hide file tree
Showing 16 changed files with 861 additions and 39 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ backend/build
applications/build
applications/applications

*html

*Doxyfile
*latex
*/html/
*/latex/

*.vscode
2 changes: 1 addition & 1 deletion EDP/InputWidgetEDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ InputWidgetEDP::makeEDP(void)
QPushButton *removeEDP = new QPushButton();
removeEDP->setMinimumWidth(75);
removeEDP->setMaximumWidth(75);
removeEDP->setText(tr("Clear all"));
removeEDP->setText(tr("Clear All"));
connect(removeEDP,SIGNAL(clicked()),this,SLOT(removeEDP()));

titleLayout->addWidget(title);
Expand Down
4 changes: 2 additions & 2 deletions Examples/Examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"inputFile": "qfem-0002/src/input.json"
},
{
"name": "Basic modeling with Python",
"name": "Basic Modeling with Python",
"description": "This example illustrates how Python scripting can be used with quoFEM to express general mathematical models without the use of a dedicated finite element analysis engine.",
"inputFile": "qfem-0005/src/input.json"
},
{
"name": "Optimization",
"name": "Deterministic Calibration",
"description": "In this example, a **parameter estimation** routine is used to solve a classical optimization problem for which an analytic solution is known.",
"inputFile": "qfem-0006/src/input.json"
},
Expand Down
27 changes: 14 additions & 13 deletions Examples/qfem-0001/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,33 @@ The structure has uncertain properties that all follow normal distribution:

The goal of the exercise is to estimate the mean and standard deviation of the vertical displacement at node 3. The exercise requires two files. The user is required to download these files and place them in a **NEW** folder. The two files are:

1. :qfem-0001:`TrussTemplate.tcl <src/TrussModel.tcl>`
.. dropdown:: 1. Main file: :qfem-0001:`TrussTemplate.tcl <src/TrussModel.tcl>`

.. literalinclude:: ../qfem-0001/src/TrussModel.tcl
:language: tcl
.. literalinclude:: ../qfem-0001/src/TrussModel.tcl
:language: tcl

.. note::

The first lines containing ``pset`` will be read by the application when the file is selected and the application will autopopulate the Random Variables input panel with these same variable names. It is of course possible to explicitly use Random Variables without the ``pset`` command as is demonstrated in the verification section.

2. :qfem-0001:`TrussPost.tcl <../qfem-0001/src/TrussPost.tcl>`.

The ``TrussPost.tcl`` script shown below will accept as input any of the 6 nodes in the domain and for each of the two dof directions.

.. dropdown:: 2. Postprocessing file: :qfem-0001:`TrussPost.tcl <../qfem-0001/src/TrussPost.tcl>`.

.. literalinclude:: ../qfem-0001/src/TrussPost.tcl
:language: tcl

.. literalinclude:: ../qfem-0001/src/TrussPost.tcl
:language: tcl

.. note::

The use has the option to provide no post-process script (in which case the main script must create a ``results.out`` file containing a single line with as many space separated numbers as QoI or the user may provide a Python script that also performs the postprocessing. An example of a postprocessing Python script is :qfem-0001:`TrussPost.py <src/TrussPost.py>`.
The use has the option to provide no post-process script (in which case the main script must create a ``results.out`` file containing a single line with as many space separated numbers as QoI or the user may provide a Python script that also performs the postprocessing. Below is an example of a postprocessing Python script.

.. dropdown:: Alternative postprocessing file: :qfem-0001:`TrussPost.py <src/TrussPost.py>`

.. literalinclude:: ../qfem-0001/src/TrussPost.py
:language: python


.. literalinclude:: ../qfem-0001/src/TrussPost.py
:language: python

.. warning::

Expand Down Expand Up @@ -138,9 +142,6 @@ Global Sensitivity

In a global sensitivity analysis the user is wishing to understand what is the influence of the individual random variables on the quantities of interest. This is typically done before the user launches large scale forward uncertainty problems in order to limit the number of random variables used so as to limit the number of simulations performed.

To perform a reliability analysis the steps above would be repeated with the exception that the user would select a reliability analysis method instead of a Forward Propagation method. To obtain reliability results using the Second-Order Reliability Method (SORM) for the truss problem the user would follow the same sequence of steps as previously. The difference would be in the **UQ** tab in which the user would select a Reliability as the Dakota Method Category and then choose Local reliability. In the figure the user is specifying that they are interested in the probability that the displacement will exceed certain response levels.


.. figure:: figures/trussSens-UQ.png
:align: center
:figclass: align-center
Expand Down
5 changes: 2 additions & 3 deletions Examples/qfem-0002/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ To define the uncertainty workflow in quoFEM, select **Forward Propagation** for
The following files make up the **FEM** model definition.


#. [model.py](https://raw.githubusercontent.com/claudioperez/SimCenterExamples/master/static/truss/model.py): This file is a Python script which takes a given realization of the problem's random variables, and runs a finite element analysis of the truss with OpenSeesPy. It is supplied to the **Input Script** field of the **FEM** tab, and obviates the need for supplying a **Postprocess Script**. When this script is invoked in the workflow, it receives the list of the identifiers supplied in the **QoI** tab through the operating system's `stdout` variable, and a set of random variable realizations by star-importing the **Parameters File** from the **FEM** tab.

#. [params.py](https://raw.githubusercontent.com/claudioperez/SimCenterExamples/master/static/truss/params.py): This file is a Python script which defines the problem's random variables as objects in the Python runtime. It is supplied to the **Parameters File** field of the **FEM** tab. *The literal values which are assigned to variables in this file will be varied at runtime by the UQ engine.*
#. [TrussModel.py](https://github.com/NHERI-SimCenter/quoFEM/tree/master/Examples/qfem-0002/src/TrussModel.py): This file is a Python script which takes a given realization of the problem's random variables, and runs a finite element analysis of the truss with OpenSeesPy. It is supplied to the **Input Script** field of the **FEM** tab, and obviates the need for supplying a **Postprocess Script**. When this script is invoked in the workflow, it receives the list of the identifiers supplied in the **QoI** tab through the operating system's `stdout` variable, and a set of random variable realizations by star-importing the **Parameters File** from the **FEM** tab.

#. [TrussParams.py](https://github.com/NHERI-SimCenter/quoFEM/tree/master/Examples/qfem-0002/src/TrussParams.py): This file is a Python script which defines the problem's random variables as objects in the Python runtime. It is supplied to the **Parameters File** field of the **FEM** tab. *The literal values which are assigned to variables in this file will be varied at runtime by the UQ engine.*


<!-- <div class="admonition warning">Do not place the files in your root, downloads, or desktop folder as when the application runs it will copy the contents on the directories and subdirectories containing these files multiple times. If you are like us, your root, Downloads or Documents folders contains and awful lot of files and when the backend workflow runs you will slowly find you will run out of disk space!</div> -->
Expand Down
22 changes: 12 additions & 10 deletions Examples/qfem-0006/src/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@
},
"randomVariables": [
{
"distribution": "ContinuousDesign",
"initialpoint": 0,
"inputType": "Parameters",
"lowerbound": -2,
"name": "X",
"title": "first variable",
"distribution": "Uniform",
"lowerbound": -2.0,
"refCount": 1,
"upperbound": 2.0,
"upperbound": 2,
"value": "RV.X",
"variableClass": "Uncertain"
"variableClass": "Design"
},
{
"distribution": "ContinuousDesign",
"initialpoint": 0,
"inputType": "Parameters",
"lowerbound": -2,
"name": "Y",
"title": "second variable",
"distribution": "Uniform",
"lowerbound": -2.0,
"refCount": 1,
"upperbound": 2.0,
"upperbound": 2,
"value": "RV.Y",
"variableClass": "Uncertain"
"variableClass": "Design"
}
],
"FEM":{
Expand Down
2 changes: 1 addition & 1 deletion Examples/qfem-0014/src/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"calDataFilePath": "{Current_Dir}/.",
"logLikelihoodFile": "",
"logLikelihoodPath": "",
"numParticles": 10,
"numParticles": 200,
"seed": 0,
"uqEngine": "UCSD-UQ",
"uqType": "Transitional Markov chain Monte Carlo"
Expand Down
10 changes: 7 additions & 3 deletions Examples/qfem-0015/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Once the user selects OpenSeesPy as FEM applications, below three fields are req
UQ Workflow
-------------

1. Start the application, and the **UQ** Selection will be highlighted. Change the UQ Engine to **SimCenterUQ** and the Method Category to **Training GP Surrogate Model**. Since the model is provided, the Training Dataset will be obtained by **Sampling and Simulation**.
1. Start the application, and the **UQ** Selection will be highlighted. Change the UQ Engine to **SimCenterUQ** and the Method Category to **Training GP Surrogate Model**. Since the model is provided, the Training Dataset will be obtained by **Sampling and Simulation**. Default settings are used for the advanced options.

.. figure:: figures/SUR-UQtab1.png
:align: center
Expand Down Expand Up @@ -144,6 +144,8 @@ Well-trained model will form a clear diagonal line while poorly trained model ar
:figclass: align-center
:width: 1200

.. note::
Note that in the second training period, 150 initial samples were provided from the data files and 150 more simulations were conducted. However, the number of total samples used to train the surrogate model is displayed as 299 since one simulation is consumed to check the consistency between the user provided model (in the **FEM tab**) and the dataset (in the **UQ tab**).

* Leave-one-out cross-validation (LOOCV) predictions:

Expand All @@ -154,8 +156,6 @@ Well-trained model will form a clear diagonal line while poorly trained model ar

Users may want to perform additional simulations in a similar way.

.. note::
Note that in the second training period, 150 initial samples were provided from the data files and 150 more simulations were conducted. However, the number of total samples used to train the surrogate model is displayed as 299 since one simulation is consumed to check the consistency between the user provided model (in the **FEM tab**) and the dataset (in the **UQ tab**).



Expand All @@ -174,6 +174,10 @@ Once surrogate model is constructed, it can be used for various UQ/optimization
.. note::
* Do not change the name of ``templatedir_SIM``. **SurrogateGP Info and model** file names may be changed.
* When location of the files are changed, ``templatedir_SIM`` should be always located in the directory same to the **SurroateGP Info file**.

.. warning::

Do not place above surrogate model files in your root, downloads, or desktop folder as when the application runs it will copy the contents on the directories and subdirectories containing these files multiple times. If you are like us, your root, Downloads or Documents folders contains and awful lot of files and when the backend workflow runs you will slowly find you will run out of disk space!

2. Restart the quoFEM (or press **UQ tab**) and select Dakota Forward Propagation method.

Expand Down
5 changes: 4 additions & 1 deletion Examples/qfem-0016/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This example constructs a Gaussian process-based surrogate model for mean and st
Problem description
-------------------

The structure (:qfem-0016:`three story nonlinear building stick model <src/ShearBuilding_NL.py>`) has the following uncertain properties:
The structure ( :ref:`three story nonlinear building stick model <https://github.com/NHERI-SimCenter/quoFEM/blob/master/Examples/qfem-0016/src/ShearBuilding_NL.tcl>`_ ) has the following uncertain properties:

============================= ============ =========
Random Variable lower bound upper bound
Expand Down Expand Up @@ -120,6 +120,9 @@ Once the surrogate model is trained, it can be used for various UQ/optimization
* Do not change the name of ``templatedir_SIM``. **SurrogateGP Info and model** file names may be changed.
* When location of the files are changed, ``templatedir_SIM`` should be always located in the directory same to the **SurroateGP Info file**.

.. warning::
Do not place above surrogate model files in your root, downloads, or desktop folder as when the application runs it will copy the contents on the directories and subdirectories containing these files multiple times. If you are like us, your root, Downloads or Documents folders contains and awful lot of files and when the backend workflow runs you will slowly find you will run out of disk space!

2. Restart the quoFEM (or press **UQ tab**) and select Dakota sensitivity analysis method.

.. figure:: figures/SUR2-VER1.png
Expand Down
2 changes: 1 addition & 1 deletion Examples/qfem-0019/src/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"calDataFilePath": "{Current_Dir}/.",
"logLikelihoodFile": "",
"logLikelihoodPath": "",
"numParticles": 10,
"numParticles": 200,
"seed": 0,
"uqEngine": "UCSD-UQ",
"uqType": "Transitional Markov chain Monte Carlo"
Expand Down
Loading

0 comments on commit c5acd35

Please sign in to comment.