gamma dot unittest structure but still not passing
-import cases.templates.flying_wings as wings
import os
-import sharpy.sharpy_main
import numpy as np
import unittest
+import cases.templates.flying_wings as wings
+import sharpy.sharpy_main
+
def x_dot(x, dt, integration_order=2):
x_dot_r = np.zeros(len(x))
@@ -20,11 +21,13 @@ def x_dot(x, dt, integration_order=2):
return x_dot_r
-class Test_gamma_dot(unittest.TestCase):
+class TestGammaDot(unittest.TestCase):
def set_up_test_case(self, aero_type, predictor, sparse, integration_order):
# aero_type = 'lin'
+ global case_name
+ case_name = 'goland_' + aero_type + '_'+'P%g_S%g_I%g' %(predictor, sparse, integration_order)
ws = wings.Goland(M=12,
N=4,
Mstar_fact=50,
@@ -35,7 +38,7 @@ class Test_gamma_dot(unittest.TestCase):
physical_time=0.1,
n_surfaces=2,
route='cases',
- case_name='goland_' + aero_type + '_'+'P%g_S%g_I%g' %(predictor, sparse, integration_order))
+ case_name=case_name)
# Other test parameters
ws.gust_intensity = 0.01
@@ -145,7 +148,11 @@ class Test_gamma_dot(unittest.TestCase):
'Discrepancy between gamma_dot and that calculated using FD, relative difference is %.2f' % (
error_derivative / np.abs(gamma_dot_at_max))
- def test_case(self):
+ def setUp(self):
+ pass
+
+ def test_gammadot(self):
+
for aero_type in ['lin', 'nlin']:
if aero_type == 'lin':
for predictor in [True, False]:
@@ -166,3 +173,15 @@ class Test_gamma_dot(unittest.TestCase):
self.run_test(aero_type, predictor, sparse, integration_order)
+ def tearDowns(self):
+
+ solver_path = os.path.dirname(os.path.realpath(__file__))
+ # solver_path += '/'
+ # files_to_delete = [case + '.aero.h5',
+ # case + '.dyn.h5',
+ # case + '.fem.h5',
+ # case + '.solver.txt']
+ # for f in files_to_delete:
+ # os.remove(solver_path + f)
+
+ shutil.rmtree(solver_path + '/cases/')
