# assign inputs
name_, _folder, _run = IN
case = None

try:
    from butterfly_dynamo.case import Case
    import butterfly_dynamo.unitconversion as uc
except ImportError as e:
    msg = '\nFailed to import butterfly:'
    raise ImportError('{}\n{}'.format(msg, e))

if _folder and _run:
    # create OpenFoam Case
    case = Case.fromFolder(_folder, name_,
                           1.0 / uc.convertDocumentUnitsToMeters())
    case.save(overwrite=False)

# assign outputs to OUT
OUT = (case, )
示例#2
0
# assign inputs
_name, _BFGeometries, refRegions_, make2dParams_, _meshParams_, expandBlockMesh_, _run = IN
blockPts = case = None

try:
    from butterfly_dynamo.case import Case
    from butterfly_dynamo.geometry import xyzToPoint
    import butterfly_dynamo.unitconversion as uc
except ImportError as e:
    msg = '\nFailed to import butterfly:'

if _run and _name and _BFGeometries:
    # create OpenFoam Case
    ctm = uc.convertDocumentUnitsToMeters()

    case = Case.fromBFGeometries(_name,
                                 tuple(_BFGeometries),
                                 meshingParameters=_meshParams_,
                                 make2dParameters=make2dParams_,
                                 convertToMeters=ctm)

    for reg in refRegions_:
        case.addRefinementRegion(reg)

    if expandBlockMesh_:
        xCount, yCount, zCount = 1, 1, 1
        if case.blockMeshDict.is2dInXDirection:
            xCount = 0
        if case.blockMeshDict.is2dInYDirection:
            yCount = 0
        if case.blockMeshDict.is2dInZDirection: