Package PyFoam :: Package RunDictionary :: Module SolutionDirectory :: Class SolutionDirectory
[hide private]
[frames] | no frames]

Class SolutionDirectory

source code

                object --+    
                         |    
Basics.Utilities.Utilities --+
                             |
                            SolutionDirectory
Known Subclasses:
ChemkinSolutionDirectory

Represents a solution directory

In the solution directory subdirectories whose names are numbers are assumed to be solutions for a specific time-step

A sub-directory (called the Archive) is created to which solution data is copied

Instance Methods [hide private]
  __init__(self, name, archive="ArchiveDir", paraviewLink=True)
  isValid(self)
Checks whether this is a valid case directory by looking for the system- and constant-directories and the controlDict-file
  addToClone(self, name)
add directory to the list that is needed to clone this case
SolutionDirectory or correct subclass cloneCase(self, name, svnRemove=True)
create a clone of this case directory.
  packCase(self, tarname, last=False, exclude=[], additional=[])
Packs all the important files into a compressed tarfile.
  addToTar(self, tar, name, exclude=[])
The workhorse for the packCase-method
  reread(self)
Rescan the directory for the time directories
  processorDirs(self)
List with the processor directories
  nrProcs(self)
The number of directories with processor-data
  sorttimes(self, x, y)
Sort function for the solution files
  getTimes(self)
  addBackup(self, pth)
add file to list of files that are to be copied to the archive
str getLast(self)
  lastToArchive(self, name)
copy the last solution (plus the backup-files to the archive)
  clearResults(self, after=None, removeProcs=False)
remove all time-directories after a certain time.
  clearPattern(self, glob)
Clear all files that fit a certain shell (glob) pattern
  clearOther(self, pyfoam=True)
Remove additional directories
  clear(self, after=None, processor=True, pyfoam=True)
One-stop-shop to remove data
str initialDir(self)
str latestDir(self)
str constantDir(self, region=None)
str systemDir(self, region=None)
str controlDict(self)
str polyMeshDir(self, region=None)
str boundaryDict(self, region=None)
str blockMesh(self, region=None)
BasicFile makeFile(self, name)
create a file in the solution directory and return a corresponding BasicFile-object
  getRegions(self)
Gets a list of all the available mesh regions by checking all directories in constant and using all those that have a polyMesh-subdirectory

Inherited from Basics.Utilities.Utilities: execute, listDirectory, writeDictionaryHeader

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]

Inherited from Basics.Utilities.Utilities: excludeNames


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, name, archive="ArchiveDir", paraviewLink=True)
(Constructor)

source code 
Parameters:
  • name - Name of the solution directory
  • archive - name of the directory where the lastToArchive-method should copy files, if None no archive is created
  • paraviewLink - Create a symbolic link controlDict.foam for paraview
Overrides: Basics.Utilities.Utilities.__init__

isValid(self)

source code 
Checks whether this is a valid case directory by looking for the system- and constant-directories and the controlDict-file

addToClone(self, name)

source code 
add directory to the list that is needed to clone this case
Parameters:
  • name - name of the subdirectory (the case directory is prepended)

cloneCase(self, name, svnRemove=True)

source code 
create a clone of this case directory. Remove the target directory, if it already exists
Parameters:
  • name - Name of the new case directory
  • svnRemove - Look for .svn-directories and remove them
Returns: SolutionDirectory or correct subclass
The target directory

packCase(self, tarname, last=False, exclude=[], additional=[])

source code 
Packs all the important files into a compressed tarfile. Uses the essential-list and excludes the .svn-directories. Also excludes files ending with ~
Parameters:
  • tarname - the name of the tar-file
  • last - add the last directory to the list of directories to be added
  • exclude - List with additional glob filename-patterns to be excluded
  • additional - List with additional glob filename-patterns that are to be added

addToTar(self, tar, name, exclude=[])

source code 
The workhorse for the packCase-method

reread(self)

source code 
Rescan the directory for the time directories

processorDirs(self)

source code 
List with the processor directories

nrProcs(self)

source code 
The number of directories with processor-data

sorttimes(self, x, y)

source code 
Sort function for the solution files

getTimes(self)

source code 
Returns:
List of all the available times

addBackup(self, pth)

source code 
add file to list of files that are to be copied to the archive

getLast(self)

source code 
Returns: str
the last time for which a solution exists

lastToArchive(self, name)

source code 
copy the last solution (plus the backup-files to the archive)
Parameters:
  • name - name of the sub-directory in the archive

clearResults(self, after=None, removeProcs=False)

source code 
remove all time-directories after a certain time. If not time ist set the initial time is used
Parameters:
  • after - time after which directories ar to be removed
  • removeProcs - if True the processorX-directories are removed. Otherwise the timesteps after last are removed from the processor-directories

clearPattern(self, glob)

source code 
Clear all files that fit a certain shell (glob) pattern
Parameters:
  • glob - the pattern which the files are going to fit

clearOther(self, pyfoam=True)

source code 
Remove additional directories
Parameters:
  • pyfoam - rremove all directories typically created by PyFoam

clear(self, after=None, processor=True, pyfoam=True)

source code 
One-stop-shop to remove data
Parameters:
  • after - time after which directories ar to be removed
  • processor - remove the processorXX directories
  • pyfoam - rremove all directories typically created by PyFoam

initialDir(self)

source code 
Returns: str
the name of the first time-directory (==initial conditions

latestDir(self)

source code 
Parameters:
  • region - Specify the region for cases with more than 1 mesh
Returns: str
the name of the first last-directory (==simulation results)

constantDir(self, region=None)

source code 
Parameters:
  • region - Specify the region for cases with more than 1 mesh
Returns: str
the name of the constant-directory

systemDir(self, region=None)

source code 
Parameters:
  • region - Specify the region for cases with more than 1 mesh
Returns: str
the name of the system-directory

controlDict(self)

source code 
Parameters:
  • region - Specify the region for cases with more than 1 mesh
Returns: str
the name of the controlDict

polyMeshDir(self, region=None)

source code 
Parameters:
  • region - Specify the region for cases with more than 1 mesh
Returns: str
the name of the polyMesh

boundaryDict(self, region=None)

source code 
Parameters:
  • region - Specify the region for cases with more than 1 mesh
Returns: str
name of the boundary-file

blockMesh(self, region=None)

source code 
Parameters:
  • region - Specify the region for cases with more than 1 mesh
Returns: str
the name of the blockMeshDict if it exists. Returns an empty string if it doesn't

makeFile(self, name)

source code 
create a file in the solution directory and return a corresponding BasicFile-object
Parameters:
  • name - Name of the file
Returns: BasicFile

getRegions(self)

source code 
Gets a list of all the available mesh regions by checking all directories in constant and using all those that have a polyMesh-subdirectory