Exemple #1
0
-

    Args:
        _pressure_: Pressure as a float (default: 0).
        temperature_: Temperature in degrees celsius.
    Returns:
        outletBoundary: Buttefly outlet boundary.
"""

ghenv.Component.Name = "Butterfly_Outlet Boundary"
ghenv.Component.NickName = "outlet"
ghenv.Component.Message = 'VER 0.0.04\nMAR_14_2017'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "01::Boundary"
ghenv.Component.AdditionalHelpFromDocStrings = "1"

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

_pressure_ = FixedValue(_pressure_) if _pressure_ else None

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

outletBoundary = FixedOutletBoundaryCondition(p=_pressure_, T=temperature_)
Exemple #2
0
Create a wall boundary.

-

    Args:
        temperature_: Temperature in degrees celsius.
    Returns:
        wallBoundary: Buttefly wall boundary.
"""

ghenv.Component.Name = "Butterfly_Wall Boundary"
ghenv.Component.NickName = "wall"
ghenv.Component.Message = 'VER 0.0.04\nMAR_14_2017'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "01::Boundary"
ghenv.Component.AdditionalHelpFromDocStrings = "1"

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

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

wallBoundary = IndoorWallBoundaryCondition(T=temperature_)

Exemple #3
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_)

# You should have received a copy of the GNU General Public License
# along with Ladybug; If not, see <http://www.gnu.org/licenses/>.
#
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
"""
Fixed value boundary condition.

-
    Args:
        _value: input value.
        
    Returns:
        fixed_value: Fixed value boundary condition.
"""

ghenv.Component.Name = "Butterfly_fixedValue"
ghenv.Component.NickName = "fixedValue"
ghenv.Component.Message = 'VER 0.0.05\nJAN_12_2019'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "02::BoundaryCondition"
ghenv.Component.AdditionalHelpFromDocStrings = "1"

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

if _value:
    fixed_value = FixedValue(_value)
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_)