Skip to content

Commit

Permalink
Merge branch 'add-Kernels' into pre-release-010
Browse files Browse the repository at this point in the history
  • Loading branch information
arturtoshev committed Jun 7, 2024
2 parents 65efb45 + 51a8b8e commit c6a14e6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/test_pf2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def run_simulation(tmp_path, tvf, solver):
return data_path


def get_solution(data_path, dir, t_dimless, y_axis):
def get_solution(data_path, t_dimless, y_axis):
from jax_sph.utils import sph_interpolator

dir = os.listdir(data_path)[0]
cfg = OmegaConf.load(data_path / dir / "config.yaml")
step_max = np.array(np.rint(cfg.solver.t_end / cfg.solver.dt), dtype=int)
digits = len(str(step_max))
Expand All @@ -107,11 +108,8 @@ def test_pf2d(tvf, solver, tmp_path, setup_simulation):
"""Test whether the poiseuille flow simulation matches the analytical solution"""
y_axis, t_dimless, ref_solutions = setup_simulation
data_path = run_simulation(tmp_path, tvf, solver)
subdirs = os.listdir(data_path)
# print(f"tmp_path = {tmp_path}, subdirs = {subdirs}")
solutions = get_solution(data_path, subdirs[0], t_dimless, y_axis)
solutions = get_solution(data_path, t_dimless, y_axis)
# print(f"solution: {solutions[-1]} \nref_solution: {ref_solutions[-1]}")
for solution, ref_solution in zip(solutions, ref_solutions):
assert np.allclose(
solution, ref_solution, atol=1e-2
), "Velocity profile does not match."
for sol, ref_sol in zip(solutions, ref_solutions):
assert np.allclose(sol, ref_sol, atol=1e-2), "Velocity profile does not match."

0 comments on commit c6a14e6

Please sign in to comment.