This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
battery:addtest [2021/09/09 14:51] ehssen |
battery:addtest [2021/11/16 16:14] (current) helene [Tests] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== The test battery ====== | + | ====== Test battery ====== |
- | The test battery is an investigation conducted to verify and validate the recent developments in Lagamine code. This work is in the framework of improving the robustness of the code and going towards Lagamine OPEN. | + | The test battery consists in a large number of simple simulations that should be run everytime changes are made to the Lagamine code to ensure these changes do not alter previous developments. \\ The goal of the test battery is to improve the robustness of the code and avoid mistakes. |
+ | Implemented by: Ehssen Betaieb, 2021 | ||
- | ===== User guide ===== | + | |
+ | ===== How does it work ? ===== | ||
==== Flowchart ==== | ==== Flowchart ==== | ||
- | The organisation chart of the procedure is presented as follows: | + | The organisation chart of the procedure is presented in <imgref image1>. \\ |
+ | * The principal Python code, "Test_battery_launcher.py", is used to run the test battery. | ||
+ | * The code reads the names of the tests to be run in the general file "Test_battery.txt". | ||
+ | * For each test listed in "Test_battery.txt", the code then runs Prepro and Lagamine. | ||
+ | * Afterwards, the code runs a python routine specific to each test to compare that the values obtained are the same as the reference values (values that were obtained using a previous stable version of Lagamine). | ||
+ | * The results of the comparison of each test are written in a report file. | ||
- | <imgcaption image1|Test battery flowchart>{{ :battery:flowchart.jpg?400 |}}</imgcaption> | + | <imgcaption image1|Test battery flowchart>{{ :battery:flowchart.jpg |}}</imgcaption> |
- | For the moment, the test battery is installed in "\\obelix\c\Test Battery". | + | For the moment, the battery of tests is installed in "\\obelix\c\Test Battery". |
- | ==== Requested folders/files ==== | + | ==== Main code ==== |
* The principal python script to run the test battery: **Test_battery_launcher.py** | * The principal python script to run the test battery: **Test_battery_launcher.py** | ||
- | * The file defining the test battery path and the names of the tests in the same folder as the principal python script: **Test_battery.txt** | + | * The file defining the test battery path and the names of the tests in the same folder as the principal python script: **Test_battery.txt**. The structure of this file is shown in <imgref image3>. |
- | <imgcaption image2|The pricipal script working directory>{{ :battery:file2.jpg?600 |}}</imgcaption> | + | <imgcaption image2|The pricipal script working directory>{{ :battery:file2.jpg |}}</imgcaption> |
- | <imgcaption image3|Test_battery.txt file>{{ :battery:file3.jpg?400 |}}</imgcaption> | + | <imgcaption image3|Test_battery.txt file>{{ :battery:file3.jpg |}}</imgcaption> |
- | * The folder containing all the tests: | + | ==== Tests ==== |
- | * Each test is in a separate folder named with the same name as the test defined in "Test_battery.txt": | + | The folder 'Tests' (see <imgref image4>) contains all the tests. \\ \\ |
- | * The simulation files | + | Each test is in a separate folder named with the same name as the test defined in "Test_battery.txt". This folder contains: |
- | * The reference simulation in a folder with the same name as the test +"_ref" | + | * The simulation files (*.lag, *ex.dat, etc.) |
- | * A comparator python script attached to each test and possesses the same name as this test: in this script, the user defines the numerical results to compare and the cost function | + | * The reference simulation in a folder with the same name as the test +"_ref" \\ **N.B.** this folder can contain only the result files (*.ipe, *.ipn, *.rea, ...) and not the totality of the simulation files, as they are the same as the test files. |
+ | * A comparator python script attached to each test. This script must have the same name as its corresponding test. In the script, the user defines the numerical results to compare and the cost function. | ||
- | <imgcaption image4|Test_battery.txt file>{{ :battery:file4.jpg?700 |}}</imgcaption> | + | <imgcaption image4|Test_battery.txt file>{{ :battery:file4.jpg |}}</imgcaption> |
==== Output files ==== | ==== Output files ==== | ||
- | * Local report (attached to the test folder) (name_test.rep): | + | __Local report__ \\ \\ |
- | * Local error | + | The local report is attached to the test folder and has the same name as the test (name_test.rep). This local report contains the details of the error(s) obtained when comparing the new test results to the reference. \\ \\ |
- | * Decision (Success/ Failure): Acceptance value = 0.1% for Mini test and 1% for Big test | + | It is structured as follows: |
+ | * Local error | ||
+ | * Decision (Success/ Failure): depending on the value of the error, the test is considered as passed or failed. The recommanded acceptance value for the error is 0.1% for a Mini test and 1% for a Big test. | ||
- | <imgcaption image5|Local report>{{ :battery:file5.jpg?400 |}}</imgcaption> | + | <imgcaption image5|Local report>{{ :battery:file5.jpg |}}</imgcaption> |
- | + | __Global report__ \\ \\ | |
- | * Global report (attached to the principal python script folder) (Report_date.rep): | + | The global report is attached to the principal python script folder (Report_date.rep). \\ \\ |
+ | It contains the following information: | ||
* Number of tests | * Number of tests | ||
* Global error | * Global error | ||
Line 42: | Line 53: | ||
* List of failed tests (if the test battery is failed) | * List of failed tests (if the test battery is failed) | ||
- | <imgcaption image6|Global report>{{ :battery:file6.jpg?600 |}}</imgcaption> | + | <imgcaption image6|Global report>{{ :battery:file6.jpg?700|}}</imgcaption> |
+ | \\ \\ | ||
+ | \\ \\ | ||
+ | ===== How to add your own test to the battery ===== | ||
+ | ==== Creating your test ==== | ||
+ | |||
+ | In order to ensure that your developments in the Lagamine code will keep functioning properly, it is highly recommanded that you add one or several tests specific to the law(s) or element(s) you use and develop. \\ \\ | ||
+ | To test a material law or an element, you should design a **simple test**, using only 1 element when possible. Preferably, your test should **not take more than a few seconds** to run. If you need to test something more complex, you can also create a "Big" test. However, the total number of Big tests should be limited to avoid excessive computational times for the whole test battery. \\ | ||
+ | //For instance, to test the visco-plastic 'CHAB' law, I created a test using a single element submitted to 2 cycles of alternated tension and compression (see [[battery:listtests:test7|CHAB_SC_TMF]]).// \\ | ||
+ | |||
+ | Once you have designed your test and created the necessary simulation files, you must identify the important variables that indicate whether your law/element is behaving as it should. \\ | ||
+ | //For the 'CHAB' law, I will check the values of the stress tensor, the thermal strain, the plastic strain along the loading direction, and the damage variables. These values can be obtained via the [[appendices:a9|*.ipe result file]].// \\ \\ **Be sure to print out the values you want to check at the time step(s) you see fit**. \\ To define the time steps at which you want a printing, you can use [[lagamex:auto#rd_line_14i5_-_strategy_control_data|ILSAV = 1 or 2]] in the ex.dat file. \\ Check [[appendices:a1|Appendix 1: Printing options]] and [[appendices:a9|Appendix 9: Printing files]] for more info about printing files. | ||
+ | |||
+ | ==== Comparator code ==== | ||
+ | After you have created your test and identified the variables that need to be checked, you need to write the comparator code. \\ \\ This code should be written in a Python script. If Python is not already installed on your computer, you can download it from the official Python website: [[https://www.python.org/downloads/|https://www.python.org/downloads/]] \\ Several editors exist to facilitate coding and debugging with Python. You can use [[https://www.spyder-ide.org/|Spyder]] or [[https://code.visualstudio.com/|Visual Studio Code]] for instance.\\ | ||
+ | |||
+ | For the comparator code, it is recommanded to use one of the existing comparators as an example. You can search in the Dokuwiki tests that use the same type of result files as you to find a code similar to what you should write. \\ | ||
+ | |||
+ | ==== Adding your test to the battery ==== | ||
- | ==== Summary ==== | + | To add a new test to the battery, you should: |
- | * To add a new test, the user should: | + | * Add the new test to "http://www.lagamine.uliege.be/dokuwiki/doku.php/battery/listtests" |
- | * Add the new test to "http://www.lagamine.uliege.be/dokuwiki/doku.php/battery/listtests" | + | * Modify the file **Test_battery.txt** on Obelix: add the name of the new test |
- | * Modify the file **Test_battery.txt**: add the name of the new test | + | * Add the folder containing your test to the test battery directory. This folder should contain: |
- | * Add the folder of the new test (to the test battery directory) containing: | + | * The files of simulation (with the same name as the test) |
- | * The files of simulation (with the same name of the test) | + | * The reference simulation folder (with the same name as the test + "_ref") |
- | * The reference simulation folder (with the same name of the test + "_ref") | + | * The comparator python script (with the same name as the test) |
- | * The comparator python script (with the same name of the test) (take an existing script and adapt it with the new test) | + | |