frequency_sweep Interface

public interface frequency_sweep

Contents


Module Procedures

private function frf_sweep_1(fcn, freq, iv, solver, ncycles, ntransient, points, args, err) result(rst)

Computes the frequency response of each equation of a system of harmonically excited ODE's by sweeping through frequency.

Arguments

Type IntentOptional Attributes Name
procedure(harmonic_ode), intent(in), pointer :: fcn

A pointer to the routine containing the ODE's to integrate.

real(kind=real64), intent(in), dimension(:) :: freq

An M-element array containing the frequency points at which the solution should be computed. Notice, whatever units are utilized for this array are also the units of the excitation_frequency property in @p sys. It is recommended that the units be set to Hz. Additionally, this array cannot contain any zero-valued elements as the ODE solution time for each frequency is determined by the period of oscillation and number of cycles.

real(kind=real64), intent(in), dimension(:) :: iv

An N-element array containing the initial conditions for each of the N ODEs.

class(ode_integrator), intent(inout), optional, target :: solver

An optional differential equation solver. The default solver is the Dormand-Prince Runge-Kutta integrator from the DIFFEQ library.

integer(kind=int32), intent(in), optional :: ncycles

An optional parameter controlling the number of cycles to analyze when determining the amplitude and phase of the response. The default is 20.

integer(kind=int32), intent(in), optional :: ntransient

An optional parameter controlling how many of the initial "transient" cycles to ignore. The default is 200.

integer(kind=int32), intent(in), optional :: points

An optional parameter controlling how many evenly spaced solution points should be considered per cycle. The default is 1000. Notice, there must be at least 2 points per cycle for the analysis to be effective. The algorithm utilizes a discrete Fourier transform to determine the phase and amplitude, and in order to satisfy Nyquist conditions, the value must be at least 2.

class(*), intent(inout), optional :: args

An optional argument allowing for passing of data in/out of the fcn subroutine.

class(errors), intent(inout), optional, target :: err

An optional errors-based object that if provided can be used to retrieve information relating to any errors encountered during execution. If not provided, a default implementation of the errors class is used internally to provide error handling. Possible errors and warning messages that may be encountered are as follows.

  • DYN_MEMORY_ERROR: Occurs if there are issues allocating memory.
  • DYN_NULL_POINTER_ERROR: Occurs if a null pointer is supplied.
  • DYN_INVALID_INPUT_ERROR: Occurs if an invalid parameter is given.
  • DYN_ZERO_VALUED_FREQUENCY_ERROR: Occurs if a zero-valued frequency was supplied.

Return Value type(frf)

The resulting frequency responses.

private function frf_sweep_2(fcn, nfreq, freq1, freq2, iv, solver, ncycles, ntransient, points, args, err) result(rst)

Computes the frequency response of each equation of a system of harmonically excited ODE's by sweeping through frequency.

Arguments

Type IntentOptional Attributes Name
procedure(harmonic_ode), intent(in), pointer :: fcn

A pointer to the routine containing the ODE's to integrate.

integer(kind=int32), intent(in) :: nfreq

The number of frequency values to analyze. This value must be at least 2.

real(kind=real64), intent(in) :: freq1

The starting frequency. It is recommended that the units be set to Hz.

real(kind=real64), intent(in) :: freq2

The ending frequency. It is recommended that the units be set to Hz.

real(kind=real64), intent(in), dimension(:) :: iv

An N-element array containing the initial conditions for each of the N ODEs.

class(ode_integrator), intent(inout), optional, target :: solver

An optional differential equation solver. The default solver is the Dormand-Prince Runge-Kutta integrator from the DIFFEQ library.

integer(kind=int32), intent(in), optional :: ncycles

An optional parameter controlling the number of cycles to analyze when determining the amplitude and phase of the response. The default is 20.

integer(kind=int32), intent(in), optional :: ntransient

An optional parameter controlling how many of the initial "transient" cycles to ignore. The default is 200.

integer(kind=int32), intent(in), optional :: points

An optional parameter controlling how many evenly spaced solution points should be considered per cycle. The default is 1000. Notice, there must be at least 2 points per cycle for the analysis to be effective. The algorithm utilizes a discrete Fourier transform to determine the phase and amplitude, and in order to satisfy Nyquist conditions, the value must be at least 2.

class(*), intent(inout), optional :: args

An optional argument allowing for passing of data in/out of the fcn subroutine.

class(errors), intent(inout), optional, target :: err

An optional errors-based object that if provided can be used to retrieve information relating to any errors encountered during execution. If not provided, a default implementation of the errors class is used internally to provide error handling. Possible errors and warning messages that may be encountered are as follows.

  • DYN_MEMORY_ERROR: Occurs if there are issues allocating memory.
  • DYN_NULL_POINTER_ERROR: Occurs if a null pointer is supplied.
  • DYN_INVALID_INPUT_ERROR: Occurs if an invalid parameter is given.
  • DYN_ZERO_VALUED_FREQUENCY_ERROR: Occurs if a zero-valued frequency was supplied.

Return Value type(frf)

The resulting frequency responses.