|
11 | 11 |
|
12 | 12 | """
|
13 | 13 |
|
14 |
| -__version__ = "3.0.3" |
| 14 | +__version__ = "3.0.4" |
15 | 15 |
|
16 | 16 | import subprocess
|
17 | 17 | import os
|
@@ -456,11 +456,6 @@ def __init__(self):
|
456 | 456 | # ************************************ Advance Options ****************************************
|
457 | 457 | # *********************************************************************************************
|
458 | 458 |
|
459 |
| - ## The root directory for the DAFoam case. If rooDir = "None" (default), we will assign os.getcwd() to rootDir |
460 |
| - ## If we want to have multiple cases running at the same time, e.g., coupled wing propeller case, we may |
461 |
| - ## set different rootDirs for each case. NOTE: if we set rootDir, we need to set an absolute path! |
462 |
| - self.rootDir = "None" |
463 |
| - |
464 | 459 | ## The run status which can be solvePrimal, solveAdjoint, or calcTotalDeriv. This parameter is
|
465 | 460 | ## used internally, so users should never change this option in the Python layer.
|
466 | 461 | self.runStatus = "None"
|
@@ -664,13 +659,6 @@ def __init__(self, comm=None, options=None):
|
664 | 659 | # check if the combination of options is valid.
|
665 | 660 | self._checkOptions()
|
666 | 661 |
|
667 |
| - # the absolute path where the run script is located at |
668 |
| - if self.getOption("rootDir") == "None": |
669 |
| - self.rootDir = os.getcwd() |
670 |
| - else: |
671 |
| - self.rootDir = self.getOption("rootDir") |
672 |
| - self.cdRoot() |
673 |
| - |
674 | 662 | # Initialize families
|
675 | 663 | self.families = OrderedDict()
|
676 | 664 |
|
@@ -807,8 +795,6 @@ def __call__(self):
|
807 | 795 | # update the mesh coordinates if DVGeo is set
|
808 | 796 | # add point set and update the mesh based on the DV values
|
809 | 797 |
|
810 |
| - self.cdRoot() |
811 |
| - |
812 | 798 | if self.DVGeo is not None:
|
813 | 799 |
|
814 | 800 | # if the point set is not in DVGeo add it first
|
@@ -1659,9 +1645,7 @@ def writeFieldSensitivityMap(self, objFuncName, designVarName, solutionTime, fie
|
1659 | 1645 | The Petsc vector that contains the sensitivity
|
1660 | 1646 | """
|
1661 | 1647 |
|
1662 |
| - self.cdRoot() |
1663 |
| - |
1664 |
| - workingDir = self.rootDir |
| 1648 | + workingDir = os.getcwd() |
1665 | 1649 | if self.parallel:
|
1666 | 1650 | sensDir = "processor%d/%.8f/" % (self.rank, solutionTime)
|
1667 | 1651 | else:
|
@@ -1736,9 +1720,7 @@ def writeSurfaceSensitivityMap(self, objFuncName, designVarName, solutionTime):
|
1736 | 1720 | conn, faceSizes = self.getSurfaceConnectivity(self.allWallsGroup)
|
1737 | 1721 | conn = np.array(conn).flatten()
|
1738 | 1722 |
|
1739 |
| - self.cdRoot() |
1740 |
| - |
1741 |
| - workingDir = self.rootDir |
| 1723 | + workingDir = os.getcwd() |
1742 | 1724 | if self.parallel:
|
1743 | 1725 | meshDir = "processor%d/%.11f/polyMesh/" % (self.rank, solutionTime)
|
1744 | 1726 | sensDir = "processor%d/%.11f/" % (self.rank, solutionTime)
|
@@ -1946,8 +1928,6 @@ def solveAdjoint(self):
|
1946 | 1928 | viewerW(self.wVec)
|
1947 | 1929 | """
|
1948 | 1930 |
|
1949 |
| - self.cdRoot() |
1950 |
| - |
1951 | 1931 | if self.getOption("useAD")["mode"] == "forward":
|
1952 | 1932 | raise Error("solveAdjoint only supports useAD->mode=reverse|fd")
|
1953 | 1933 |
|
@@ -2672,8 +2652,6 @@ def runColoring(self):
|
2672 | 2652 | Info("| Running Coloring Solver |")
|
2673 | 2653 | Info("+--------------------------------------------------------------------------+")
|
2674 | 2654 |
|
2675 |
| - self.cdRoot() |
2676 |
| - |
2677 | 2655 | solverName = self.getOption("solverName")
|
2678 | 2656 | if solverName in self.solverRegistry["Incompressible"]:
|
2679 | 2657 |
|
@@ -2729,8 +2707,7 @@ def deletePrevPrimalSolTime(self):
|
2729 | 2707 |
|
2730 | 2708 | solTime = self.solver.getPrevPrimalSolTime()
|
2731 | 2709 |
|
2732 |
| - self.cdRoot() |
2733 |
| - rootDir = self.rootDir |
| 2710 | + rootDir = os.getcwd() |
2734 | 2711 | if self.parallel:
|
2735 | 2712 | checkPath = os.path.join(rootDir, "processor%d/%g" % (self.comm.rank, solTime))
|
2736 | 2713 | else:
|
@@ -2763,8 +2740,7 @@ def renameSolution(self, solIndex):
|
2763 | 2740 | """
|
2764 | 2741 |
|
2765 | 2742 | allSolutions = []
|
2766 |
| - self.cdRoot() |
2767 |
| - rootDir = self.rootDir |
| 2743 | + rootDir = os.getcwd() |
2768 | 2744 | if self.parallel:
|
2769 | 2745 | checkPath = os.path.join(rootDir, "processor%d" % self.comm.rank)
|
2770 | 2746 | else:
|
@@ -2952,8 +2928,7 @@ def _readMeshInfo(self):
|
2952 | 2928 | Initialize mesh information and read mesh information
|
2953 | 2929 | """
|
2954 | 2930 |
|
2955 |
| - self.cdRoot() |
2956 |
| - dirName = self.rootDir |
| 2931 | + dirName = os.getcwd() |
2957 | 2932 |
|
2958 | 2933 | self.fileNames, self.xv0, self.faces, self.boundaries, self.owners, self.neighbours = self._readOFGrid(dirName)
|
2959 | 2934 | self.xv = copy.copy(self.xv0)
|
@@ -3769,12 +3744,6 @@ def vec2ArraySeq(self, vec):
|
3769 | 3744 | array1[i] = vec[i]
|
3770 | 3745 | return array1
|
3771 | 3746 |
|
3772 |
| - def cdRoot(self): |
3773 |
| - """ |
3774 |
| - Go to the case root dir, as set in self.rootDir |
3775 |
| - """ |
3776 |
| - os.chdir(self.rootDir) |
3777 |
| - |
3778 | 3747 | def _printCurrentOptions(self):
|
3779 | 3748 | """
|
3780 | 3749 | Prints a nicely formatted dictionary of all the current solver
|
@@ -3806,8 +3775,8 @@ def _writeDecomposeParDict(self):
|
3806 | 3775 | """
|
3807 | 3776 | if self.comm.rank == 0:
|
3808 | 3777 | # Open the options file for writing
|
3809 |
| - self.cdRoot() |
3810 |
| - workingDirectory = self.rootDir |
| 3778 | + |
| 3779 | + workingDirectory = os.getcwd() |
3811 | 3780 | sysDir = "system"
|
3812 | 3781 | varDir = os.path.join(workingDirectory, sysDir)
|
3813 | 3782 | fileName = "decomposeParDict"
|
|
0 commit comments