Running test cases

General discussion about Elmer
Post Reply
Gary R
Posts: 162
Joined: 12 Apr 2012, 07:23
Antispam: Yes
Location: Long Beach CA, USA

Running test cases

Post by Gary R »

Hi all,
Operating System: Debian GNU/Linux 11
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.0-13-amd64
OS Type: 64-bit
Processors: 4 × AMD FX(tm)-4350 Quad-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: AMD CAICOS

For the first time, I am diving into the test cases
$HOME/Elmer/elmerfem-release-9.0/fem/tests/
and am confused about how to run the cases. Reading the .sif files is a help but it would be nice to be able to run the test and display the result in paraview. This may be easy for command line types but I am an inveterate GUI user and having trouble fitting things together. A quick work flow note would be very helpful.

Gary R
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Running test cases

Post by kevinarden »

There is usually a script file in the folder that runs the test case it usually builds the model creates the mesh and rune the solver. I read the script file to see what it is doing and then repeat the steps using the gui or the command line
Rich_B
Posts: 421
Joined: 24 Aug 2009, 20:18

Re: Running test cases

Post by Rich_B »

Hello,

Take a look at chapter 7 in GetStartedElmer.pdf, there are detailed instructions about using the command prompt with Elmer. Although the instructions are mostly targeted for Windows, the principles can be applied in Linux.

Take for example the test folder 'elmerfem\fem\tests\adv_diff1'. The runtest.cmake contains a cmake script that includes how to generate the mesh. One would just translate the command 'execute_process(COMMAND ${ELMERGRID_BIN} 1 2 Step)' to a command line input of 'elmergrid 1 2 step'. Then enter 'elmersolver' to run the test.

The above two commands can be combined into a script file. In Linux, use a text editor to create a file named 'run.sh', and add the following two lines, save and close the file.

elmergrid 1 2 step
elmersolver

Open a terminal window in the folder and enter 'run.sh', and it should run. The mode of the file 'run.sh' may need to be changed to 'executable'.

Rich.
Gary R
Posts: 162
Joined: 12 Apr 2012, 07:23
Antispam: Yes
Location: Long Beach CA, USA

Re: Running test cases (revisited)

Post by Gary R »

Hi all,
After reading my previous post, I realized that it was a bit misleading. I've been using Debian Linux on the command line for almost 30 years and am very conversant with shell scripts etc. I was referring to the command line with respect to Elmer only. That said, I still can't figure out how to run test cases. Specifically, I am interested in running the ShoeboxHarmonicPlate test case. The file contains the following:
-rw-r--r-- 1 gary gary 2755 Sep 25 2021 case.sif
drwxr-xr-x 2 gary gary 4096 May 30 16:46 CMakeFiles
-rw-r--r-- 1 gary gary 1292 Sep 25 2021 cmake_install.cmake
-rw-r--r-- 1 gary gary 1636 Nov 7 2021 CTestTestfile.cmake
-rw-r--r-- 1 gary gary 9 Nov 10 2020 ELMERSOLVER_STARTINFO
-rw-r--r-- 1 gary gary 7484 Nov 6 2021 Makefile
-rw-r--r-- 1 gary gary 717 Nov 10 2020 shoebox.grd
Could someone outline a step by step procedure that will run this test. A method to convert it to an ElmerGUI run-able file would also be nice. I'll take anything I can get.

Thanks
Gary R
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Running test cases

Post by kevinarden »

What I do is look at the runtest.cmake file in this case;

include(test_macros)
execute_process(COMMAND ${ELMERGRID_BIN} 1 2 shoebox)
RUN_ELMER_TEST()

means that they are using ElmerGrid to make the mesh

on a command line it would be

ElmerGrid 1 2 shoebox

this creates the elmer mesh is a directory called shoebox

the case.sif is already setup to run this mesh so I use

ElmerSolver case.sif
If I want to run it as is.

You can use ElmerGUI to load the mesh by using the load mesh menu option and load the mesh from that directory. You can also then start a new project from ElmerGUI with that mesh.

You can copy the files in a new directory first to have your own copy.

you only need teh grd file for ElmerGrid and the sif file for ElmerSolver
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Running test cases

Post by kevinarden »

You can also start ElmerGUI and do file open, navigate to that directory and open the grd file. This will bring up the mesh. However if you save in the same directory it will overwrite the case.sif file, so either rename it first, or save project in a different directory, If you save project in a different directory then a new case.sif is created and you need to copy over the one from the orginal test directory,

Many of the tests start with an elmer grd file that is converted to a mesh with ElmerGrid or can be opened in ElmerGUI. Some of the tests already have a generated mesh, or start with another format so the script first creates an elmer mesh using ElmerGrid and then runs a sif file using Elemer Solver, it is not always named case.sif. If it is named case.sif, then you have to be careful starting with ElmerGUI, because GUI overwrites a case.sif when opening a mesh.
Post Reply