Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/Tests/ElmerIceSolver_test_how-to.txt
3204 views
1
ElmerIce Solver test case "How-to"
2
==================================
3
4
This How-to describes how to create and use test cases in software
5
development and case definition.
6
7
The test cases are used to check for possible bugs, and to ensure
8
backward compatibility. For that purpose they are currently around
9
30 repertories (Dec 2013) . The tests should be located in directory
10
11
fem/elmerice/Tests
12
13
To run the cases in Unix you can go the the directory tests, update
14
script with command line:
15
16
runTest.sh (with options or not)
17
18
A. Options
19
===========
20
See details for the 4 options and one default option ( "", --help , --all,
21
--selection, --solvers).
22
23
1) --all or -a
24
it runs all tests with possibility to send results by e-mail.
25
26
2) --selection or -s
27
it runs only selection of repertory with "space-separator" with
28
possibility to send results by e-mail.
29
30
3) --solvers or -so
31
You choose one ElmerIceSolver keyword and it runs all repertories with this
32
solver (possibility to send results by e-mail).
33
34
4) Default case: all test cases without mail option.
35
36
B. How to create a test
37
========================
38
39
When a new feature has been verified it is often a good idea to
40
create a test case that ensures the feature will be
41
maintained also in the future versions of Elmer. To do this:
42
43
1) Create new directory in the "tests" directory under fem/elmerice. The folders
44
in this directory will be automatically scanned and tests run.
45
46
2) Define your analysis write your .sif file, mesh files
47
etc. necessary to run the test analysis ELMERSOLVER_STARTINFO
48
49
******
50
! Note, for the outputs, files named "results.dat" and "result.dat.names" have to be created
51
! If do not exist, you can write a script to configure their creation
52
! see /tests/InvMeth_AdjBeta for example).
53
******
54
55
3) Define how to run the test write a Makefile (named Makefile), that
56
details two targets:
57
+ run: how to run the test
58
+ clean: how to clean up if successful
59
60
4) Define expected results and create repertory /DATA in which will be put expected
61
results in a file named "valid_$NameRepertory.txt" (See description in the template above:
62
63
Step1Data1 [space] Step1Data2 [space] Step1Data3 ....
64
Step2Data1 [space] Step2Data2 [space] Step2Data3 ....
65
66
Create a file named version to describe author and date of the test, Research Institute & Cluster, Elmer(/Ice) version:
67
Example file established:
68
30.01.2014
69
Laure Tavard,LGGE
70
LGGE Lachouf cluster
71
Revision 6515
72
73
5 ) If you have access right to the svn you may also
74
75
svn add mytestcase
76
svn commit mytestcase
77
78
Note, test failed in case where difference between results are upper 1E-6.
79
You can define your own TARGET in your *.sif with line:
80
$fprintf( stderr, "TARGET=<target>\n" );
81
82
83
D. Results
84
=====================
85
On screen
86
---------
87
Test will print some information for each test-case:
88
<Test Number> <Test Name> [<Result>]
89
In <Result>, [FAILED] in case where difference between results are upper 1E-6
90
[PASSED] in case where there is no difference
91
[PASSED - Diff Time-] where there is a difference with time CPU
92
93
In repertory File_log/
94
----------------------
95
We will found 2 files per test if there is difference between results:
96
one is the resume of your simulation (OutputSIF_<name>.log) and the other the
97
resume of difference between results (Output_<name>).log
98
99
100
E. How to use the test case as starting point
101
==============================================
102
103
One can take these tests as a starting point or copy-paste
104
appropriate solver sections from there. These tests do not include
105
any ElmerGUI project file and therefore the graphical user interface
106
cannot be used to view these cases. You can look at the Makefile in
107
each test to see what sequence of command is usually needed. Typically
108
some simple ascii definition for the mesh is used and the running of
109
the case could be something like
110
111
ElmerGrid 1 2 square
112
ElmerSolver mytest.sif
113
114