Commit 8f80be57 authored by Alex 's avatar Alex

added winglet test

parent 6337b320
Pipeline #20185 failed with stage
in 11 minutes and 13 seconds
......@@ -88,6 +88,7 @@ nosetests.xml
*.xyz
*.xyz.fvbnd
*.x2d
*x3d*
Icon?
ehthumbs.db
......
......@@ -4,6 +4,7 @@ import numpy as np
from PGL.components.blademesher import BladeMesher
def setup_mesher():
m = BladeMesher()
......@@ -155,78 +156,84 @@ class BladeMesherTest(unittest.TestCase):
def test_blade1(self):
baseline_data = {
'tip_patch_P-split0000': {'x_sum_abs': 5.6974016882430565, 'y_sum': 1085.1508542329643,
'y_sum_abs': 1085.1508542329643, 'x_sum': 5.6974016882430565,
'z_sum': -42.10550542241048, 'z_sum_abs': 42.10550542241048},
'tip_patch_P-split0001': {'x_sum_abs': 2.1420724346733073, 'y_sum': 1085.992738870277,
'y_sum_abs': 1085.992738870277, 'x_sum': -1.140812529123723,
'z_sum': -42.24531748475321, 'z_sum_abs': 42.24531748475321},
'tip_patch_S-split0001': {'x_sum_abs': 5.726984536386165, 'y_sum': 1085.2066811085128,
'y_sum_abs': 1085.2066811085128, 'x_sum': 5.726984536386165,
'z_sum': -41.603940295504174, 'z_sum_abs': 41.603940295504174},
'tip_patch_S-split0000': {'x_sum_abs': 2.138076711577545, 'y_sum': 1086.1312518147697,
'y_sum_abs': 1086.1312518147697, 'x_sum': -1.117247534605247,
'z_sum': -40.971562644114, 'z_sum_abs': 40.971562644114},
'main_section': {'x_sum_abs': 493.57518816567324, 'y_sum': 20266.15961960983,
'y_sum_abs': 20266.15961960983, 'x_sum': 121.42585372971737,
'z_sum': -579.689977355315, 'z_sum_abs': 708.9778259536268}
'tip_patch_P-split0000': {'x_sum_abs': 5.6974016882430565, 'y_sum': 1085.1508542329643,
'y_sum_abs': 1085.1508542329643, 'x_sum': 5.6974016882430565,
'z_sum': -42.10550542241048, 'z_sum_abs': 42.10550542241048},
'tip_patch_P-split0001': {'x_sum_abs': 2.1420724346733073, 'y_sum': 1085.992738870277,
'y_sum_abs': 1085.992738870277, 'x_sum': -1.140812529123723,
'z_sum': -42.24531748475321, 'z_sum_abs': 42.24531748475321},
'tip_patch_S-split0001': {'x_sum_abs': 5.726984536386165, 'y_sum': 1085.2066811085128,
'y_sum_abs': 1085.2066811085128, 'x_sum': 5.726984536386165,
'z_sum': -41.603940295504174, 'z_sum_abs': 41.603940295504174},
'tip_patch_S-split0000': {'x_sum_abs': 2.138076711577545, 'y_sum': 1086.1312518147697,
'y_sum_abs': 1086.1312518147697, 'x_sum': -1.117247534605247,
'z_sum': -40.971562644114, 'z_sum_abs': 40.971562644114},
'main_section': {'x_sum_abs': 493.57518816567324, 'y_sum': 20266.15961960983,
'y_sum_abs': 20266.15961960983, 'x_sum': 121.42585372971737,
'z_sum': -579.689977355315, 'z_sum_abs': 708.9778259536268}
}
for name, data in list(self.m.domain.blocks.items()):
if not ("copy" in name):
for co in ["x", "y", "z"]:
self.assertAlmostEqual(baseline_data[name]["%s_sum"%co],np.sum(getattr(data, co)),6)
self.assertAlmostEqual(baseline_data[name]["%s_sum_abs"%co],np.sum(abs(getattr(data, co))),6)
self.assertAlmostEqual(
baseline_data[name]["%s_sum" % co], np.sum(getattr(data, co)), 6)
self.assertAlmostEqual(
baseline_data[name]["%s_sum_abs" % co], np.sum(abs(getattr(data, co))), 6)
def test_blade2(self):
baseline_data = {
'tip_patch_S-split0000-copy': {'x_sum_abs': 941.1758796830864, 'y_sum': -542.0980611601009,
'y_sum_abs': 542.0980611601009, 'x_sum': 941.1758796830864,
'z_sum': -40.971562644114, 'z_sum_abs': 40.971562644114},
'main_section-copy': {'x_sum_abs': 17490.29614086763, 'y_sum': -10238.23768381106,
'y_sum_abs': 10248.002256316091, 'x_sum': 17490.29614086763,
'z_sum': -579.689977355315, 'z_sum_abs': 708.9778259536268},
'tip_patch_S-split0001-copy': {'x_sum_abs': 936.9530619283775, 'y_sum': -547.5630546498473,
'y_sum_abs': 547.5630546498473, 'x_sum': 936.9530619283775,
'z_sum': -41.603940295504174, 'z_sum_abs': 41.603940295504174},
'tip_patch_P-split0001-copy': {'x_sum_abs': 941.0677064516619, 'y_sum': -542.0083968039614,
'y_sum_abs': 542.0083968039614, 'x_sum': 941.0677064516619,
'z_sum': -42.24531748475321, 'z_sum_abs': 42.24531748475321},
'tip_patch_P-split0000-copy': {'x_sum_abs': 936.91950586001, 'y_sum': -547.5095217140647,
'y_sum_abs': 547.5095217140647, 'x_sum': 936.91950586001,
'z_sum': -42.10550542241048, 'z_sum_abs': 42.10550542241048}
'tip_patch_S-split0000-copy': {'x_sum_abs': 941.1758796830864, 'y_sum': -542.0980611601009,
'y_sum_abs': 542.0980611601009, 'x_sum': 941.1758796830864,
'z_sum': -40.971562644114, 'z_sum_abs': 40.971562644114},
'main_section-copy': {'x_sum_abs': 17490.29614086763, 'y_sum': -10238.23768381106,
'y_sum_abs': 10248.002256316091, 'x_sum': 17490.29614086763,
'z_sum': -579.689977355315, 'z_sum_abs': 708.9778259536268},
'tip_patch_S-split0001-copy': {'x_sum_abs': 936.9530619283775, 'y_sum': -547.5630546498473,
'y_sum_abs': 547.5630546498473, 'x_sum': 936.9530619283775,
'z_sum': -41.603940295504174, 'z_sum_abs': 41.603940295504174},
'tip_patch_P-split0001-copy': {'x_sum_abs': 941.0677064516619, 'y_sum': -542.0083968039614,
'y_sum_abs': 542.0083968039614, 'x_sum': 941.0677064516619,
'z_sum': -42.24531748475321, 'z_sum_abs': 42.24531748475321},
'tip_patch_P-split0000-copy': {'x_sum_abs': 936.91950586001, 'y_sum': -547.5095217140647,
'y_sum_abs': 547.5095217140647, 'x_sum': 936.91950586001,
'z_sum': -42.10550542241048, 'z_sum_abs': 42.10550542241048}
}
for name, data in list(self.m.domain.blocks.items()):
if ("copy" in name) and not ("copy-0001" in name):
for co in ["x", "y", "z"]:
self.assertAlmostEqual(baseline_data[name]["%s_sum"%co],np.sum(getattr(data, co)),6)
self.assertAlmostEqual(baseline_data[name]["%s_sum_abs"%co],np.sum(abs(getattr(data, co))),6)
self.assertAlmostEqual(
baseline_data[name]["%s_sum" % co], np.sum(getattr(data, co)), 6)
self.assertAlmostEqual(
baseline_data[name]["%s_sum_abs" % co], np.sum(abs(getattr(data, co))), 6)
def test_blade3(self):
baseline_data = {
'tip_patch_S-split0000-copy-0001': {'x_sum_abs': 940.0586321484813, 'y_sum': -544.0331906546683,
'y_sum_abs': 544.0331906546683, 'x_sum': -940.0586321484813,
'z_sum': -40.971562644114, 'z_sum_abs': 40.971562644114},
'tip_patch_S-split0001-copy-0001': {'x_sum_abs': 942.6800464647637, 'y_sum': -537.6436264586653,
'y_sum_abs': 537.6436264586653, 'x_sum': -942.6800464647637,
'z_sum': -41.603940295504174, 'z_sum_abs': 41.603940295504174},
'tip_patch_P-split0001-copy-0001': {'x_sum_abs': 939.9268939225382, 'y_sum': -543.9843420663149,
'y_sum_abs': 543.9843420663149, 'x_sum': -939.9268939225382,
'z_sum': -42.24531748475321, 'z_sum_abs': 42.24531748475321},
'main_section-copy-0001': {'x_sum_abs': 17611.72199459735, 'y_sum': -10027.921935798762,
'y_sum_abs': 10037.076007303374, 'x_sum': -17611.72199459735,
'z_sum': -579.689977355315, 'z_sum_abs': 708.9778259536268},
'tip_patch_P-split0000-copy-0001': {'x_sum_abs': 942.616907548253, 'y_sum': -537.6413325188992,
'y_sum_abs': 537.6413325188992, 'x_sum': -942.616907548253,
'z_sum': -42.10550542241048, 'z_sum_abs': 42.10550542241048}
'tip_patch_S-split0000-copy-0001': {'x_sum_abs': 940.0586321484813, 'y_sum': -544.0331906546683,
'y_sum_abs': 544.0331906546683, 'x_sum': -940.0586321484813,
'z_sum': -40.971562644114, 'z_sum_abs': 40.971562644114},
'tip_patch_S-split0001-copy-0001': {'x_sum_abs': 942.6800464647637, 'y_sum': -537.6436264586653,
'y_sum_abs': 537.6436264586653, 'x_sum': -942.6800464647637,
'z_sum': -41.603940295504174, 'z_sum_abs': 41.603940295504174},
'tip_patch_P-split0001-copy-0001': {'x_sum_abs': 939.9268939225382, 'y_sum': -543.9843420663149,
'y_sum_abs': 543.9843420663149, 'x_sum': -939.9268939225382,
'z_sum': -42.24531748475321, 'z_sum_abs': 42.24531748475321},
'main_section-copy-0001': {'x_sum_abs': 17611.72199459735, 'y_sum': -10027.921935798762,
'y_sum_abs': 10037.076007303374, 'x_sum': -17611.72199459735,
'z_sum': -579.689977355315, 'z_sum_abs': 708.9778259536268},
'tip_patch_P-split0000-copy-0001': {'x_sum_abs': 942.616907548253, 'y_sum': -537.6413325188992,
'y_sum_abs': 537.6413325188992, 'x_sum': -942.616907548253,
'z_sum': -42.10550542241048, 'z_sum_abs': 42.10550542241048}
}
for name, data in list(self.m.domain.blocks.items()):
if ("copy-0001" in name):
for co in ["x", "y", "z"]:
self.assertAlmostEqual(baseline_data[name]["%s_sum"%co],np.sum(getattr(data, co)),6)
self.assertAlmostEqual(baseline_data[name]["%s_sum_abs"%co],np.sum(abs(getattr(data, co))),6)
self.assertAlmostEqual(
baseline_data[name]["%s_sum" % co], np.sum(getattr(data, co)), 6)
self.assertAlmostEqual(
baseline_data[name]["%s_sum_abs" % co], np.sum(abs(getattr(data, co))), 6)
def test_pitch_20(self):
......@@ -247,11 +254,11 @@ class BladeMesherTest(unittest.TestCase):
m.domain.rotate_z(120, groups=['blade1'], copy=True)
self.assertAlmostEqual(m.domain.blocks['main_section'].x.sum(),
312.3037097049248, 6)
312.3037097049248, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].y.sum(),
20266.66355809682, 6)
20266.66355809682, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].z.sum(),
-503.28381782899453, 6)
-503.28381782899453, 6)
def test_pitch_50(self):
......@@ -272,11 +279,11 @@ class BladeMesherTest(unittest.TestCase):
m.domain.rotate_z(120, groups=['blade1'], copy=True)
self.assertAlmostEqual(m.domain.blocks['main_section'].x.sum(),
521.9783924777187, 6)
521.9783924777187, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].y.sum(),
20266.343445536626, 6)
20266.343445536626, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].z.sum(),
-279.622444906843, 6)
-279.622444906843, 6)
def test_pitch_90(self):
......@@ -297,11 +304,12 @@ class BladeMesherTest(unittest.TestCase):
m.domain.rotate_z(120, groups=['blade1'], copy=True)
self.assertAlmostEqual(m.domain.blocks['main_section'].x.sum(),
579.6934606103249, 6)
579.6934606103249, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].y.sum(),
20266.094182128963, 6)
20266.094182128963, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].z.sum(),
121.41242272937725, 6)
121.41242272937725, 6)
if __name__ == '__main__':
unittest.main()
......
......@@ -87,7 +87,31 @@ def setup_mesher():
return m
class WingletTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Assigning as a class variable
cls.m = setup_mesher()
def test_winglet(self):
m = self.m
self.assertAlmostEqual(m.domain.blocks['main_section'].x.sum(),
-204.7876005855526, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].y.sum(),
-713.692033234891, 6)
self.assertAlmostEqual(m.domain.blocks['main_section'].z.sum(),
21550.612603126672, 6)
if __name__ == '__main__':
# unittest.main()
m = setup_mesher()
m.domain.write_plot3d('test.xyz')
unittest.main()
if 0:
m = setup_mesher()
print(m.domain.blocks['main_section'].x.sum(),
m.domain.blocks['main_section'].y.sum(),
m.domain.blocks['main_section'].z.sum())
m.domain.write_plot3d('test.xyz')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment