Tag Info

11

The problem with testing numerical codes is that (i) you may not always know the exact output and you will only be able to save the result of a computation now to compare against later -- i.e., to do regression tests, and (ii) that results may differ by small amounts on different machines due to different round-off. To see how deal.II does it, take a look ...

10

I don't think you can avoid using a tolerance for floating-point comparisons. Error due to round-off, discretization, and so on using floating-point numbers is unavoidable. What I typically do to test FEM code I write is: test the stiffness & mass matrices on a single element to make sure I get local element assembly right, compare against a known ...

10

I've recently been using googletest for testing a couple numerical libraries that I work on, and have been very happy with it. You can write fairly simple tests very quickly or you can write complicated tests that require data initialization and so on. It also provides (like I'm sure many others do) ways to easily do floating point comparisons rather than ...

10

Method of manufactured solutions. Verify through refinement studies that the method achieves the theoretical order of accuracy. Conservation of answer. Bit-wise and norm-wise reproduction of solutions.

9

I'm a happy user of GoogleTest with a C++ MPI code in a CMake/CTest build environment: CMake automatically installs/links googletest from svn! adding tests is a one-liner! writing the tests is easy! (and google mock is very powerful!) CTest can pass command-line parameters to your tests, and exports data to CDash! This is how it works. A batch of unit-...

9

The condition number of sum $s(x) = \sum_{j=1}^n x_j$ is given by $$\kappa(x) = \frac{\sum_{j=1}^n |x_j|}{|\sum_{j=1}^n x_j|} = \frac{s(|x|)}{|s(x)|}$$ and reflects the sums sensitivity to small changes in the input. Specifically, we have  \underset{\epsilon \rightarrow 0_+}{\lim}\sup \left\{ \frac{1}{\epsilon} \left|\frac{s(x+\Delta x) - s(x)}{s(x)} \...

8

In computational electromagnetism, there is a famous (or infamous because of the difficulties in some) set of test problems: Testing Electromagnetic Analysis Methods (T.E.A.M.). Some of them really need seriously state-of-art numerical techniques to get the correct simulation results aligned with the experimental data. For example, the conductor-coil ...

7

Geoff has already given an excellent overview, but I wanted to provide another real world look on it. In the deal.II project (http://www.dealii.org/) we run some 7,000 tests with every change in the code base, on multiple platforms. The tests Geoff describes are mostly "integration tests", i.e., they run through a significant part of the code base. You need ...

7

There are many good open-source implementations of root-finding methods out there already. One example is boost, whose implementation of Newton-Raphson and related methods you can find here. If you read its source code, you will be able to see what issues the authors wanted to address, and how they dealt with issues like convergence, user-specified tolerance ...

7

Bill has already listed a few methods which address your concerns. Addressing your third point, no, there is no reason to introduce strong coupling between parts. Just the opposite: if your functions or classes have well defined interfaces, it will be much easier to exchange for instance a linear solver for another, or a time stepping scheme. Just resist it,...

7

The typical approach to this problem is to use infinitely smooth functions like trigonometric, inverse trig, exponential, etc. There's a handy library called MASA that has a library of manufactured solutions and makes it easy to make your own. Your PDE coefficients will become parameters in the forcing function that your chosen solution leads to, so you ...

7

The problem of recording how a particular piece of scientific data was generated has come to be known as "provenance tracking". Here is an article on it which also includes the description of a software tool, Sumatra: http://rrcns.readthedocs.io/en/latest/provenance_tracking.html. Another, simpler Python tool to do something similar is recipy.

5

Ask your remote host to install what you need. We do this all the time for folks where I work. Typically they can help you out. Also, it's OK to do some of your development on your machine and then port your results to the remote machine.

5

As Maxim's comment points out, you ought to be able to create any solution you like, crank it through the original, continuous PDE, generate a forcing function, boundary conditions (time-dependent), and initial condition, plug those into your program, run it, and compare the answer you get to the function you started with. This is known as the Method of ...

4

If you're building your code with CMake, then the ctest mechanism would be the obvious choice. It allows you to test your code manually via the command ctest, and also supports extensive nightly testing via CDash.

4

To build on Bill Barth's commment, there really isn't any depth here. The equations you're trying to solve are: \begin{align} u_t + uu_x &= - \frac{1}{\rho}p_x + \nu u_{xx} \\ u_x & = 0 \end{align} Now, $u_x = 0$ immediately implies $u$ has no space-dependence, so we can write $u = f(t)$, for some time-dependent function $f: \mathbb{R} \to \mathbb{R}$...

4

There are several MPI-enabled software packages that use the CMake set of tools for testing. The ones that I can think of off the top of my head are Trilinos, VTK and ParaView. I would think that you don't want to assume that the executable needs to be launched with mpirun and/or mpiexec. CMake has support for specifying how to properly launch the executable ...

4

We simply roll our own code in deal.II -- in essence, we tell the framework to execute tests using mpirun -np .... We had previously just used a Makefile-based testing scheme (compile, link, execute test, then compare the output with one that had previously been saved) and you can find this here: https://svn.dealii.org/branches/releases/Branch-8-0/tests/mpi/...

4

I want to add something not mentioned yet here that might be useful (too long for a comment), because you say that syncing with git is a pain. There is the tool sshfs (and I believe its osx equivalent is osxfuse). If your remote machine allows ssh connections, sshfs will be able to mount the remote filesystem locally over ssh. This is useful if, as I think ...

4

Try looking into the solutions available within MASA. MASA is a library of manufactured solutions containing many steady and transient problems for the flow physics you describe. These don't tend to be "interesting" in the sense that one stares at the results because they describe canonical engineering flows. However, they're "interesting" in the sense ...

4

Chapter 7 of the (free in PDF form) book "I do like CFD, Vol. 1" collects many different known solutions for multidimensional flows that can be used for benchmarking.

4

The first two can be decomposed into a system of first-order advection equations of which there are a number of standard test problems often involving both smooth and discontinuous initial conditions and all of which can be solved analytically. For instance this solution is to the linearized acoustics equations. The choice between one or the other is ...

4

I use the following website http://www.cise.ufl.edu/research/sparse/matrices/ and, in particular, this collection http://yifanhu.net/GALLERY/GRAPHS/search.html when I need to find certain kind of matrices. Another large collection of matrices is MatrixMarket, though it is a little bit outdated in my opinion. If you search for rectangular matrices, you ...

4

1. This type of test appears to me to be poorly defined because its test condition is tied to the particular machine on which you did tests in development. One of the points of testing is that running your tests on my laptop tells me whether there's something wrong with the code or the environment I've set up. The 53 seconds is specific to your development ...

3

One thing you can do for smoke testing is to take a known solution $x$ (you could generate it randomly or pick something convenient) and a known matrix $A$, and then set $b$ equal to $Ax$, and solve the equation $Ax = b$ to see if you recover your known solution. This method is known as the method of manufactured solutions. To avoid the influence of ...

3

The Teuchos Unit test harness in Trilinos natively supports unit tests that use MPI. Things like controlling output from multiple processes and aggregating pass/fail over all processes is automatic. Take a look: http://trilinos.org/docs/dev/packages/teuchos/doc/html/group__Teuchos__UnitTest__grp.html

3

I recently found this thesis on TDD in Computational Science. I haven't read it yet so I have no idea if it is any good, but hopefully it can be of some help. http://cyber.ua.edu/files/2014/12/u0015_0000001_0001551.pdf

3

There is a collection of reference PDE-constrained optimization problems maintained by Roland Herzog at TU-Chemnitz here.

3

A few additional points I would like to add to other answers. Corner test cases should be part of the regression test suite - ill conditioned problems, ill conditioned - bad aspect ratios, orthotropic and un-isotropic material properties, improperly constrained models. Make sure reaction forces match. Sturm checks for eigenvalue problems especially when ...

3

There are several benchmarks, like the flow around a cylinder, which is described in details at the FEATFLOW web page here. It is a well defined configuration of a flow passing by a cylinder obstacle and values such as the drag and lift can be compared with values obtained with different softwares (a file containing the data is provided). Otherwise there ...

Only top voted, non community-wiki answers of a minimum length are eligible