CheckFiles

The CheckFiles tester simply checks if some files are output or not during a simulation. For example, this can be used to make sure that desired output is indeed created by a simulation.

Options

Test configuration options are added to the tests file.

  • check_files: A list of files that MUST exist

  • check_not_exists: A list of files that must NOT exist

  • file_expect_out: A regular expression that must occur in all of the check files in order for the test to be considered passing.

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

Example test configuration in the MOOSE test suite

In this example test configuration, three CheckFiles tests and a few other test types are used to check the proper operation of the mesh splitting functionality. The CheckFiles test check that the split mesh files do indeed exist after performing a mesh split.

[Tests]
  [make_split]
    type = 'CheckFiles'
    input = 'simple_diffusion.i'
    cli_args = '--split-mesh 3 --split-file foo Mesh/parallel_type=replicated'
    check_files = 'foo.cpa.gz/3/header.gz foo.cpa.gz/3/split-3-0.gz foo.cpa.gz/3/split-3-1.gz '
                  'foo.cpa.gz/3/split-3-2.gz'
    recover = false

    issues = '#10623 #27240'
    design = 'Mesh/splitting.md'
    requirement = 'A mesh can be split into a specified number of files using command line options.'
  []
  [use_split]
    requirement = 'A mesh can be pre-split properly and used to generate equivalent results to '
                  'running a simulation with the unsplit mesh when'
    issues = '#10623 #17318'
    design = 'Mesh/splitting.md'

    [from_cli]
      type = 'Exodiff'
      input = 'simple_diffusion.i'
      exodiff = 'simple_diffusion_out.e'
      cli_args = '--use-split --split-file foo UserObjects/splittester/type=SplitTester'
      prereq = 'make_split'
      min_parallel = 3
      max_parallel = 3

      detail = 'set by command line, no split extension specified'
    []
    [from_cli_ext]
      type = 'RunApp'
      input = 'simple_diffusion.i'
      cli_args = '--use-split --split-file foo.cpa.gz UserObjects/splittester/type=SplitTester'
      prereq = 'make_split'
      min_parallel = 3
      max_parallel = 3

      detail = 'set by command line, with a specified split extension'
    []
    [from_input]
      type = 'Exodiff'
      input = 'simple_diffusion.i'
      exodiff = 'simple_diffusion_out.e'
      cli_args = 'Mesh/use_split=true Mesh/split_file=foo UserObjects/splittester/type=SplitTester'
      prereq = 'use_split/from_cli'
      min_parallel = 3
      max_parallel = 3

      detail = 'set by an input parameter'
    []
  []

  [check]
    issues = '#11825'
    design = 'Mesh/splitting.md'
    requirement = 'Console output should include an indicator that a pre-split mesh is being used '
                  'when using --split-mesh in distributed = auto mode'

    [pre_split]
      type = 'RunApp'
      input = 'simple_diffusion.i'
      cli_args = '--use-split --split-file foo UserObjects/splittester/type=SplitTester '
                 'Outputs/exodus=false'
      expect_out = 'Parallel Type:\s+distributed \(pre-split\)'
      prereq = 'make_split'
      min_parallel = 3
      max_parallel = 3

      detail = "without and"
    []

    [forced_pre_split]
      type = 'RunApp'
      input = 'simple_diffusion.i'
      cli_args = '--use-split --split-file foo Mesh/parallel_type=replicated '
                 'UserObjects/splittester/type=SplitTester Outputs/exodus=false'
      expect_out = 'Parallel Type:\s+distributed \(forced, pre-split\)'
      prereq = 'make_split'
      min_parallel = 3
      max_parallel = 3

      detail = "with the forced option."
    []
  []

  [split_with_distributed_error]
    type = 'RunException'
    input = 'simple_diffusion.i'
    cli_args = '--split-mesh 3 --split-file foo'
    expect_err = 'You cannot use the mesh splitter capability with DistributedMesh!'
    mesh_mode = DISTRIBUTED

    issues = '#11434'
    design = 'Mesh/splitting.md'
    requirement = 'The mesh splitter will throw an error when an attempt is made to split a '
                  '"DistributedMesh".'
  []

  [split_with_RM_part1]
    type = 'CheckFiles'
    input = 'geometric_neighbors.i'
    cli_args = '--split-mesh 2 --split-file geometric_neighbors Mesh/parallel_type=replicated'
    check_files = 'geometric_neighbors.cpa.gz/2/header.gz geometric_neighbors.cpa.gz/2/split-2-0.gz '
                  'geometric_neighbors.cpa.gz/2/split-2-1.gz'
    recover = false
    compiler = '!INTEL'
    petsc_version = '>=3.8.0'

    issues = '#11434 #27240'
    design = 'Mesh/splitting.md'
    requirement = 'The mesh splitter capability will honor geometric RelationshipManager objects.'
  []

  [split_with_RM_part2]
    type = 'Exodiff'
    input = 'geometric_neighbors.i'
    cli_args = '--use-split --split-file geometric_neighbors '
               'Outputs/file_base=geometric_edge_two_2D_out'
    exodiff = 'geometric_edge_two_2D_out.e'
    recover = false
    compiler = '!INTEL'
    petsc_version = '>=3.8.0'

    min_parallel = 2
    max_parallel = 2
    prereq = 'split_with_RM_part1'

    issues = '#11434'
    design = 'Mesh/splitting.md'
    requirement = 'Meshes that are pre-split with active RelationshipManager objects work the same '
                  'as if using an online DistributedMesh.'
  []

  [grid_from_file]
    type = 'CheckFiles'
    input = 'grid_from_file.i'
    cli_args = '--split-mesh 4'
    check_files = 'grid_from_file.cpa.gz/4/header.gz grid_from_file.cpa.gz/4/split-4-0.gz grid_from_file.cpa.gz/4/split-4-1.gz grid_from_file.cpa.gz/4/split-4-2.gz grid_from_file.cpa.gz/4/split-4-3.gz'
    recover = false
    min_parallel = 2
    max_parallel = 2
    issues = "#11944"
    design = 'Mesh/splitting.md'
    requirement = 'Splitting meshes from file should work with custom partitioners.'
    mesh_mode = REPLICATED
  []

  [grid_from_generated]
    type = 'CheckFiles'
    input = 'grid_from_generated.i'
    cli_args = '--split-mesh=4 --split-file=grid_from_generated'
    check_files = 'grid_from_generated.cpa.gz/4/header.gz grid_from_generated.cpa.gz/4/split-4-0.gz grid_from_generated.cpa.gz/4/split-4-1.gz grid_from_generated.cpa.gz/4/split-4-2.gz grid_from_generated.cpa.gz/4/split-4-3.gz'
    recover = false
    min_parallel = 2
    max_parallel = 2
    issues = "#11944"
    design = 'Mesh/splitting.md'
    requirement = 'Splitting meshes from a generated mesh should work with custom partitioners.'
    mesh_mode = REPLICATED
  []

  [meshgenerators_acting_on_split]
    type = 'Exodiff'
    input = 'extrude_from_split.i'
    cli_args = '--mesh-only'
    mesh_mode = DISTRIBUTED
    exodiff = 'extrude_from_split_in.e'
    recover = false

    min_parallel = 3
    max_parallel = 3
    prereq = 'use_split/from_input'

    issues = '#18635 #27240'
    design = 'Mesh/splitting.md FileMeshGenerator.md'
    requirement = 'The system should be able to load a pre-split mesh and perform additional mesh generation on it.'
  []
[]
(contrib/moose/test/tests/mesh/splitting/tests)