Beispiel #1
0
    Returns:
        inlet_boundary: Buttefly inlet boundary.
"""

ghenv.Component.Name = "Butterfly_Inlet Boundary"
ghenv.Component.NickName = "inletvel"
ghenv.Component.Message = 'VER 0.0.05\nJAN_12_2019'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "01::Boundary"
ghenv.Component.AdditionalHelpFromDocStrings = "1"

try:
    from butterfly import boundarycondition as bc
    from butterfly.fields import FixedValue
except ImportError as e:
    msg = '\nFailed to import butterfly:'
    raise ImportError('{}\n{}'.format(msg, e))

if _velocity_vec:
    _velocity_vec = FixedValue(str((_velocity_vec.X, _velocity_vec.Y, _velocity_vec.Z)).replace(',', '')) \
                   if _velocity_vec \
                   else None

    temperature_ = FixedValue(str(temperature_ + 273.15)) \
                   if temperature_ \
                   else None
                   
    inlet_boundary = bc.FixedInletBoundaryCondition(U=_velocity_vec,
                                                    T = temperature_)

# assign inputs
_volFlowRate, temperature_ = IN
inletBoundary = None

try:
    from butterfly import boundarycondition as bc
    from butterfly.fields import FixedValue, FlowRateInletVelocity
except ImportError as e:
    msg = '\nFailed to import butterfly. Did you install butterfly on your machine?' + \
            '\nYou can download butterfly from package manager.' + \
            '\nOpen an issue on github if you think this is a bug:' + \
            ' https://github.com/ladybug-analysis-tools/butterfly/issues'

    raise ImportError('{}\n{}'.format(msg, e))

if _volFlowRate:

    velocity = FlowRateInletVelocity(_volFlowRate, '(0 0 0)')

    temperature_ = FixedValue(str(temperature_ + 273.15)) \
                   if temperature_ \
                   else None

    inletBoundary = bc.FixedInletBoundaryCondition(U=velocity, T=temperature_)

# assign outputs to OUT
OUT = (inletBoundary, )
ghenv.Component.NickName = "inlet"
ghenv.Component.Message = 'VER 0.0.03\nOCT_30_2016'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "01::Boundary"
ghenv.Component.AdditionalHelpFromDocStrings = "1"

try:
    from butterfly import boundarycondition as bc
    from butterfly.fields import FixedValue
except ImportError as e:
    msg = '\nFailed to import butterfly. Did you install butterfly on your machine?' + \
            '\nYou can download the installer file from github: ' + \
            'https://github.com/mostaphaRoudsari/Butterfly/tree/master/plugin/grasshopper/samplefiles' + \
            '\nOpen an issue on github if you think this is a bug:' + \
            ' https://github.com/mostaphaRoudsari/Butterfly/issues'

    raise ImportError('{}\n{}'.format(msg, e))

if _velocityVec:
    _velocityVec = FixedValue(str(tuple(_velocityVec)).replace(',', '')) \
                   if _velocityVec \
                   else None

    temperature_ = FixedValue(str(temperature_ + 273.15)) \
                   if temperature_ \
                   else None

    inletBoundary = bc.FixedInletBoundaryCondition(refLevels=_refLevels_,
                                                   U=_velocityVec,
                                                   T=temperature_)