Skip to content

Extracting Solutions

After computing the steady-states of the harmonic equations, you'll want to extract the solutions from the HarmonicBalance.Result struct.

Basic Solution Extraction

For plotting, you can extract the solutions using the get_solutions function, which parses a string into a symbolic expression, evaluates it for every steady state solution and filters the solutions by the requested class.

HarmonicBalance.get_solutions Function
julia
get_solutions(
    res::Result, x::String;
    branches=1:branch_count(res), realify=false, class=["stable"], not_class=[]
    )
get_solutions(res::Result; branches=1:branch_count(res), class=["stable"], not_class=[])

Extract solution vectors from a Result object based on specified filtering criteria given by the class keywords. The first method allows extracting a specific solution component by name x. The second method returns complete solution vectors.

Keyword arguments

  • branches=1:branch_count(res): Range of branches to include in the output

  • realify=false: Whether to convert complex solutions to real form

  • class=["physical", "stable"]: Array of classification labels to include

  • not_class=[]: Array of classification labels to exclude

Returns

Filtered solution vectors matching the specified criteria

source

HarmonicBalance.get_single_solution Function
julia
get_single_solution(
    res::HarmonicBalance.Result{D, S, P, F} where F<:FunctionWrappers.FunctionWrapper{Array{S, 2}, Tuple{Array{S, 1}}};
    branch,
    index
)

Return an ordered dictionary specifying all variables and parameters of the solution in result on branch at the position index.

source

Attractors

HarmonicBalance.attractors Function
julia
attractors(res::Result{D}; class="stable", not_class=[]) where D

Extract attractors from a Result object. Returns an array of dictionaries, where each dictionary maps branch identifier to the attractor. The attractors are filtered by their corresponding class.

Keyword arguments

Class selection done by passing String or Vector{String} as kwarg:

class::String       :   only count solutions in this class ("all" --> plot everything)
not_class::String   :   do not count solutions in this class

Returns

Array{Dict,D}: Vector of dictionaries mapping branch indices to points satisfying the stability criteria at each parameter value

source

HarmonicBalance.phase_diagram Function
julia
phase_diagram(res::Result{D}; class="physical", not_class=[]) where {D}

Calculate the phase diagram from a Result object by summing over the number of states at each swept parameters.

Keyword arguments

Class selection done by passing String or Vector{String} as kwarg:

class::String       :   only count solutions in this class ("all" --> plot everything)
not_class::String   :   do not count solutions in this class

Returns

  • Array{Int64,D}: Sum of states after applying the specified class masks

source