Beispiel #1
0
    def read(self):
        print 'reading mesh'
        self.readMesh()

        vars=SchemeParser.parse(self.getVars())
        self.varsDict = scmToDict(vars)
        if self.varsDict is None:
            raise TypeError("vars is not an association list")

        self.config = scmToDict(self.getVar('case-config'))
        self.materials = {}
        self.faceZones = {}
        self.cellZones = {}
        
        mDict = scmToDict(self.getVar('materials'))
        for n,d in mDict.iteritems():
            self.materials[n] = FluentCase.Material(materialType=scmToPy(d[0]),
                                                    props=scmToDict(d[1]))

        rFaceZones = self.getFaceZones()
        for i in rFaceZones.keys():
            rfz = rFaceZones[i]
            self.faceZones[i] = FluentCase.FluentZone(ID=rfz.ID,
                                                       zoneName=rfz.zoneName,
                                                       threadType=rfz.threadType,
                                                       zoneType=rfz.zoneType,
                                                       varString=rfz.zoneVars)
        rCellZones = self.getCellZones()
        for i in rCellZones.keys():
            rfz = rCellZones[i]
            self.cellZones[i] = FluentCase.FluentZone(ID=rfz.ID,
                                                      zoneName=rfz.zoneName,
                                                      threadType=rfz.threadType,
                                                      zoneType=rfz.zoneType,
                                                      varString=rfz.zoneVars)
Beispiel #2
0
 def __init__(self,ID,zoneName,threadType,zoneType,varString):
     self.id = ID
     if zoneType == '':
         zoneType = getZoneType(threadType)
         
     if zoneName == '':
         zoneName = "%s_%d" % (zoneType,ID)
         
     self.zoneType = zoneType
     self.zoneName = zoneName
     if varString == "":
         self.varsDict = {}
     else:
         self.varsDict = scmToDict(SchemeParser.parse(varString))
         if 'sources?' in self.varsDict and self.varsDict['sources?']:
             sourcekey = 'source-terms'
             if sourcekey not in self.varsDict:
                 sourcekey = 'sources'
             sourceVar = self.varsDict[sourcekey]
             self.varsDict['source-terms'] = scmToDict(sourceVar)
Beispiel #3
0
        def __init__(self, ID, zoneName, threadType, zoneType, varString):
            self.id = ID
            if zoneType == '':
                zoneType = getZoneType(threadType)

            if zoneName == '':
                zoneName = "%s_%d" % (zoneType, ID)

            self.zoneType = zoneType
            self.zoneName = zoneName
            if varString == "":
                self.varsDict = {}
            else:
                self.varsDict = scmToDict(SchemeParser.parse(varString))
                if 'sources?' in self.varsDict and self.varsDict['sources?']:
                    sourcekey = 'source-terms'
                    if sourcekey not in self.varsDict:
                        sourcekey = 'sources'
                    sourceVar = self.varsDict[sourcekey]
                    self.varsDict['source-terms'] = scmToDict(sourceVar)
Beispiel #4
0
    def read(self):
        print 'reading mesh'
        self.readMesh()
        varString = self.getVars()
        if varString == "":
            return
        vars = SchemeParser.parse(varString)
        self.varsDict = scmToDict(vars)
        if self.varsDict is None:
            raise TypeError("vars is not an association list")

        self.config = scmToDict(self.getVar('case-config'))
        self.materials = {}
        self.faceZones = {}
        self.cellZones = {}

        mDict = scmToDict(self.getVar('materials'))
        for n, d in mDict.iteritems():
            self.materials[n] = FluentCase.Material(materialType=scmToPy(d[0]),
                                                    props=scmToDict(d[1]))

        rFaceZones = self.getFaceZones()
        for i in rFaceZones.keys():
            rfz = rFaceZones[i]
            self.faceZones[i] = FluentCase.FluentZone(
                ID=rfz.ID,
                zoneName=rfz.zoneName,
                threadType=rfz.threadType,
                zoneType=rfz.zoneType,
                varString=rfz.zoneVars)
        rCellZones = self.getCellZones()
        for i in rCellZones.keys():
            rfz = rCellZones[i]
            self.cellZones[i] = FluentCase.FluentZone(
                ID=rfz.ID,
                zoneName=rfz.zoneName,
                threadType=rfz.threadType,
                zoneType=rfz.zoneType,
                varString=rfz.zoneVars)