コード例 #1
0
def XoodlesPitzTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"Xoodles")
    else:
        prefix=path.join(prefix,"combustion","XiFoam","les")
    return path.join(prefix,"pitzDaily3D")
コード例 #2
0
def potentialCylinderTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"potentialFoam")
    else:
        prefix=path.join(prefix,"basic","potentialFoam")
    return path.join(prefix,"cylinder")
コード例 #3
0
def turbCavityTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"turbFoam")
    else:
        prefix=path.join(prefix,"incompressible","pisoFoam","ras")
    return path.join(prefix,"cavity")
コード例 #4
0
ファイル: FoamFileGenerator.py プロジェクト: floli/tools
def damBreakTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"interFoam")
    else:
        prefix=path.join(prefix,"multiphase","interFoam","laminar")            
    return path.join(prefix,"damBreak")
コード例 #5
0
def XoodlesPitzTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"Xoodles")
    else:
        prefix=path.join(prefix,"combustion","XiFoam","les")
    return path.join(prefix,"pitzDaily3D")
コード例 #6
0
ファイル: FoamFileGenerator.py プロジェクト: floli/tools
def potentialCylinderTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"potentialFoam")            
    else:
        prefix=path.join(prefix,"basic","potentialFoam")            
    return path.join(prefix,"cylinder")
コード例 #7
0
ファイル: FoamFileGenerator.py プロジェクト: floli/tools
def turbCavityTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"turbFoam")            
    else:
        prefix=path.join(prefix,"incompressible","pisoFoam","ras")            
    return path.join(prefix,"cavity")
コード例 #8
0
ファイル: PotentialRunner.py プロジェクト: floli/tools
    def __init__(self,sol,correctors,tolerance,relTol,pRefValue=None,pRefCell=None):
        self.solution=ParsedParameterFile(path.join(sol.systemDir(),"fvSolution"),backup=True)
        self.schemes=ParsedParameterFile(path.join(sol.systemDir(),"fvSchemes"),backup=True)
        self.control=ParsedParameterFile(path.join(sol.systemDir(),"controlDict"),backup=True)
        self.controlOrig=ParsedParameterFile(path.join(sol.systemDir(),"controlDict"),backup=False)
        
        pre=environ["FOAM_TUTORIALS"]
        if not oldTutorialStructure():
            pre=path.join(pre,"basic")
        pot=SolutionDirectory(path.join(pre,"potentialFoam","cylinder"),archive=None,paraviewLink=False)
        
        self.fresh=True
        
        try:
            if "SIMPLE" not in self.solution:
                self.solution["SIMPLE"]=ParsedParameterFile(path.join(pot.systemDir(),"fvSolution"),backup=False)["SIMPLE"]

            if "nNonOrthogonalCorrectors" not in self.solution["SIMPLE"] and correctors==None:
                correctors=3
                warning("Setting number of correctors to default value",correctors)
            if correctors!=None:
                self.solution["SIMPLE"]["nNonOrthogonalCorrectors"]=correctors

            if pRefCell!=None:
                self.solution["SIMPLE"]["pRefCell"]=pRefCell
            if pRefValue!=None:
                self.solution["SIMPLE"]["pRefValue"]=pRefValue
                
            if tolerance!=None:
                try:
                    self.solution["solvers"]["p"][1]["tolerance"]=tolerance
                except KeyError:
                    # 1.6 format
                    self.solution["solvers"]["p"]["tolerance"]=tolerance
                    
            if relTol!=None:
                try:
                    self.solution["solvers"]["p"][1]["relTol"]=relTol
                except KeyError:
                    # 1.6 format
                    self.solution["solvers"]["p"]["relTol"]=relTol
                    
            self.schemes.content=ParsedParameterFile(path.join(pot.systemDir(),"fvSchemes"),backup=False).content
            self.control.content=ParsedParameterFile(path.join(pot.systemDir(),"controlDict"),backup=False).content
            if "functions" in self.controlOrig:
                print "Copying functions over"
                self.control["functions"]=self.controlOrig["functions"]
            if "libs" in self.controlOrig:
                print "Copying libs over"
                self.control["libs"]=self.controlOrig["libs"]
                
            self.solution.writeFile()
            self.schemes.writeFile()
            self.control.writeFile()
        except Exception,e:
            warning("Restoring defaults")
            self.solution.restore()
            self.schemes.restore()
            self.control.restore()
            raise e
コード例 #9
0
def damBreakTutorial():
    prefix = foamTutorials()
    if oldTutorialStructure():
        prefix = path.join(prefix, "interFoam")
    else:
        prefix = path.join(prefix, "multiphase", "interFoam", "laminar")
    return path.join(prefix, "damBreak")
def bubbleColumnTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"multiphase")
    if foamVersionNumber()>=(3,):
        return path.join(prefix,"twoPhaseEulerFoam","laminar","bubbleColumn")
    else:
        return path.join(prefix,"twoPhaseEulerFoam","bubbleColumn")
コード例 #11
0
def bubbleColumnTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"multiphase")
    if foamVersionNumber()>=(3,):
        return path.join(prefix,"twoPhaseEulerFoam","laminar","bubbleColumn")
    else:
        return path.join(prefix,"twoPhaseEulerFoam","bubbleColumn")
コード例 #12
0
def simpleBikeTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"incompressible")
    else:
        error("The simpleFoam-motorBike-case does not exist before 1.6")

    return path.join(prefix,"simpleFoam","motorBike")
コード例 #13
0
 def setUp(self):
     if oldTutorialStructure():
         null="0"
     elif foamFork() in ["openfoam","openfoamplus"] and foamVersionNumber()>=(4,):
         null="0.orig"
     else:
         null="0.org"
     self.fileName=path.join(simpleBikeTutorial(),null,"U")
コード例 #14
0
def buoyHotRoomTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"heatTransfer")
    if foamVersionNumber()>=(3,):
        return path.join(prefix,"buoyantSimpleFoam","hotRadiationRoom")
    else:
        return path.join(prefix,"buoyantSimpleFoam","hotRoom")
コード例 #15
0
ファイル: FoamFileGenerator.py プロジェクト: floli/tools
def simpleBikeTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"incompressible")
    else:
        error("The simpleFoam-motorBike-case does not exist before 1.6")
        
    return path.join(prefix,"simpleFoam","motorBike")
コード例 #16
0
ファイル: FoamFileGenerator.py プロジェクト: floli/tools
 def setUp(self):
     self.theDir=tmpnam()
     if oldTutorialStructure():
         null="0"
     else:
         null="0.org"
     system("cp -r "+path.join(simpleBikeTutorial(),null)+" "+self.theDir)
     self.theFile=path.join(self.theDir,"U")
def damBreakTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"interFoam")
    else:
        prefix=path.join(prefix,"multiphase","interFoam","laminar")
        if foamFork() in ["openfoam","openfoamplus"] and foamVersionNumber()>=(4,):
            prefix=path.join(prefix,"damBreak")
    return path.join(prefix,"damBreak")
コード例 #18
0
def damBreakTutorial():
    prefix=foamTutorials()
    if oldTutorialStructure():
        prefix=path.join(prefix,"interFoam")
    else:
        prefix=path.join(prefix,"multiphase","interFoam","laminar")
        if foamFork() in ["openfoam","openfoamplus"] and foamVersionNumber()>=(4,):
            prefix=path.join(prefix,"damBreak")
    return path.join(prefix,"damBreak")
コード例 #19
0
ファイル: FoamFileGenerator.py プロジェクト: minhbau/PyFoam
    def setUp(self):
        self.theDir=mkdtemp()
        if oldTutorialStructure():
            null="0"
        else:
            null="0.org"

        usedDir=path.join(self.theDir,"data")
        copytree(path.join(simpleBikeTutorial(),null),usedDir)
        self.theFile=path.join(usedDir,"U")
コード例 #20
0
ファイル: FoamFileGenerator.py プロジェクト: LeeRuns/PyFoam
    def setUp(self):
        self.theDir=mkdtemp()
        if oldTutorialStructure():
            null="0"
        else:
            null="0.org"

        usedDir=path.join(self.theDir,"data")
        copytree(path.join(simpleBikeTutorial(),null),usedDir)
        self.theFile=path.join(usedDir,"U")
コード例 #21
0
    def setUp(self):
        self.theDir=mkdtemp()
        if oldTutorialStructure():
            null="0"
        elif foamFork() in ["openfoam","openfoamplus"] and foamVersionNumber()>=(4,):
            null="0.orig"
        else:
            null="0.org"

        usedDir=path.join(self.theDir,"data")
        copytree(path.join(simpleBikeTutorial(),null),usedDir)
        self.theFile=path.join(usedDir,"U")
    def setUp(self):
        self.theDir=mkdtemp()
        if oldTutorialStructure():
            null="0"
        elif foamFork() in ["openfoam","openfoamplus"] and foamVersionNumber()>=(4,):
            null="0.orig"
        else:
            null="0.org"

        usedDir=path.join(self.theDir,"data")
        copytree(path.join(simpleBikeTutorial(),null),usedDir)
        self.theFile=path.join(usedDir,"U")
コード例 #23
0
ファイル: FoamFileGenerator.py プロジェクト: floli/tools
def bubbleColumnTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"multiphase")            
    return path.join(prefix,"twoPhaseEulerFoam","bubbleColumn")
コード例 #24
0
ファイル: FoamFileGenerator.py プロジェクト: minhbau/PyFoam
def bubbleColumnTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"multiphase")
    return path.join(prefix,"twoPhaseEulerFoam","bubbleColumn")
コード例 #25
0
 def setUp(self):
     if oldTutorialStructure():
         null="0"
     else:
         null="0.org"
     self.fileName=path.join(simpleBikeTutorial(),null,"U")
コード例 #26
0
def dieselAachenTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"combustion")
    return path.join(prefix,"dieselFoam","aachenBomb")
コード例 #27
0
ファイル: PotentialRunner.py プロジェクト: minhbau/PyFoam
    def __init__(self,
                 sol,
                 correctors,
                 tolerance,
                 relTol,
                 pRefValue=None,
                 pRefCell=None,
                 removeLibs=False,
                 removeFunctions=False):
        self.solution = ParsedParameterFile(path.join(sol.systemDir(),
                                                      "fvSolution"),
                                            backup=True)
        self.schemes = ParsedParameterFile(path.join(sol.systemDir(),
                                                     "fvSchemes"),
                                           backup=True)
        self.control = ParsedParameterFile(path.join(sol.systemDir(),
                                                     "controlDict"),
                                           backup=True)
        self.controlOrig = ParsedParameterFile(path.join(
            sol.systemDir(), "controlDict"),
                                               backup=False)

        pre = environ["FOAM_TUTORIALS"]
        if not oldTutorialStructure():
            pre = path.join(pre, "basic")
        pot = SolutionDirectory(path.join(pre, "potentialFoam", "cylinder"),
                                archive=None,
                                paraviewLink=False)

        self.fresh = True

        try:
            if "SIMPLE" not in self.solution and foamVersion()[0] < 2:
                self.solution["SIMPLE"] = ParsedParameterFile(
                    path.join(pot.systemDir(),
                              "fvSolution"), backup=False)["SIMPLE"]

            if foamVersion()[0] < 2:
                solutionBlock = self.solution["SIMPLE"]
            else:
                self.solution["potentialFlow"] = {}
                solutionBlock = self.solution["potentialFlow"]

            if "nNonOrthogonalCorrectors" not in solutionBlock and correctors == None:
                correctors = 3
                warning("Setting number of correctors to default value",
                        correctors)
            if correctors != None:
                solutionBlock["nNonOrthogonalCorrectors"] = correctors

            if pRefCell != None:
                solutionBlock["pRefCell"] = pRefCell
            if pRefValue != None:
                solutionBlock["pRefValue"] = pRefValue

            if tolerance != None:
                try:
                    self.solution["solvers"]["p"][1]["tolerance"] = tolerance
                except KeyError:
                    # 1.6 format
                    self.solution["solvers"]["p"]["tolerance"] = tolerance

            if relTol != None:
                try:
                    self.solution["solvers"]["p"][1]["relTol"] = relTol
                except KeyError:
                    # 1.6 format
                    self.solution["solvers"]["p"]["relTol"] = relTol

            self.schemes.content = ParsedParameterFile(path.join(
                pot.systemDir(), "fvSchemes"),
                                                       backup=False).content
            self.control.content = ParsedParameterFile(path.join(
                pot.systemDir(), "controlDict"),
                                                       backup=False).content
            for k in ["functions", "libs"]:
                if k in self.control:
                    print_("Remove", k, "from controlDict")
                    del self.control[k]

            if "functions" in self.controlOrig and not removeFunctions:
                print_("Copying functions over")
                self.control["functions"] = self.controlOrig["functions"]
            if "libs" in self.controlOrig and not removeLibs:
                print_("Copying libs over")
                self.control["libs"] = self.controlOrig["libs"]

            self.solution.writeFile()
            self.schemes.writeFile()
            self.control.writeFile()
        except Exception:
            e = sys.exc_info()[
                1]  # Needed because python 2.5 does not support 'as e'
            warning("Restoring defaults")
            self.solution.restore()
            self.schemes.restore()
            self.control.restore()
            raise e
コード例 #28
0
ファイル: FoamFileGenerator.py プロジェクト: floli/tools
def buoyHotRoomTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"heatTransfer")            
    return path.join(prefix,"buoyantSimpleFoam","hotRoom")
コード例 #29
0
 def setUp(self):
     if oldTutorialStructure():
         null = "0"
     else:
         null = "0.org"
     self.fileName = path.join(simpleBikeTutorial(), null, "U")
コード例 #30
0
ファイル: ParsedBlockMeshDict.py プロジェクト: LeeRuns/PyFoam
def plateHoleTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"stressAnalysis")
    return path.join(prefix,"solidDisplacementFoam","plateHole")
コード例 #31
0
def simplePitzTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"incompressible")
    return path.join(prefix,"simpleFoam","pitzDaily")
コード例 #32
0
ファイル: FoamFileGenerator.py プロジェクト: minhbau/PyFoam
def buoyHotRoomTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"heatTransfer")
    return path.join(prefix,"buoyantSimpleFoam","hotRoom")
コード例 #33
0
def plateHoleTutorial():
    prefix = foamTutorials()
    if not oldTutorialStructure():
        prefix = path.join(prefix, "stressAnalysis")
    return path.join(prefix, "solidDisplacementFoam", "plateHole")
コード例 #34
0
def dieselAachenTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"combustion")
    return path.join(prefix,"dieselFoam","aachenBomb")
コード例 #35
0
    def __init__(self,
                 sol,
                 correctors,
                 tolerance,
                 relTol,
                 pRefValue=None,
                 pRefCell=None,
                 removeLibs=False,
                 removeFunctions=False):
        self.solution=ParsedParameterFile(path.join(sol.systemDir(),"fvSolution"),backup=True)
        self.schemes=ParsedParameterFile(path.join(sol.systemDir(),"fvSchemes"),backup=True)
        self.control=ParsedParameterFile(path.join(sol.systemDir(),"controlDict"),backup=True)
        self.controlOrig=ParsedParameterFile(path.join(sol.systemDir(),"controlDict"),backup=False)

        pre=environ["FOAM_TUTORIALS"]
        if not oldTutorialStructure():
            pre=path.join(pre,"basic")
        pot=SolutionDirectory(path.join(pre,"potentialFoam","cylinder"),archive=None,paraviewLink=False)

        self.fresh=True

        try:
            if "SIMPLE" not in self.solution and foamVersion()[0]<2:
                self.solution["SIMPLE"]=ParsedParameterFile(path.join(pot.systemDir(),"fvSolution"),backup=False)["SIMPLE"]

            if foamVersion()[0]<2:
                solutionBlock=self.solution["SIMPLE"]
            else:
                self.solution["potentialFlow"]={}
                solutionBlock=self.solution["potentialFlow"]

            if "nNonOrthogonalCorrectors" not in solutionBlock and correctors==None:
                correctors=3
                warning("Setting number of correctors to default value",correctors)
            if correctors!=None:
                solutionBlock["nNonOrthogonalCorrectors"]=correctors

            if pRefCell!=None:
                solutionBlock["pRefCell"]=pRefCell
            if pRefValue!=None:
                solutionBlock["pRefValue"]=pRefValue

            if tolerance!=None:
                try:
                    self.solution["solvers"]["p"][1]["tolerance"]=tolerance
                except KeyError:
                    # 1.6 format
                    self.solution["solvers"]["p"]["tolerance"]=tolerance

            if relTol!=None:
                try:
                    self.solution["solvers"]["p"][1]["relTol"]=relTol
                except KeyError:
                    # 1.6 format
                    self.solution["solvers"]["p"]["relTol"]=relTol

            self.schemes.content=ParsedParameterFile(path.join(pot.systemDir(),"fvSchemes"),backup=False).content
            self.control.content=ParsedParameterFile(path.join(pot.systemDir(),"controlDict"),backup=False).content
            for k in ["functions","libs"]:
                if k in self.control:
                    print_("Remove",k,"from controlDict")
                    del self.control[k]

            if "functions" in self.controlOrig and not removeFunctions:
                print_("Copying functions over")
                self.control["functions"]=self.controlOrig["functions"]
            if "libs" in self.controlOrig and not removeLibs:
                print_("Copying libs over")
                self.control["libs"]=self.controlOrig["libs"]

            self.solution.writeFile()
            self.schemes.writeFile()
            self.control.writeFile()
        except Exception:
            e = sys.exc_info()[1] # Needed because python 2.5 does not support 'as e'
            warning("Restoring defaults")
            self.solution.restore()
            self.schemes.restore()
            self.control.restore()
            raise e
コード例 #36
0
def simplePitzTutorial():
    prefix=foamTutorials()
    if not oldTutorialStructure():
        prefix=path.join(prefix,"incompressible")
    return path.join(prefix,"simpleFoam","pitzDaily")