API Reference

OpenMDAOCore.DenseADExplicitCompType
DenseADExplicitComp{InPlace,TAD,TCompute,TX,TY,TJ,TPrep,TXCS,TYCS,TAMD} <: AbstractExplicitComp{InPlace}

An <:AbstractADExplicitComp for dense Jacobians.

Fields

  • ad_backend::TAD: <:ADTypes.AbstractADType automatic differentation "backend" library
  • compute_adable::TCompute: function of the form compute_adable(Y, X) or Y = compute_adable(x) compatible with DifferentiationInterface.jl that performs the desired computation, where Y and X are ComponentVectors of outputs and inputs, respectively
  • X_ca::ComponentVector: ComponentVector of inputs
  • Y_ca::ComponentVector: ComponentVector of outputs
  • J_ca::ComponentMatrix: Dense ComponentMatrix of the Jacobian of Y_ca with respect to X_ca
  • units_dict::Dict{Symbol,String}: mapping of variable names to units. Can be an empty Dict if units are not desired.
  • tags_dict::Dict{Symbol,Vector{String}: mapping of variable names to Vectors of Strings specifing variable tags.
  • shape_by_conn_dict::Dict{Symbol,Bool}: mapping of variable names to Bool indicating if the variable shape should be determined dynamically by a connection.
  • copy_shape_dict::Dict{Symbol,Symbol}: mapping of variable names to variable names indicating if a variable shape should be copied from another variable.
  • aviary_input_names::Dict{Symbol,String}: mapping of input variable names to Aviary names.
  • aviary_output_names::Dict{Symbol,String}: mapping of output variable names to Aviary names.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
  • prep::DifferentiationInterface.JacobianPrep: DifferentiationInterface.jl "preparation" object
  • X_ca::ComponentVector: ComplexF64 version of X_ca (for the complex-step method)
  • Y_ca::ComponentVector: ComplexF64 version of Y_ca (for the complex-step method)
source
OpenMDAOCore.DenseADExplicitCompMethod
DenseADExplicitComp(ad_backend, f!, Y_ca::ComponentVector, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())

Create a DenseADExplicitComp from a user-defined function and output and input ComponentVectors.

Positional Arguments

  • ad_backend: <:ADTypes.AbstractADType automatic differentation "backend" library
  • f!: function of the form f!(Y_ca, X_ca, params) which writes outputs to Y_ca using inputs X_ca and, optionally, parameters params.
  • Y_ca: ComponentVector of outputs
  • X_ca: ComponentVector of inputs

Keyword Arguments

  • params: parameters passed to the third argument to f!. Could be anything, or nothing, but the derivatives of Y_ca with respect to params will not be calculated
  • units_dict: Dict mapping variable names (as Symbols) to OpenMDAO units (expressed as Strings)
  • tags_dict: Dict mapping variable names (as Symbols) to Vectors of OpenMDAO tags
  • shape_by_conn_dict: Dict mapping variable names (as Symbols) to Bools indicating if the variable's shape (size) will be set dynamically by a connection
  • copy_shape_dict: Dict mapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbol
  • force_skip_prep: if true, defer creating internal arrays and other structs until the user calls update_prep!
  • aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary input variables.
  • aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary output variables.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
source
OpenMDAOCore.DenseADExplicitCompMethod
DenseADExplicitComp(ad_backend, f, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())

Create a DenseADExplicitComp from a user-defined function and output and input ComponentVectors.

Positional Arguments

  • ad_backend: <:ADTypes.AbstractADType automatic differentation "backend" library
  • f: function of the form Y_ca = f(X_ca, params) which returns outputs Y_ca using inputs X_ca and, optionally, parameters params.
  • X_ca: ComponentVector of inputs

Keyword Arguments

  • params: parameters passed to the third argument to f!. Could be anything, or nothing, but the derivatives of Y_ca with respect to params will not be calculated
  • units_dict: Dict mapping variable names (as Symbols) to OpenMDAO units (expressed as Strings)
  • tags_dict: Dict mapping variable names (as Symbols) to Vectors of OpenMDAO tags
  • shape_by_conn_dict: Dict mapping variable names (as Symbols) to Bools indicating if the variable's shape (size) will be set dynamically by a connection
  • copy_shape_dict: Dict mapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbol
  • force_skip_prep: if true, defer creating internal arrays and other structs until the user calls update_prep!
  • aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary input variables.
  • aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary output variables.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
source
OpenMDAOCore.MatrixFreeADExplicitCompMethod
MatrixFreeADExplicitComp(ad_backend, f!, Y_ca::ComponentVector, X_ca::ComponentVector; params=nothing, force_mode="", disable_prep=false, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())

Create a MatrixFreeADExplicitComp from a user-defined function and output and input ComponentVectors.

Positional Arguments

  • ad_backend: <:ADTypes.AbstractADType automatic differentation "backend" library
  • f!: function of the form f!(Y_ca, X_ca, params) which writes outputs to Y_ca using inputs X_ca and, optionally, parameters params.
  • Y_ca: ComponentVector of outputs
  • X_ca: ComponentVector of inputs

Keyword Arguments

  • params: parameters passed to the third argument to f!. Could be anything, or nothing, but the derivatives of Y_ca with respect to params will not be calculated
  • force_mode="": If "fwd", use DifferentiationInterface.pushforward! to compute the derivatives (aka perform a Jacobian-vector product). If "rev", use DifferentiationInterface.pullback! to compute the derivatives (aka perform a vector-Jacobian product). If "", use whatever would be faster, as determined by DifferentiationInterface.pushforward_performance and DifferentiationInterface.pullback_performance, prefering pushforward.
  • disable_prep: if true, do not use either prepare_pushforward or prepare_pullback to create a DifferentiationInterface.PushforwardPrep or PullbackPrep object to accelerate the derivative calculation. Disabling prep can avoid correctness issues with ReverseDiff.jl, see the discussion of branching and the AbstractTape API.
  • units_dict: Dict mapping variable names (as Symbols) to OpenMDAO units (expressed as Strings)
  • tags_dict: Dict mapping variable names (as Symbols) to Vectors of OpenMDAO tags
  • shape_by_conn_dict: Dict mapping variable names (as Symbols) to Bools indicating if the variable's shape (size) will be set dynamically by a connection
  • copy_shape_dict: Dict mapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbol
  • aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary input variables.
  • aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary output variables.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
source
OpenMDAOCore.MatrixFreeADExplicitCompMethod
MatrixFreeADExplicitComp(ad_backend, f, X_ca::ComponentVector; params=nothing, force_mode="", disable_prep=false, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())

Create a MatrixFreeADExplicitComp from a user-defined function and output and input ComponentVectors.

Positional Arguments

  • ad_backend: <:ADTypes.AbstractADType automatic differentation "backend" library
  • f: function of the form Y_ca = f(X_ca, params) which returns outputs Y_ca using inputs X_ca and, optionally, parameters params.
  • X_ca: ComponentVector of inputs

Keyword Arguments

  • params: parameters passed to the third argument to f!. Could be anything, or nothing, but the derivatives of Y_ca with respect to params will not be calculated
  • force_mode="": If "fwd", use DifferentiationInterface.pushforward! to compute the derivatives (aka perform a Jacobian-vector product). If "rev", use DifferentiationInterface.pullback! to compute the derivatives (aka perform a vector-Jacobian product). If "", use whatever would be faster, as determined by DifferentiationInterface.pushforward_performance and DifferentiationInterface.pullback_performance, prefering pushforward.
  • disable_prep: if true, do not use either prepare_pushforward or prepare_pullback to create a DifferentiationInterface.PushforwardPrep or PullbackPrep object to accelerate the derivative calculation. Disabling prep can avoid correctness issues with ReverseDiff.jl, see the discussion of branching and the AbstractTape API.
  • units_dict: Dict mapping variable names (as Symbols) to OpenMDAO units (expressed as Strings)
  • tags_dict: Dict mapping variable names (as Symbols) to Vectors of OpenMDAO tags
  • shape_by_conn_dict: Dict mapping variable names (as Symbols) to Bools indicating if the variable's shape (size) will be set dynamically by a connection
  • copy_shape_dict: Dict mapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbol
  • aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary input variables.
  • aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary output variables.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
source
OpenMDAOCore.PartialsDataType
PartialsData(of::String, wrt::String; <keyword arguments>)

Create a PartialsData object for the derivative of variable of with respect to variable wrt.

PartialsData objects are used to construct arguments to OpenMDAO's Component.declare_partials method. Specifically, a PartialsData object pd will eventually be used to call Component.declare_partials like this:

Component.declare_partials(pd.of, pd.wrt, rows=pd.rows, cols=pd.cols, val=pd.val, method=pd.method)

The of and wrt positional arguments are required and set the of and wrt fields. The value of the other PartialsData fields (e.g., pd.rows, pd.val, etc.) are set via constructor keyword arguments, here:

Keyword Arguments

  • rows::Union{<:AbstractVector{Int64},Nothing} = nothing: row indices for each non-zero Jacobian entry, if not nothing.

  • cols::Union{<:AbstractVector{Int64},Nothing} = nothing: column indices for each non-zero Jacobian entry, if not nothing.

  • val::Union{Float64,<:AbstractArray{Float64},Nothing} = nothing: value of Jacobian, if not nothing.

  • method::String = "exact": method use to calcluate the partial derivative(s). Should be one of

    • "exact": user-defined partial derivatives via compute_partials!, linearize!, etc.
    • "fd": finite difference approximation
    • "cs": complex step approximation
source
OpenMDAOCore.PerturbedDenseSparsityDetectorType
PerturbedDenseSparsityDetector

Tweaked version of DenseSparsityDetector sparsity pattern detector satisfying the detection API of ADTypes.jl that evaluates the Jacobian multiple times using a perturbed input vector. Specifically, input vector x will be perturbed via

    x_perturb = (1 .+ rel_x_perturb.*perturb1).*x .+ perturb2.*abs_x_perturb

where perturb1 and perturb2 are random Vectors of numbers ranging from -0.5 to 0.5, and rel_x_perturb and abs_x_perturb are relative and absolute perturbation magnitudes specified by the user.

All of the caveats associated with the performance of DenseSparsityDetector apply to PerturbedDenseSparsityDetector, since it essentially does the same thing as DenseSparsityDetector multiple times. The nonzeros in a Jacobian or Hessian are detected by computing the relevant matrix with dense AD, and thresholding the entries with a given tolerance (which can be numerically inaccurate). This process can be very slow, and should only be used if its output can be exploited multiple times to compute many sparse matrices.

Danger

In general, the sparsity pattern you obtain can depend on the provided input x. If you want to reuse the pattern, make sure that it is input-agnostic. Perturbing the input vector should hopefully guard against getting "unlucky" and finding zero Jacobian entries that aren't actually zero for all x, but is of course problem-dependent.

Fields

  • backend::AbstractADType is the dense AD backend used under the hood
  • atol::Float64 is the minimum magnitude of a matrix entry to be considered nonzero
  • nevals::Int=3 is the number of times the Jacobian will be evaluated using the perturbed input x
  • rel_x_perturb=0.001: is the relative magnitude of the x perturbation.

Constructor

PerturbedDenseSparsityDetector(backend; atol, method=:iterative, nevals=3, rel_x_perturb=0.001, abs_x_perturb=0.0001)

The keyword argument method::Symbol can be either:

  • :iterative: compute the matrix in a sequence of matrix-vector products (memory-efficient)
  • :direct: compute the matrix all at once (memory-hungry but sometimes faster).

Note that the constructor is type-unstable because method ends up being a type parameter of the PerturbedDenseSparsityDetector object (this is not part of the API and might change).

source
OpenMDAOCore.SparseADExplicitCompType
SparseADExplicitComp{InPlace,TAD,TCompute,TX,TY,TJ,TPrep,TXCS,TYCS,TAMD} <: AbstractExplicitComp{InPlace}

An <:AbstractADExplicitComp for sparse Jacobians.

Fields

  • ad_backend::TAD: <:ADTypes.AutoSparse automatic differentation "backend" library
  • compute_adable::TCompute: function of the form compute_adable(Y, X) compatible with DifferentiationInterface.jl that performs the desired computation, where Y and X are ComponentVectors of outputs and inputs, respectively
  • X_ca::ComponentVector: ComponentVector of inputs
  • Y_ca::ComponentVector: ComponentVector of outputs
  • J_ca_sparse::ComponentMatrix: Sparse ComponentMatrix of the Jacobian of Y_ca with respect to X_ca
  • units_dict::Dict{Symbol,String}: mapping of variable names to units. Can be an empty Dict if units are not desired.
  • tags_dict::Dict{Symbol,Vector{String}: mapping of variable names to Vectors of Strings specifing variable tags.
  • shape_by_conn_dict::Dict{Symbol,Bool}: mapping of variable names to Bool indicating if the variable shape should be determined dynamically by a connection.
  • aviary_input_names::Dict{Symbol,String}: mapping of input variable names to Aviary names.
  • aviary_output_names::Dict{Symbol,String}: mapping of output variable names to Aviary names.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
  • prep::DifferentiationInterface.JacobianPrep: DifferentiationInterface.jl "preparation" object
  • rcdict: Dict{Tuple{Symbol,Sympol}, Tuple{Vector{Int}, Vector{Int}} mapping sub-Jacobians of the form (:output_name, :input_name) to Vectors of non-zero row and column indices (1-based)
  • X_ca::ComponentVector: ComplexF64 version of X_ca (for the complex-step method)
  • Y_ca::ComponentVector: ComplexF64 version of Y_ca (for the complex-step method)
source
OpenMDAOCore.SparseADExplicitCompMethod
SparseADExplicitComp(ad_backend, f!, Y_ca::ComponentVector, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())

Create a SparseADExplicitComp from a user-defined function and output and input ComponentVectors.

Positional Arguments

  • ad_backend: <:ADTypes.AutoSparse automatic differentation "backend" library
  • f!: function of the form f!(Y_ca, X_ca, params) which writes outputs to Y_ca using inputs X_ca and, optionally, parameters params.
  • Y_ca: ComponentVector of outputs
  • X_ca: ComponentVector of inputs

Keyword Arguments

  • params: parameters passed to the third argument to f!. Could be anything, or nothing, but the derivatives of Y_ca with respect to params will not be calculated
  • units_dict: Dict mapping variable names (as Symbols) to OpenMDAO units (expressed as Strings)
  • tags_dict: Dict mapping variable names (as Symbols) to Vectors of OpenMDAO tags
  • shape_by_conn_dict: Dict mapping variable names (as Symbols) to Bools indicating if the variable's shape (size) will be set dynamically by a connection
  • copy_shape_dict: Dict mapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbol
  • force_skip_prep: if true, defer creating internal arrays and other structs until the user calls update_prep!
  • aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary input variables.
  • aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary output variables.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
source
OpenMDAOCore.SparseADExplicitCompMethod
SparseADExplicitComp(ad_backend, f, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())

Create a SparseADExplicitComp from a user-defined function and output and input ComponentVectors.

Positional Arguments

  • ad_backend: <:ADTypes.AutoSparse automatic differentation "backend" library
  • f: function of the form Y_ca = f(X_ca, params) which returns outputs Y_ca using inputs X_ca and, optionally, parameters params.
  • X_ca: ComponentVector of inputs

Keyword Arguments

  • params: parameters passed to the third argument to f!. Could be anything, or nothing, but the derivatives of Y_ca with respect to params will not be calculated
  • units_dict: Dict mapping variable names (as Symbols) to OpenMDAO units (expressed as Strings)
  • tags_dict: Dict mapping variable names (as Symbols) to Vectors of OpenMDAO tags
  • shape_by_conn_dict: Dict mapping variable names (as Symbols) to Bools indicating if the variable's shape (size) will be set dynamically by a connection
  • copy_shape_dict: Dict mapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbol
  • force_skip_prep: if true, defer creating internal arrays and other structs until the user calls update_prep!
  • aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary input variables.
  • aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to a Dict that contains keys name and optionally shape defining the Aviary name and shape for Aviary output variables.
  • aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the "units" and "default_value" fields are used.
source
OpenMDAOCore.VarDataType
VarData(name::String; <keyword arguments>)

Create a VarData object for an OpenMDAO variable named name.

VarData objects are used to construct arguments to OpenMDAO's Component.add_input and Component.add_output methods. Specifically, if a VarData object var refers to an input variable, the Component.add_input call will look like this:

Component.add_input(var.name, shape=var.shape, val=var.val, units=var.units, tags=var.tags, shape_by_conn=var.shape_by_conn)

and if the VarData object var is an output variable, the Component.add_output call will look like this:

Component.add_output(var.name, shape=var.shape, val=var.val, units=var.units, lower=var.lower, upper=var.upper, tags=var.tags, shape_by_conn=var.shape_by_conn)

The name positional argument is required and sets the name field. The value of the other VarData fields (e.g., var.shape, var.val, etc.) are set via constructor keyword arguments, here:

Keyword Arguments

  • val::Union{Float64,<:AbstractArray{Float64},Nothing} = 1.0: variable's default value, set to 1.0 if nothing.
  • shape::Union{Int64,NTuple{N,Int64},Nothing} = (1,): variable shape, set to (1,) if nothing.
  • units::Union{String,Nothing} = nothing: variable units.
  • lower::Union{Float64,<:AbstractArray{Float64,N},Nothing} = nothing: variable's lower limit.
  • upper::Union{Float64,<:AbstractArray{Float64,N},Nothing} = nothing: variable's upper limit.
  • tags::Union{<:AbstractVector{String},Nothing} = nothing: variable tags.
  • shape_by_conn::Bool = false: if true, shape this variable by its connected output (if an input) or input (if an output)
  • copy_shape::Union{String,Nothing} = nothing: if a string, shape this variable by the local variable indicated by copy_shape
source
OpenMDAOCore.get_rows_colsMethod
get_rows_cols(; ss_sizes::Dict{Symbol, Int}, of_ss::AbstractVector{Symbol}, wrt_ss::AbstractVector{Symbol})

Get the non-zero row and column indices for a sparsity pattern defined by output subscripts of_ss and input subscripts wrt_ss.

ss_sizes is a Dict mapping the subscript symbols in of_ss and wrt_ss to the size of each dimension the subscript symbols correspond to. The returned indices will be zero-based, which is what the OpenMDAO declare_partials method expects.

Examples

Diagonal partials for 1D output and 1D input, both with length 5:

julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>5), of_ss=[:i], wrt_ss=[:i])
([0, 1, 2, 3, 4], [0, 1, 2, 3, 4])

1D output with length 2 depending on all elements of 1D input with length 3 (so not actually sparse).

julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i], wrt_ss=[:j])
([0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2])

2D output with size (2, 3) and 1D input with size 2, where each i output row only depends on the i input element.

julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i, :j], wrt_ss=[:i])
([0, 1, 2, 3, 4, 5], [0, 0, 0, 1, 1, 1])

2D output with size (2, 3) and 1D input with size 3, where each j output column only depends on the j input element.

julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i, :j], wrt_ss=[:j])
([0, 1, 2, 3, 4, 5], [0, 1, 2, 0, 1, 2])

2D output with size (2, 3) depending on input with size (3, 2), where the output element at index i, j only depends on input element j, i (like a transpose operation).

julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i, :j], wrt_ss=[:j, :i])
([0, 1, 2, 3, 4, 5], [0, 2, 4, 1, 3, 5])

2D output with size (2, 3) depending on input with size (3, 4), where output y[:, j] for each j depends on input x[j, :].

julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3, :k=>4), of_ss=[:i, :j], wrt_ss=[:j, :k]);

julia> @show rows cols;  # to prevent abbreviating the array display
rows = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]
cols = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
source
OpenMDAO.make_componentFunction
make_component(comp::OpenMDAOCore.AbstractComp)

Convinience method for creating either a JuliaExplicitComp or JuliaImplicitComp, depending on if comp is <:OpenMDAOCore.AbstractExplicitComp or <:OpenMDAOCore.AbstractImplicitComp, respectively.

source