Source code for g3d.flow.tests.test_metrics

"""unit tests for metrics operators"""
import unittest

import os

if os.environ.get('__USE_CUDA', '0') == '1':
    import cupy as np
else:
    import numpy as np

from g3d.flow.tests import G3DFlowTestCase


[docs] class TestMetrics(G3DFlowTestCase):
[docs] def test_volume(self) -> None: wd = 'src/g3d/flow/tests/data' if not os.path.exists(wd): wd = 'g3d/flow/tests/data' if not os.path.exists(wd): wd = 'flow/tests/data' if not os.path.exists(wd): wd = 'tests/data' if not os.path.exists(wd): wd = 'data' self._define_case(wd, 'duct') vol = self._dom.get_volume() v_max = np.max(vol) v_min = np.min(vol) v_ave = np.average(vol) self.assertEqual(v_max, 0.0002777332436104833) self.assertEqual(v_min, 0.00015607242870948492) self.assertEqual(v_ave, 0.00020469314219578248)
[docs] def test_conv_metrics(self) -> None: self.assertEqual(1, 1)
[docs] def test_diff_metrics(self) -> None: self.assertEqual(1, 1)
[docs] def test_wall_diff_metrics(self) -> None: self.assertEqual(1, 1)
if __name__ == '__main__': unittest.main()