Example #1
0
def step1():
    generalPath = os.getcwd()
    mc = Manipulations(basePath=basePathStep1)
    mc.generatorNewName('parabolic', 'solved', baseNewName='step1')
    newName = mc.getName('newName')
    mc.createNewPath(dirmame=os.getcwd(), newCaseName=newName)
    runPath = mc.getPath('newPath')
    mc.dublicateCase(basePath=basePathStep1, newPath=runPath, mode='rewrite')

    sc = SetSystem(pathCase=runPath)
    sc.setControlDict(controlDict)

    initialClass = IntiailValue(pathCase=runPath)
    initialDictCalculated = initialClass.calcInitVal(A, B, Uin, nu)
    initialClass.setVarAllFiels(initialDictConst, initialDictCalculated)

    cpClass = SetConstantParam(pathCase=runPath)
    cpClass.setTurbModel(turbType)
    cpClass.setTransportProp(tranPropDict)

    meshClass = Mesh(pathCase=runPath)
    meshClass.setBlockMesh(meshList)
    meshClass.runBlockMesh()

    rc = Runner(pathCase=runPath)
    rc.setCoresOF(coreOF=coreOF)
    rc.setNameSolver(solverName=solverName)
    rc.setModeRunner(mode=mode)
    rc.setPyFoamSettings(pyFoam=False)
    rc.setDecomposeParDict(coreOF, nameVar='core_OF')
    rc.runCase()

    os.chdir(generalPath)
    return os.path.abspath(runPath)
Example #2
0
def step3(oldpath):
    generalPath = os.getcwd()
    mc = Manipulations(basePath=basePathStep2)
    mc.generatorNewName('parabolic', 'solved', 'mapped', baseNewName='step2')
    newName = mc.getName('newName')
    mc.createNewPath(dirmame=os.getcwd(), newCaseName=newName)
    runPath = mc.getPath('newPath')
    mc.dublicateCase(basePath=basePathStep2, newPath=runPath, mode='rewrite')

    sc = SetSystem(pathCase=runPath)
    sc.setControlDict(controlDict)

    initialClass = IntiailValue(pathCase=runPath)
    initialClass.copyBC(oldpath,
                        runPath,
                        nameBCsource='outlet',
                        nameBCdist='inlet',
                        mapTimeStep=stopTime)
    initialClass.setMappSet(sourcePath=oldpath,
                            distPath=runPath,
                            source='0',
                            dist='0')
    initialClass.setMappValues()

    cpClass = SetConstantParam(pathCase=runPath)
    cpClass.setTurbModel(turbType)
    cpClass.setTransportProp(tranPropDict)

    meshClass = Mesh(pathCase=runPath)
    meshClass.setBlockMesh(meshList)
    meshClass.runBlockMesh()

    rc = Runner(pathCase=runPath)
    rc.setCoresOF(coreOF=coreOF)
    rc.setNameSolver(solverName=solverName)
    rc.setModeRunner(mode=mode)
    rc.setPyFoamSettings(pyFoam=False)
    rc.setDecomposeParDict(coreOF, nameVar='core_OF')
    rc.runCase()
    os.chdir(generalPath)
    return os.path.abspath(runPath)
Example #3
0
from data import *

if __name__ == "__main__":

    mc = Manipulations(basePath=basePath)
    mc.generatorNewName('solved', baseNewName=basePath)
    newName = mc.getName('newName')
    mc.createNewPath(dirmame=os.getcwd(), newCaseName=newName)
    newPath = mc.getPath('newPath')
    mc.dublicateCase(basePath=basePath, newPath=newPath, mode='rewrite')

    sc = SetSystem(pathCase=newPath)
    sc.setControlDict(controlDict)

    meshClass = Mesh(pathCase=newPath)
    meshClass.setBlockMesh(meshList)
    meshClass.runBlockMesh()

    ic = IntiailValue(pathCase=newPath)
    newDict = ic.calcInitVal(A, B, Uin, nu)
    ic.setVarAllFiels(constDictVar, newDict)

    cc = SetConstantParam(pathCase=newPath)
    cc.setTransportProp(tranPropDict)
    cc.setTurbModel(typeTurbModel='kEpsilon')

    rc = Runner()
    rc.setCores()
    rc.setPathCase(newPath)
    rc.setNameSolver(solverName='pimpleFoam')
Example #4
0
from data import *

if __name__ == "__main__":

    mc = Manipulations(basePath=basePath)
    mc.generatorNewName('solved', baseNewName=basePath)
    newName = mc.getName('newName')
    mc.createNewPath(dirmame=os.getcwd(), newCaseName=newName)
    runPath = mc.getPath('newPath')
    mc.dublicateCase(basePath=basePath, newPath=runPath, mode='rewrite')

    sc = SetSystem(pathCase=runPath)
    sc.setControlDict(controlDict)

    Mesh().runBlockMesh(pathCase=runPath)

    ic = IntiailValue(pathCase=runPath)
    ic.setVarAllFiels(constDictVar)

    cc = SetConstantParam(pathCase=runPath)
    cc.setTransportProp(tranPropDict)  # write viscosity in transportProperies

    rc = Runner()
    rc.setPathCase(runPath)
    rc.setCoresOF(coreOF=coreOF)
    rc.setNameSolver(solverName=solverName)
    rc.setModeRunner(mode='parallel')
    rc.setPyFoamSettings(pyFoam=False)
    rc.setDecomposeParDict(coreOF, nameVar='core_OF')
    rc.runCase()