def test_spline_distribution_example(self): import numpy as np import openmdao.api as om from openmdao.utils.spline_distributions import sine_distribution x_cp = np.linspace(0., 1., 6) y_cp = np.array([5.0, 12.0, 14.0, 16.0, 21.0, 29.0]) n = 20 x = om.sine_distribution(20, start=0, end=1, phase=np.pi) prob = om.Problem() comp = om.SplineComp(method='akima', x_cp_val=x_cp, x_interp_val=x) prob.model.add_subsystem('akima1', comp) comp.add_spline(y_cp_name='ycp', y_interp_name='y_val', y_cp_val=y_cp) prob.setup(force_alloc_complex=True) prob.run_model() akima_y = np.array([[ 5., 5.32381994, 6.28062691, 7.79410646, 9.64169506, 11.35166363, 12.26525921, 12.99152288, 13.77257256, 14.58710327, 15.41289673, 16.28341046, 17.96032258, 20.14140712, 22.31181718, 24.40891577, 26.27368825, 27.74068235, 28.67782484, 29. ]]) assert_near_equal(akima_y.flatten(), prob.get_val('akima1.y_val').flatten(), tolerance=1e-8)
'solidity': num_blades * blade_chord / np.pi / prop_rad, # solidity 'omega': 136. / prop_rad, # angular rotation rate 'prop_CD0': 0.012, # CD0 for prop profile power 'k_elec': 0.9, # electrical and mechanical losses factor 'k_ind': 1.2, # induced-losses factor 'nB': num_blades, # number of blades per propeller 'bc': blade_chord, # representative blade chord 'n_props': num_props # number of propellers } # make some splines to define the time history t_final = 28.36866175 # using the sine_distribution helper from the SplineComp docs # http://openmdao.org/twodocs/versions/3.4.0/features/building_blocks/components/spline_comp.html#splinecomp-interpolation-distribution time_cp = om.sine_distribution(num_cp, start=0, end=1, phase=np.pi) theta_cp = [0.07188392, 0.17391331, 0.34028059, 0.5101345, 0.66561472, 0.76287459, 0.84858573, 0.91466015, 0.96113079, 0.99573339, 1.00574242, 1.01472168, 1.03595189, 1.10451423, 1.16461664, 1.22062094, 1.28553096, 1.3307819, 1.40092757, 1.43952015] power_cp = [207161.23632379, 239090.09259429, 228846.07476655, 228171.35928472, 203168.64876755, 214967.45622033, 215557.60195517, 224144.75074625, 234546.06852611, 248761.85655837, 264579.96329677, 238568.31766929, 238816.66768314, 236739.41494728, 244041.61634308, 242472.86320043, 239606.77670727, 277307.47563171, 225369.8825676, 293871.23097611] class RK4Integration(om.ExplicitComponent): def setup(self):