LLNL / serac

Serac is a high order nonlinear thermomechanical simulation code
BSD 3-Clause "New" or "Revised" License
178 stars 33 forks source link

Guard buckling example #1216

Closed chapman39 closed 2 weeks ago

chapman39 commented 3 weeks ago

I found this error when building LiDO codeveloping Serac. LiDO does not enable PETSc by default (though perhaps we should), which caused this error.

/usr/workspace/meemee/lido-2.0/repo/smith/serac/examples/buckling/cylinder.cpp:46:52: error: no member named 'stringToPetscPCType' in namespace 'serac::mfem_ext'
  return std::to_string(static_cast<int>(mfem_ext::stringToPetscPCType(in)));
                                         ~~~~~~~~~~^
/usr/workspace/meemee/lido-2.0/repo/smith/serac/examples/buckling/cylinder.cpp:103:62: error: no member named 'stringToPetscPCType' in namespace 'serac::mfem_ext'
            return std::to_string(static_cast<int>(mfem_ext::stringToPetscPCType(in)));
                                                   ~~~~~~~~~~^

The buckling example should also be guarded with PETSC_FOUND. https://github.com/LLNL/serac/blob/develop/examples/buckling/CMakeLists.txt#L7

if(TRIBOL_FOUND AND PETSC_FOUND)
    blt_add_executable( NAME        buckling_cylinder
                        SOURCES     cylinder.cpp
                        OUTPUT_DIR ${EXAMPLE_OUTPUT_DIRECTORY}
                        DEPENDS_ON  serac_physics serac_mesh
                        )
endif()

To prevent things like this, it may be beneficial to add a test that disables PETSc, similar to what we do with Tribol and Sundials. And to minimize the number of jobs, maybe we could also mash the disable-X tests together? (i.e. test no petsc, sundials, tribol all together?)