Skip to content

Commit

Permalink
refactor [unittest] speed-up dynamic test
Browse files Browse the repository at this point in the history
- achieved by coarser discretisation, lower fsi tolerances and steps
  • Loading branch information
sduess committed Sep 20, 2023
1 parent fbedff3 commit 8369944
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
22 changes: 9 additions & 13 deletions tests/coupled/dynamic/hale/generate_hale.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@
# EXECUTION
flow = ['BeamLoader',
'AerogridLoader',
'StaticTrim',
'StaticCoupled',
'DynamicCoupled',
'BeamLoads'
]

# if free_flight is False, the motion of the centre of the wing is prescribed.
free_flight = True
if not free_flight:
case_name += '_prescribed'
amplitude = 0 * np.pi / 180
period = 3
case_name += '_amp_' + str(amplitude).replace('.', '') + '_period_' + str(period)

# FLIGHT CONDITIONS
# the simulation is set such that the aircraft flies at a u_inf velocity while
Expand All @@ -44,7 +39,7 @@
# gust settings
gust_intensity = 0.20
gust_length = 1 * u_inf
gust_offset = 0.2 * u_inf
gust_offset = 0.0 * u_inf

# numerics
n_step = 5
Expand Down Expand Up @@ -101,7 +96,7 @@
# chordiwse panels
m = 4
# spanwise elements
n_elem_multiplier = 2
n_elem_multiplier = 1
n_elem_main = int(4 * n_elem_multiplier)
n_elem_tail = int(2 * n_elem_multiplier)
n_elem_fin = int(2 * n_elem_multiplier)
Expand All @@ -112,7 +107,7 @@
physical_time = 30
tstep_factor = 1.
dt = 1.0 / m / u_inf * tstep_factor
n_tstep = 20
n_tstep = 5

# END OF INPUT-----------------------------------------------------------------

Expand Down Expand Up @@ -669,15 +664,16 @@ def generate_solver_file():
'structural_solver_settings': settings[solver],
'aero_solver': 'StepUvlm',
'aero_solver_settings': settings['StepUvlm'],
'fsi_substeps': 200,
'fsi_tolerance': fsi_tolerance,
'relaxation_factor': relaxation_factor,
'fsi_substeps': 3,
'fsi_tolerance': 1e-3,
'relaxation_factor': 0,
'minimum_steps': 1,
'relaxation_steps': 150,
'final_relaxation_factor': 0.5,
'n_time_steps': n_tstep,
'dt': dt,
'include_unsteady_force_contribution': 'on',}
'include_unsteady_force_contribution': 'on',
}

settings['BeamLoader'] = {'unsteady': 'on',
'orientation': algebra.euler2quat(np.array([roll,
Expand Down
9 changes: 4 additions & 5 deletions tests/coupled/dynamic/test_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_hale_dynamic(self):
"""
Case and results from:
tests/coupled/dynamic/hale
reference results produced with SHARPy version 1.3
reference results produced with SHARPy version 2.0
:return:
"""
import sharpy.sharpy_main
Expand All @@ -29,11 +29,10 @@ def test_hale_dynamic(self):
output_folder = cases_folder + '/output/'

sharpy.sharpy_main.main(['', cases_folder + '/hale.sharpy'])
n_tstep = 20

n_tstep = 5
# compare results with reference values
ref_Fz = 50.4986064826483
ref_My = -1833.91402522644
ref_Fz = -526.712530589119
ref_My =-1513.64676181859
file = os.path.join(output_folder, case_name, 'beam/beam_loads_%i.csv' % (n_tstep))
beam_loads_ts = np.loadtxt(file, delimiter=',')
np.testing.assert_almost_equal(float(beam_loads_ts[0, 6]), ref_Fz,
Expand Down

0 comments on commit 8369944

Please sign in to comment.