merge test wrt A multibody
@@ -3,6 +3,8 @@ import unittest
import os
import shutil
+folder = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
+
class TestFixNodeVelocitywrtA(unittest.TestCase):
@@ -74,6 +76,7 @@ class TestFixNodeVelocitywrtA(unittest.TestCase):
SimInfo.set_variable_all_dicts('dt', 0.05)
SimInfo.set_variable_all_dicts('rho', 0.0)
SimInfo.set_variable_all_dicts('velocity_field_input', SimInfo.solvers['SteadyVelocityField'])
+ SimInfo.set_variable_all_dicts('folder', folder + '/output/')
SimInfo.solvers['BeamLoader']['unsteady'] = 'on'
@@ -86,6 +89,7 @@ class TestFixNodeVelocitywrtA(unittest.TestCase):
SimInfo.solvers['StaticCoupled']['structural_solver_settings'] = SimInfo.solvers['NonLinearStatic']
SimInfo.solvers['StaticCoupled']['aero_solver'] = 'StaticUvlm'
SimInfo.solvers['StaticCoupled']['aero_solver_settings'] = SimInfo.solvers['StaticUvlm']
+ SimInfo.solvers['StaticCoupled']['relaxation_factor'] = 0.0
SimInfo.solvers['NonLinearDynamicMultibody']['gravity_on'] = True
@@ -153,12 +157,11 @@ class TestFixNodeVelocitywrtA(unittest.TestCase):
def test_testfixnodevelocitywrta(self):
import sharpy.sharpy_main
- solver_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/fix_node_velocity_wrtA.solver.txt')
- print(solver_path)
+ solver_path = folder + '/fix_node_velocity_wrtA.solver.txt'
sharpy.sharpy_main.main(['', solver_path])
# read output and compare
- output_path = os.path.dirname(solver_path) + '/output/fix_node_velocity_wrtA/WriteVariablesTime/'
+ output_path = folder + '/output/fix_node_velocity_wrtA/WriteVariablesTime/'
# quat_data = np.matrix(np.genfromtxt(output_path + 'FoR_00_mb_quat.dat', delimiter=' '))
pos_tip_data = np.matrix(np.genfromtxt(output_path + "struct_pos_node" + str(-1) + ".dat", delimiter=' '))
self.assertAlmostEqual(pos_tip_data[0, 1], 9.993, 3)
@@ -179,20 +182,14 @@ class TestFixNodeVelocitywrtA(unittest.TestCase):
self.assertAlmostEqual(pos_root_data[-1, 3], 0.0, 2)
def tearDowns(self):
- solver_path = os.path.dirname(os.path.realpath(__file__))
- solver_path += '/'
+ # pass
files_to_delete = [name + '.aero.h5',
name + '.dyn.h5',
name + '.fem.h5',
name + '.mb.h5',
name + '.solver.txt']
for f in files_to_delete:
- os.remove(solver_path + f)
-
- shutil.rmtree(solver_path + 'output/')
+ os.remove(folder + '/' + f)
-if __name__=='__main__':
+ shutil.rmtree(folder + '/output/')
- T = TestFixNodeVelocitywrtA()
- T.setUp()
- T.test_testfixnodevelocitywrta()
