Ejemplo n.º 1
0
    Chart.ylabel("RMS Error")
    Chart("set logscale y")
    Chart.title("3 Restarts, 10 Iterations each")

    histories = [1000, 5000, 10000, 50000, 100000]
    bins = 50
    halfwidth = 0.5
    iterations = 3
    restarts = 10

    geo = Geometry.Geometry(bins, [[0, 2*halfwidth]])
    xs = CrossSection.CrossSection(xS=0.5, nu=1.0, xF=0.5, xG=0)
    uSource = fissionSource.histogramSource(scipy.ones(bins), geo)
     
    # Deterministic
    sn3 = procOUTSN.procOutsn(sys.argv[1])
    csHeight, csCenters = sn3.coursenSNFS(geo)

    snSource = fissionSource.histogramSource(csHeight, geo)
    gnuData = {}
    for h in histories:
        print "\nHistories %i" %h
        amc = arnoldiMC.arnoldiMC(geo, xs, h, storeVectors=True)
#       Values, Vectors = amc.arnoldi(uSource, iterations)
        Values, Vectors = amc.ERAM(uSource, restarts, iterations)
#       Values, Vectors = amc.ERAM(snSource, restarts, iterations)
        
        vAMprime = []
        for i in xrange(1, len(amc.vectorStorage)+1):
            vAMprime.append(scipy.stats.mean(amc.vectorStorage[:i]))
        vAM = [abs(v)/sum(abs(v)) for v in vAMprime]
Ejemplo n.º 2
0
elif options.source == 'pright':
    s = scipy.zeros(options.bins)
    s[-1] = 1
elif options.source == 'pcenter':
    mid = int(options.bins/2.0)
    s = scipy.zeros(options.bins)
    s[mid] = 1
else:
    s = eval(options.source)

try:
    source = fissionSource.histogramSource(s, geo)
except:
    raise ValueError, "Unsupported source distribution: %s" %options.source

for key in options.__dict__:
    print "%10s: %s" %(key, options.__dict__[key])

print "source %s" %source

if options.run:
    # SN3
    sn3 = procOUTSN.procOutsn("LarsenComparison/HW%.0f.0.OUTSN" %(options.width/2))
    csHeight, csCenters = sn3.coursenSNFS(geo)

    amc = arnoldiMC.arnoldiMC(geo, xs, options.H, verbose=options.verbose, 
            storeVectors=True)
    Values, Vectors = amc.arnoldi(source, options.I)

    Movie()
Ejemplo n.º 3
0
    uSource = fissionSource.histogramSource(scipy.ones(bins), geo)
    amc = arnoldiMC.arnoldiMC(geo, xs, histories, storeVectors=True)
    Values, Vectors = amc.ERAM(uSource, restarts, iterations)
    meanVector = scipy.stats.mean(amc.vectorStorage)

    vAM = abs(meanVector)/sum(abs(meanVector))
    vData = Gnuplot.Data(amc.geo.centers, vAM, with='histeps', 
            title='Arnoldi')
    v1Vect = abs(Vectors[:,-1])/sum(abs(Vectors[:,-1]))
    v1Data = Gnuplot.Data(amc.geo.centers, v1Vect, with='histeps',
            title = '1st Vector')
#   Chart.replot(vData)
    gnuData['meanV1'] = (amc.geo.centers, vAM)
     
    # Deterministic
    sn3 = procOUTSN.procOutsn("LarsenComparison/HW%.1f.OUTSN" %halfwidth)
    csHeight, csCenters = sn3.coursenSNFS(geo)
    snData = Gnuplot.Data(csCenters, csHeight, with='histeps',
            title='SN3')
#   Chart.replot(snData)
    gnuData['SN'] = (csCenters, csHeight)

    for i in xrange(3):
        gplotData = Gnuplot.Data(amc.geo.centers, Vectors[:,-(i+1)],
                with='histeps', title='Vector%i' %i)
        Chart.replot(gplotData)
        gnuData['Vector%i' %i] = (amc.geo.centers, Vectors[:,-(i+1)])

    gnuFile = gnuplotFile.gnuplotFile(sys.argv[1], gnuData)

Ejemplo n.º 4
0
    mid = int(options.bins / 2.0)
    s = scipy.zeros(options.bins)
    s[mid] = 1
else:
    s = eval(options.source)

try:
    source = fissionSource.histogramSource(s, geo)
except:
    raise ValueError, "Unsupported source distribution: %s" % options.source

for key in options.__dict__:
    print "%10s: %s" % (key, options.__dict__[key])

print "source %s" % source

if options.run:
    # SN3
    sn3 = procOUTSN.procOutsn("LarsenComparison/HW%.0f.0.OUTSN" %
                              (options.width / 2))
    csHeight, csCenters = sn3.coursenSNFS(geo)

    amc = arnoldiMC.arnoldiMC(geo,
                              xs,
                              options.H,
                              verbose=options.verbose,
                              storeVectors=True)
    Values, Vectors = amc.arnoldi(source, options.I)

    Movie()