Python code for OpenFOAM

发布于 2022-07-07  446 次阅读


Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

Case folder creation:

def CaseFolderCreate(CaseFolderName, isDelete):
    """
    This function is used to create a folder for the case with essential subfolders.
    :param CaseFolderName:  Name of the folder.
    :param isDelete:    Whether to delete the folder if it exists.
    :return:    None.
    """
    isExists = os.path.exists(CaseFolderName)
    if isExists and isDelete:
        shutil.rmtree(CaseFolderName)
    os.makedirs(CaseFolderName)
    os.makedirs(CaseFolderName + '/0')
    os.makedirs(CaseFolderName + '/constant')
    os.makedirs(CaseFolderName + '/system')
    open(CaseFolderName + '/foam.foam', 'w')

    return None
Everything not saved will be lost.
最后更新于 2022-07-07