This directory contains tests for FANS. Tests serve two purposes:
- Verify the correct functioning of the code.
- Provide example problems that demonstrate how FANS can be used.
The test directory includes:
CMakeLists.txt- Configures tests for CTest integrationinput_files/- Example input JSON files for each test case- Python based validation tests in
pytest/directory for validating results
Tests are configured by CMake when FANS is built. If your CMake build folder is named build, run the FANS tests in the following way
cd ../build
ctest fansThis will run all test cases and generate result files in build/test/.
After running the tests, the results are verified using pytest. We recommend running pytest via a pre-configured Pixi task,
pixi run -e dashboard pytestNote: The validation tests expect result files to be in build/test/ directory, so make sure to run the tests first.
For a 3D microstructure image of resolution 32 x 32 x 32 with a single spherical inclusion, the following test cases are available:
- Linear thermal homogenization problem with isotropic heat conductivity -
test_LinearThermal.json - Small strain mechanical homogenization problem with linear elasticity -
test_LinearElastic.json - Small strain mechanical homogenization problem with nonlinear pseudoplasticity -
test_PseudoPlastic.json - Small strain mechanical homogenization problem with Von-Mises plasticity -
test_J2Plasticity.json - Small strain mechanical homogenization problem with linear pseudoplasticity and mixed stress-strain control boundary conditions -
test_MixedBCs.json - Large strain mechanical homogenization problem with compressible Neo-Hookean model -
test_CompressibleNeoHookean.json - Large strain mechanical homogenization problem and mixed stress-strain control boundary conditions -
test_MixedBCs_LargeStrain.json
Each test case has corresponding input JSON files in the input_files/ directory. Tests can be run individually as example problems. For instance,
mpiexec -n 2 ./FANS input_files/test_LinearElastic.json test_results.h5To quickly visualize the test results, and accompanying XDMF for the HDF5 output can be generated which can be directly opened in ParaView for 3D visualization and analysis:
pixi run h52xdmf test_results.h5