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
Testing username |
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
>> z = Component() | |
>> z.add_trait('x', Slot(TransientScalar, iotype='in')) | |
>> print z.x | |
None | |
>> # Type-checking is now enforced (only Trasientscalars allowed) | |
>> z.x="Hello" | |
Traceback (most recent call last): | |
... | |
TypeError: : x must be an instance of class 'TransientScalar' |
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
from __future__ import print_function, division, absolute_import | |
from openmdao.api import Problem, Group, IndepVarComp, ExplicitComponent | |
from openmdao.api import view_model | |
from openmdao.devtools.xdsm_viewer.xdsm_writer import write_xdsm | |
class TimeComp(ExplicitComponent): | |
def setup(self): |
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 DistParab(om.ExplicitComponent): | |
def initialize(self): | |
self.options.declare('arr_size', types=int, default=10, |
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 openmdao.api as om | |
prob = om.Problem() | |
model = prob.model | |
model.add_subsystem('p1', om.IndepVarComp('x', 1.0)) | |
parallel = model.add_subsystem('parallel', om.ParallelGroup()) | |
parallel.add_subsystem('c1', om.ExecComp(['y=-2.0*x'])) |
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 ControlInterpComp(om.ExplicitComponent): | |
def setup(self): | |
self.add_output('x', shape=(3, 1)) |
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 Burn1(om.Group): | |
def setup(self): | |
self.add_subsystem('comp1', om.ExecComp(['y1=x*2'], y1=np.ones(4), x=np.ones(4)), | |
promotes_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 | |
class Burn1(om.Group): | |
def setup(self): | |
self.add_subsystem('comp1', om.ExecComp(['y1=x*2'], y1=np.ones(4), x=np.ones(4)), | |
promotes_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 | |
class RHS(om.Group): | |
def initialize(self): | |
self.options.declare('size', 1) |
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', |
OlderNewer