AnalyzeJacobian

The AnalyzeJacobian tester uses the analyze_jacobian.py Jacobian debugger in MOOSE to evaluate the quality of the Jacobians in the specified tests.

Options

Test configuration options are added to the tests file.

  • expect_out: a regular expression that must occur in the input in order for the test to be considered passing.

  • resize_mesh: whether to resize the input mesh, defaults to False

  • off_diagonal: whether to also test the off-diagonal Jacobian entries, defaults to True

  • mesh_size: degree of refinement of the mesh size, to set if resize_mesh is True

Other test commands & restrictions may be found in the TestHarness documentation.

Example test configuration in the MOOSE test suite

In this example, three AnalyzeJacobian tests are created to check the Jacobian created by a finite difference preconditioner. The success of the Jacobian analysis is checked by looking for the string "No errors detected" in the output.

[Tests]
  design = 'FiniteDifferencePreconditioner.md'
  issues = '#13232'
  [./jacobian_fdp_coloring_full_test]
    type = AnalyzeJacobian
    input = fdp_test.i
    expect_out = '\nNo errors detected. :-\)\n'
    recover = false
    petsc_version = '<3.9.0 || >=3.9.4'
    mesh_mode = REPLICATED
    cli_args = 'Preconditioning/FDP/full=true'
    requirement = "The system shall produce a perfect coloring for the Jacobian when using the finite difference preconditioner."
  [../]
  [./jacobian_fdp_standard_test]
    type = AnalyzeJacobian
    input = fdp_test.i
    expect_out = '\nNo errors detected. :-\)\n'
    recover = false
    mesh_mode = REPLICATED
    cli_args = 'Preconditioning/FDP/finite_difference_type=standard'
    prereq = 'jacobian_fdp_coloring_full_test'
    requirement = "The system shall produce a perfect Jacobian when using the stadard finite difference preconditioner."
  [../]
  [./jacobian_fdp_coloring_diagonal_test_fail]
    type = AnalyzeJacobian
    input = fdp_test.i
    expect_out = 'Off-diagonal Jacobian.*needs to be implemented'
    recover = false
    mesh_mode = REPLICATED
    prereq = 'jacobian_fdp_standard_test'
    requirement = "The system shall detect missing off-diagonal Jacobian entries when using a full
                   finite different preconditioner."
  [../]
[]
(test/tests/preconditioners/fdp/tests)