API Reference

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.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)

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 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.
source
OpenMDAO.DymosifiedCompWrapperType
DymosifiedCompWrapper{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> 
source
OpenMDAO.DymosifiedCompWrapperMethod
DymosifiedCompWrapper(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: An OpenMDAOCore.AbstractComp type, not an instance (so TComp = FooComp, not TComp = FooComp(), analogous to the difference between Float64 and 1.0),
  • kwargs: keyword arguments, other than num_nodes, that are needed to construct an instance of TComp

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> 
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