API Reference
OpenMDAOCore.PartialsData — TypePartialsData(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 notnothing.cols::Union{<:AbstractVector{Int64},Nothing} = nothing: column indices for each non-zero Jacobian entry, if notnothing.val::Union{Float64,<:AbstractArray{Float64},Nothing} = nothing: value of Jacobian, if notnothing.method::String = "exact": method use to calcluate the partial derivative(s). Should be one of"exact": user-defined partial derivatives viacompute_partials!,linearize!, etc."fd": finite difference approximation"cs": complex step approximation
OpenMDAOCore.VarData — TypeVarData(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)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)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 to1.0ifnothing.shape::Union{Int64,NTuple{N,Int64},Nothing} = (1,): variable shape, set to(1,)ifnothing.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.
OpenMDAO.DymosifiedCompWrapper — TypeDymosifiedCompWrapper{Tkwargs}Wrapper type that stores a type (not an instance) of an <:OpenMDAOCore.AbstractComp and the non-num_nodes keyword arguments (if any) used to construct the instance.
Example
julia> using OpenMDAOCore: OpenMDAOCore
julia> using OpenMDAO
julia> struct FooODE <: OpenMDAOCore.AbstractExplicitComp
num_nodes::Int
a::Float64
end
julia> FooODE(; num_nodes, a) = FooODE(num_nodes, a)
FooODE
julia> dcw = OpenMDAO.DymosifiedCompWrapper(FooODE; a=8.0)
OpenMDAO.DymosifiedCompWrapper{Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:a,), Tuple{Float64}}}}(FooODE, Base.Pairs(:a => 8.0))
julia> comp = dcw(num_nodes=4)
Python JuliaExplicitComp: <omjlcomps.JuliaExplicitComp object at 0x7f38429333a0>
julia> OpenMDAO.DymosifiedCompWrapper — MethodDymosifiedCompWrapper(TComp::Type{<:OpenMDAOCore.AbstractComp}; kwargs...)Construct a wrapper to a <:OpenMDAOCore.AbstractComp that can be used to create a omjlcomps.JuliaExplicitComp or omjlcomps.JuliaImplicitComp by just passing a num_nodes argument.
Arguments
TComp: AnOpenMDAOCore.AbstractComptype, not an instance (soTComp = FooComp, notTComp = FooComp(), analogous to the difference betweenFloat64and1.0),kwargs: keyword arguments, other thannum_nodes, that are needed to construct an instance ofTComp
Example
julia> using OpenMDAOCore: OpenMDAOCore
julia> using OpenMDAO
julia> struct FooODE <: OpenMDAOCore.AbstractExplicitComp
num_nodes::Int
a::Float64
end
julia> FooODE(; num_nodes, a) = FooODE(num_nodes, a)
FooODE
julia> dcw = OpenMDAO.DymosifiedCompWrapper(FooODE; a=8.0)
OpenMDAO.DymosifiedCompWrapper{Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:a,), Tuple{Float64}}}}(FooODE, Base.Pairs(:a => 8.0))
julia> comp = dcw(num_nodes=4)
Python JuliaExplicitComp: <omjlcomps.JuliaExplicitComp object at 0x7f38429333a0>
julia> OpenMDAO.make_component — Functionmake_component(comp::OpenMDAOCore.AbstractComp)Convinience method for creating either a JuliaExplicitComp or JuliaImplicitComp, depending on if comp is <:OpenMDAOCore.AbstractExplicitComp or <:OpenMDAOCore.AbstractImplicitComp, respectively.