Example #1
0
        ramp_start_time = start_time + ramp_constant_time
        end_ramp_end_time = steady_end_time + end_ramp_time - ramp_constant_time

    if ramp_function == 'smooth_linear_ramp':
        kinematic_parameters = [
            ramp_stage_acceleration, ramp_start_time, i_ramp_end_time,
            steady_end_time, end_ramp_end_time, smooth_factor, ramp_mode,
            ramp_constant_time, pitch_mode, pitch_time,
            pitch_delay_time_fraction, pitch_acceleration,
            pitch_acc_time_fraction, section_location, bstroke
        ]
        kinematic_angles = smooth_linear_ramp(t, kinematic_parameters)

    #--------------------------------------------------
    angles_to_plot = ['dphi', 'dalf']
    kf_plotter(t, kinematic_angles, angles_to_plot, 'basic', 'against_t',
               save_file_image)
    write_2d(t, section_location, kinematic_angles, 'basic', save_file_data)

    with open(save_file_cf, 'w') as f:
        f.write(
            '%s\n' %
            '/*--------------------------------*- C++ -*----------------------------------*\\'
        )
        f.write(
            '%s\n' %
            r'\*---------------------------------------------------------------------------*/'
        )
        f.write('%s\n%s\n' % (r'forceCoeffs_object', r'{'))
        f.write('%s\n%s\n' %
                (r'    type forceCoeffs;', r'    libs ("libforces.so");'))
        f.write('%s\n\n%s\n\n' %
Example #2
0
        save_file_image = os.path.join(output_dir_path, file_name + '.png')
        save_file_cf = os.path.join(output_dir_path, file_name + '.cf')
        save_file_nu = os.path.join(output_dir_path, file_name + '.nu')
        #--------------------------------------------
        kinematic_parameters_sinu_continuous = [
            flapping_wing_frequency, flapping_angular_velocity_amplitude,
            pitching_angular_velocity_amplitude,
            flapping_acceleration_time_fraction, pitching_time_fraction,
            flapping_delay_time_fraction, pitching_delay_time_fraction
        ]

        if use_function == 'sinu_continuous':
            kinematic_angles = sic_f(t, kinematic_parameters_sinu_continuous)
        #--------------------------------------------------
        angles_to_plot = ['dphi', 'dalf']
        kf_plotter(t, kinematic_angles, angles_to_plot,
                   time_series_length_per_cycle, 'against_t', save_file_image)
        write_2d(t, sti, kinematic_angles, time_series_length_per_cycle,
                 save_file_data)

        with open(save_file_cf, 'w') as f:
            f.write(
                '%s\n' %
                '/*--------------------------------*- C++ -*----------------------------------*\\'
            )
            f.write(
                '%s\n' %
                r'\*---------------------------------------------------------------------------*/'
            )
            f.write('%s\n%s\n' % (r'forceCoeffs_object', r'{'))
            f.write('%s\n%s\n' %
                    (r'    type forceCoeffs;', r'    libs ("libforces.so");'))
t = np.linspace(start_time, end_time, time_series_length)

i_ramp_end_time = start_time + initial_ramp_time
steady_end_time = i_ramp_end_time + steady_rotation_time
if ramp_function == 'smooth_linear_ramp':
    end_ramp_time = initial_ramp_time

    ramp_start_time = start_time + ramp_constant_time
    end_ramp_end_time = steady_end_time + end_ramp_time - ramp_constant_time

if ramp_function == 'sinu_ramp':
    kinematic_parameters = [steady_rotation_frequency, i_ramp_end_time]
    kinematic_angles = sinu_ramp_rev(t, kinematic_parameters)
elif ramp_function == 'smooth_linear_ramp':
    kinematic_parameters = [
        ramp_stage_acceleration, ramp_start_time, i_ramp_end_time,
        steady_end_time, end_ramp_end_time, smooth_factor, ramp_mode,
        ramp_constant_time, pitch_mode, pitch_time, pitch_delay_time_fraction,
        pitch_acceleration, pitch_acc_time_fraction, section_location, bstroke
    ]
    kinematic_angles = smooth_linear_ramp(t, kinematic_parameters)

#--------------------------------------------------
angles_to_plot = ['dphi', 'dalf']

kf_plotter(t, kinematic_angles, angles_to_plot, 'basic', 'against_t',
           'current')

write_2d(t, section_location, kinematic_angles, 'basic', 'current')
# write_3d(t, kinematic_angles, 'basic', 'current')