/ proof-of-concept / cymsim
Sign in
proof-of-concept / cymsim
cymsim / tests / conftest.py
25 lines · 846 BBlameHistoryRaw
1import logging
2import os
4import pytest
6# The tests run on the CPU, where runs are reproducible bit for bit (on a GPU, scatter-adds by
7# atomics make two identical runs differ slightly). JAX_PLATFORMS=cuda runs them on a GPU, where
8# the tests comparing separate runs exactly are expected to fail.
9os.environ.setdefault("JAX_PLATFORMS", "cpu")
11from cymsim.config import SimulationConfig, default_config
13logging.getLogger("cymsim").setLevel(logging.WARNING)
16@pytest.fixture(scope="session")
17def coarse_config() -> SimulationConfig:
18 """A 20 mm mesh with few dents: fast enough for CPU tests, still the full model."""
19 cfg = default_config("mallet")
20 cfg.mesh.element_size = 0.02
21 cfg.imperfections.n_dents = 50
22 cfg.numerics.duration = 0.02
23 cfg.numerics.steps_per_block = 500
24 cfg.numerics.n_progress = 2
25 return cfg
↑↓ move↵openescclose