Skip to content

Additional Unit Tests for MATLAB source code #308

@mathgeek31415

Description

@mathgeek31415

Hi all,

In an effort to make the unit tests more robust, I would like to propose adding some more test cases for the library, starting on the MATLAB side.

Operators

Currently, the test suite for each mimetic operator only checks for the row sum property of each operator matrix. As an additional test, I believe for a $k$th order operator in $N$ dimensions ($N=1,2,3$), we should expect that when each operator (div, grad, and lap) is applied to a polynomial function of the form

$\sum_{i=1}^{N} x_i^k$

then the numerical calculation matches exactly the analytical calculation. So we can test each operator on a polynomial function sampled on an appropriate grid, and compare with the analytical derivatives of the polynomial function (again, on the appropriate grid points).

Boundary conditions

Additionally, I would like to extend the unit tests for the boundary conditions, specifically for the addScalarBC functions (in 1D, 2D, and 3D). Using the test cases from julia/MOLE.jl/test/BCs/scalarBC.jl as a reference, I think it would be good to check when no boundary conditions are given, when one of Dirichlet/Neumann are given, and then when both are given. This would give 4 test cases for each dimension of operator.

Summary

In summary, I would like to add the following:

  • 12 new test cases for the divergence (4 polynomial examples in each of 1D, 2D, and 3D)

  • 12 new test cases for the gradient (4 polynomial examples in each of 1D, 2D, and 3D)

  • 12 new test cases for the laplacian (4 polynomial examples in each of 1D, 2D, and 3D)

  • 4 new test cases for each of addScalarBC1D, addScalarBC2D, and addScalarBC3D

Total new test cases: 48

Please let me know if there are any questions or concerns about this proposed addition. Thank you!

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions