This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import openmdao.api as om | |
from openmdao.utils.assert_utils import assert_near_equal | |
import dymos as dm | |
from dymos.examples.brachistochrone.brachistochrone_ode import BrachistochroneODE | |
class ParamComp(om.ExplicitComponent): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Equivalent OpenMDAO example. | |
import numpy as np | |
import openmdao.api as om | |
prob = om.Problem() | |
model = prob.model | |
model.add_subsystem('comp', om.ExecComp(['y=2.0*x + 100', 'y2=3.0*x', 'obj=sum(-3.0*x**2)'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import openmdao.api as om | |
from openmdao.test_suite.components.paraboloid import Paraboloid | |
class SubProblem(om.ExplicitComponent): | |
def setup(self): | |
self.add_input('x', val=0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import numpy as np | |
import openmdao.api as om | |
from openmdao.utils.assert_utils import assert_near_equal, assert_check_partials | |
class CrossSectionProperties(om.ExplicitComponent): | |
""" Calculates the cross-section area and area moments of inertia. """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import openmdao.api as om | |
from openmdao.components.interp_util.interp_semi import InterpNDSemi | |
grid = np.array([ | |
[1.0, 5.0, 8.0], | |
[1.0, 5.0, 9.0], | |
[1.0, 5.0, 10.0], | |
[1.0, 5.0, 20.0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import openmdao.api as om | |
from openmdao.utils.array_utils import evenly_distrib_idxs | |
from openmdao.utils.mpi import MPI | |
class Distrib_Derivs(om.ExplicitComponent): | |
"""Simplest example that combines distributed and serial inputs and outputs.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import openmdao.api as om | |
from openmdao.utils.array_utils import evenly_distrib_idxs | |
from openmdao.utils.mpi import MPI | |
class Distrib_Derivs(om.ExplicitComponent): | |
"""Simplest example that combines distributed and serial inputs and outputs.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Compares a draft to the original link and finds issues. | |
""" | |
from __future__ import print_function | |
from collections import OrderedDict | |
import re | |
import urllib | |
ALBUMID = 46185 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.optimize import minimize | |
import openmdao.api as om | |
class DynamicPressureComp(om.ExplicitComponent): | |
def setup(self): | |
self.add_input(name='rho', val=1.0, units='kg/m**3', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import openmdao.api as om | |
class RHS(om.Group): | |
def initialize(self): | |
self.options.declare('size', 1) |
NewerOlder