Ejemplo n.º 1
0
    def __init__(self, dens, temps, energies, getOpac):
        self.dens = dens
        self.temps = temps
        self.energies = energies
        self.argGetOpac = getOpac

        def getDensTemp(n):
            jt = n % len(self.temps)
            jd = n / len(self.temps)
            return self.dens[jd], self.temps[jt]
    
        def getListOpac(n):
            jt = n % len(self.temps)
            jd = n / len(self.temps)
            return self.go(jd,jt)

        OplList.__init__(self,
                         len(self.dens)*len(self.temps), 
                         getDensTemp,
                         lambda n: self.energies,
                         getListOpac)
Ejemplo n.º 2
0
    def __init__(self, dens, temps, energies, getOpac):
        """
        temps -> numpy array of temperatures [eV]

        dens -> list of numpy arrays. len(dens) = len(temps. dens[n]
        stores a sorted list of all of the densities [g/cc]
        corresponding to temperature temps[n]
        
        energies -> [eV] energy group structure
        """
        self.dens = dens
        self.temps = temps
        self.energies = energies
        self.go = getOpac

        def map(n):
            count = 0
            for jt in xrange(len(self.temps)):
                for jd in xrange(len(self.dens[jt])):
                    if count == n:
                        return jd, jt
                    count += 1
            raise ValueError("Bad mapping")

        def getDensTemp(n):
            jd, jt = map(n)
            return self.dens[jt][jd], self.temps[jt]
    
        def getListOpac(n):
            jd, jt = map(n)
            return self.go(jd,jt)

        nopac = 0
        for jt in xrange(len(self.temps)):
            nopac += len(self.dens[jt])

        OplList.__init__(self, nopac,
                         getDensTemp,
                         lambda n: self.energies,
                         getListOpac)
Ejemplo n.º 3
0
    def __init__(self, dens, temps, energies, getOpac):
        """
        temps -> numpy array of temperatures [eV]

        dens -> list of numpy arrays. len(dens) = len(temps. dens[n]
        stores a sorted list of all of the densities [g/cc]
        corresponding to temperature temps[n]
        
        energies -> [eV] energy group structure
        """
        self.dens = dens
        self.temps = temps
        self.energies = energies
        self.go = getOpac

        def map(n):
            count = 0
            for jt in xrange(len(self.temps)):
                for jd in xrange(len(self.dens[jt])):
                    if count == n:
                        return jd, jt
                    count += 1
            raise ValueError("Bad mapping")

        def getDensTemp(n):
            jd, jt = map(n)
            return self.dens[jt][jd], self.temps[jt]

        def getListOpac(n):
            jd, jt = map(n)
            return self.go(jd, jt)

        nopac = 0
        for jt in xrange(len(self.temps)):
            nopac += len(self.dens[jt])

        OplList.__init__(self, nopac, getDensTemp, lambda n: self.energies, getListOpac)
Ejemplo n.º 4
0
def avgOplList(opllist, ebds, weight="constant", bound="error"):

    getEnergies = lambda n: ebds

    def getOpac(n):
        rho_n, trad_n = opllist.getDensTemp(n)

        return avgopac(opllist.getEnergies(n), 
                       opllist.getOpac(n),
                       trad_n, 
                       ebds, 
                       weight=weight,
                       bound=bound)

    return OplList(opllist.nopacs, opllist.getDensTemp, getEnergies, getOpac)
Ejemplo n.º 5
0
 def oplListScat(self):
     return OplList(self.nopacs, lambda n:
                    (self.opacs[n].rho, self.opacs[n].tele),
                    lambda n: self.opacs[n].energies,
                    lambda n: self.opacs[n].opac3)
Ejemplo n.º 6
0
 def oplRosseland(self):
     return OplList(len(self.dens), 
                    lambda n: (self.dens[n], self.temps[n]), 
                    lambda n: self.energies,
                    lambda n: self.rosseland[n])
Ejemplo n.º 7
0
 def oplPlanck(self):
     return OplList(len(self.dens), 
                    lambda n: (self.dens[n], self.temps[n]), 
                    lambda n: self.energies,
                    lambda n: self.planck[n])
Ejemplo n.º 8
0
 def oplAbsorb(self):
     return OplList(
         len(self.opacs), lambda n: (self.opacs[n].rho, self.opacs[n].tele),
         lambda n: self.opacs[n].energies, lambda n: self.opacs[
             n].opac_bb + self.opacs[n].opac_bf + self.opacs[n].opac_ff)
Ejemplo n.º 9
0
 def oplScat(self):
     return OplList(len(self.opacs), lambda n:
                    (self.opacs[n].rho, self.opacs[n].tele),
                    lambda n: self.opacs[n].energies,
                    lambda n: self.opacs[n].opac_scat)
Ejemplo n.º 10
0
 def oplTotal(self):
     return OplList(len(self.opacs), lambda n:
                    (self.opacs[n].rho, self.opacs[n].tele),
                    lambda n: self.opacs[n].energies,
                    lambda n: self.opacs[n].opac_tot)