Esempio n. 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)
Esempio n. 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)
Esempio n. 3
0
from Modules.setSystem import SetSystem
from Modules.InitialValue import IntiailValue
from Modules.setConstant import SetConstantParam

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()
Esempio n. 4
0
from Modules.setSystem import SetSystem
from Modules.InitialValue import IntiailValue
from Modules.setConstant import SetConstantParam

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')
Esempio n. 5
0
    manipulationClass.changePath('tesPathh', keyPath='test')
    manipulationClass.changePath(
        'tesPathh', keyPath='123235')  # it should be error for test
    manipulationClass.generatorNewName('test',
                                       baseNewName=basePath,
                                       keyName='testName')
    ###
    manipulationClass.generatorNewName('solved', baseNewName=basePath)
    newName = manipulationClass.getName('newName')
    manipulationClass.createNewPath(dirmame=os.getcwd(), newCaseName=newName)
    newPath = manipulationClass.getPath('newPath')
    manipulationClass.dublicateCase(basePath=basePath,
                                    newPath=newPath,
                                    mode='rewrite')

    systemClass = SetSystem(pathCase=newPath)
    systemClass.setControlDict(controlDict)
    systemClass.setfvSolution(controlDict)  #test method
    systemClass.setfvSchemes(controlDict)  #test method
    systemClass.setAnyFiles(controlDict)  #test method

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

    initValueClass = IntiailValue(pathCase=newPath)
    newDict = initValueClass.calcInitVal(A, B, Uin, nu)
    initValueClass.setVarAllFiels(constDictVar, newDict)
    ###tests
    #initValueClass.setVarAllFiels()  # test
    #initValueClass.setVar(constDictVar, newDict)