Exemplo n.º 1
0
 def __init__(self, dirPath):
     self.logger = logging.getLogger('BcModifier')
     self.machinesFile = None
     SolutionDirectory.__init__(self, dirPath)
Exemplo n.º 2
0
    def __init__(self,
                 name,
                 archive=None,
                 paraviewLink=True,
                 parallel=False,
                 region=None,
                 **kwargs):
        """
        :param name: Name of the solution directory
        :type name: string
        """
        # Run the parent constructor
        SolutionDirectory.__init__(self,
                                   name,
                                   archive=archive,
                                   paraviewLink=paraviewLink,
                                   parallel=parallel,
                                   region=region)
        self.resistances = {'CF': None, 'CT': None, 'RF': None, 'RT': None}

        # Get the used turbulence model
        self.turbulenceModel = self.getDictionaryContents(
            self.constantDir(), 'RASProperties')['RASModel']

        ###############################
        # Process optional parameters #
        ###############################
        if 'inletPatch' in kwargs.iterkeys():
            self.inletPatch = [kwargs['inletPatch']]
        else:
            # Detect the inlet patches automatically.
            uBC = ParsedParameterFile(join(self.name, self.first, "U"))
            for patchI in uBC["boundaryField"]:
                typeI = uBC['boundaryField'][patchI]['type']
                try:
                    valueI = uBC['boundaryField'][patchI]['value'].value()
                except KeyError:
                    valueI = None
                if typeI in Settings.inletPatchTypes and valueI > 0.0:
                    self.inletPatch.append(patchI)

            self.inletPatch = [Settings.inletPatch]

        if 'L' in kwargs.iterkeys():
            self.L = kwargs['L']
        else:
            self.L = 1.0

        if 'A' in kwargs.iterkeys():
            self.A = kwargs['A']
        else:
            self.A = 1.0

        if 'direction' in kwargs.iterkeys():
            self.direction = kwargs['direction']
        else:
            self.direction = -1

        self.updateInletVelocity()
        self.forces = self.createDataFile()

        try:
            self.calculateCoeffs()
        except TypeError:
            pass
        except ValueError:
            pass

        self.getShortCasePath()
        self.shortCaseName = split(self.name)[1]
Exemplo n.º 3
0
 def __init__(self, dirPath):
     self.logger = logging.getLogger('BcModifier')
     self.machinesFile = None
     SolutionDirectory.__init__(self, dirPath)