Move aero solver finder to separate util
@@ -8,6 +8,7 @@ import sharpy.utils.settings as settings
import sharpy.utils.cout_utils as cout
import sharpy.utils.algebra as algebra
import sharpy.utils.generator_interface as gi
+import sharpy.aero.utils as aero_utils
@ss_interface.linear_system
@@ -101,30 +102,8 @@ class LinearAeroelastic(ss_interface.BaseElement):
self.uvlm = ss_interface.initialise_system('LinearUVLM')
self.uvlm.initialise(data, custom_settings=self.settings['aero_settings'])
- # Look for the aerodynamic solver
- if 'StaticUvlm' in data.settings:
- aero_solver_name = 'StaticUvlm'
- aero_solver_settings = data.settings['StaticUvlm']
- elif 'StaticCoupled' in data.settings:
- aero_solver_name = data.settings['StaticCoupled']['aero_solver']
- aero_solver_settings = data.settings['StaticCoupled']['aero_solver_settings']
- elif 'StaticCoupledRBM' in data.settings:
- aero_solver_name = data.settings['StaticCoupledRBM']['aero_solver']
- aero_solver_settings = data.settings['StaticCoupledRBM']['aero_solver_settings']
- elif 'DynamicCoupled' in data.settings:
- aero_solver_name = data.settings['DynamicCoupled']['aero_solver']
- aero_solver_settings = data.settings['DynamicCoupled']['aero_solver_settings']
- elif 'StepUvlm' in data.settings:
- aero_solver_name = 'StepUvlm'
- aero_solver_settings = data.settings['StepUvlm']
- else:
- raise RuntimeError("ERROR: aerodynamic solver not found")
-
- # Velocity generator
- vel_gen_name = aero_solver_settings['velocity_field_generator']
- vel_gen_settings = aero_solver_settings['velocity_field_input']
-
# Get the minimum parameters needed to define the wake
+ vel_gen_name, vel_gen_settings = aero_utils.find_velocity_generator(data.settings)
vel_gen_type = gi.generator_from_string(vel_gen_name)
vel_gen = vel_gen_type()
vel_gen.initialise(vel_gen_settings)
