Пример #1
0
     label='electron temperature/ heavy temperature)')
legend()

G = mgrid[amin(x[0]):amax(x[0]):200j, amin(x[1]):amax(x[1]):200j]
R = sum(G**2, axis=0)**.5

T = Rbf(x[0], x[1], Tbar, function='cubic')(G[0], G[1])
T[R > amax(r)] = mean(Tbar[r == amax(r)])
U = Rbf(x[0], x[1], Ubar, function='cubic')(G[0], G[1])
U[R > amax(r)] = mean(Ubar[r == amax(r)])
Te = Rbf(x[0], x[1], Tbar * thetaBar, function='cubic')(G[0], G[1])
Te[R > amax(r)] = mean((Tbar * thetaBar)[r == amax(r)])

eps = 1e-3
dT = (gradient(T)[0]**2 + gradient(T)[1]**2)**.5
dT[R > (amax(r) - eps)] = 0
dU = (gradient(U)[0]**2 + gradient(U)[1]**2)**.5
dU[R > (amax(r) - eps)] = 0

figure()
contourf(dT, 30, cmap=cm.copper)
colorbar()
contour(dU, 10, cmap=cm.cool)
colorbar()

mlm.surf3(G[0], G[1], U, f=mlm.fig('axial velocity'))
mlm.surf3(G[0], G[1], T, f=mlm.fig('temperature'))
mlm.surf3(G[0], G[1], Te, f=mlm.fig('electron temperature'))

show()
Пример #2
0
    else:
        with open(os.path.join(dirname,
                               os.path.split(dirname)[1] + '.pkl'), 'rb') as f:
            z, r, t, X = pkl.load(f)

    if dumpMean:
        n = (300, 200)
        nCut = (60, 40)
        Y = mean(X, axis=0)
        Yreg = zeros((Y.shape[0], ) + n)
        for i in range(Yreg.shape[0]):
            zReg, rReg, Yreg[i] = regularize2d(z, r, Y[i], n, nCut)
            if i < 3:
                mlm.surf3(x=zReg,
                          y=rReg,
                          z=Yreg[i],
                          axeLab=['axial, cm', 'radial, cm', labs[i]],
                          f=mlm.fig(labs[i]))
        dumplist = [Yreg[i] for i in range(5)] + [Yreg[5] + Yreg[6]]
        with open('e:\\labcode\\pyrticle\\lavaJet.pkl', 'wb') as f:
            pkl.dump(
                dict(
                    zip(['radialCoord', 'axialCoord'] + labs[:5] + ['airMols'],
                        [cookDist(rReg), cookDist(zReg)] + dumplist)), f, -1)

    Tcl = ndimage.gaussian_filter(squeeze(X[:, 0, :, 0, ...]), 1)
    Vcl = ndimage.gaussian_filter(squeeze(X[:, 1, :, 0, ...]), 1)
    #
    #    ONratio =squeeze(X[:, 6,...]/X[:,5,...])
    #    ONratio[logical_or(isinf(ONratio), isnan(ONratio))] = .25
    #    ONratio[ONratio>.5] = .5
ylab('final vertical location, m')
tit('Spread of Trajectories for Different Size Particles\ndiameters in microns '
    )
legend()
sf('proposal_spreadFig1')

figure(3)
axisFontSize()
xlab('final vertical location, m')
ylab('probability density')
tit('Posterior Distributions of Final Locations \nfor Particles of Increasing Diameter'
    )
legend(loc='upper left')
sf('proposal_spreadFig2')

fig(4)
contourf(G[1] * 1e6, G[0], mi, 30)
axisFontSize()
xlab('d, microns')
ylab('v0, m/s')
tit('ratio of final to initial mass')

mlm.surf3(G[1] * 1e6, G[0], T[..., -1], f=mlm.fig('final surface temperature'))

D = dict(zip(['v0', 'd', 'G', 'T'], [v0, d, G, T]))
f = open(
    'T_v0' + str(v0[0]) + '-' + str(v0[-1]) + '_d' + str(d[0] * 1e6) + '-' +
    str(d[-1] * 1e6) + '.pkl', 'wb')
pkl.dump(D, f, -1)
f.close()
Пример #4
0
    #    rReg = linspace(0, rMax, nr)
    #    zReg = linspace(0,zMax, nz)
    #    g = meshgrid(rReg, zReg)
    n = (300, 200)
    nCut = (60, 40)
    Treg = zeros((T.shape[0], ) + n)
    showAll = False
    for i in range(T.shape[0]):
        #Treg[i] = pol(array([0.,0.]),array([z[-1],r[-1]]), cookList[i](T[i]))(r_['0,3', g[1], g[0]])
        zReg, rReg, Treg[i] = regularize2d(z, r, cookList[i](T[i]), n, nCut)

        if showAll:
            #  mlm.surf3(x = z, y = r, z = T[i],axeLab = ['radial, cm','axial, cm',labs[i]], f = mlm.fig(labs[i]))
            mlm.surf3(x=zReg,
                      y=rReg,
                      z=Treg[i],
                      axeLab=['radial, cm', 'axial, cm', labs[i]],
                      f=mlm.fig(labs[i]),
                      clf=False)
        elif not showAll and i < 3:
            #   mlm.surf3(x = z, y = r, z = T[i],axeLab = ['radial, cm','axial, cm',labs[i]], f = mlm.fig(labs[i]))
            mlm.surf3(x=zReg,
                      y=rReg,
                      z=Treg[i],
                      axeLab=['radial, cm', 'axial, cm', labs[i]],
                      f=mlm.fig(labs[i]),
                      clf=False)

    cut = 6
    dumplist = [Treg[i] for i in range(5)] + [Treg[5] + Treg[6]]
    with open('e:\\labcode\\pyrticle\\lavaJet.pkl', 'wb') as f:
        pkl.dump(
Пример #5
0
    for j, P in ndenumerate(IS.FS.sensorOutput['particleImages']):
        Jin[j] = sum(P[0])
        JmaxIn[j] = np.max(P[0])

    #compute velocity proxy numerator
    vProxyIn = PE.diameter()**2 * PE.temperature()**2
    vProxyOut = IS.diameter()**2 * IS.temperature()**4
    ######################################################################

    #////////////////////////////     SUMMARY AND FRAME PLOTTING /////////////////////////////////////
    #    mlm.scat(r_['0,4,-1', squeeze(PE.temperature()), squeeze(1e6*PE.diameter()),squeeze(PE.lateralPosition())], axeLab = ['T', 'D', 'z'], f = mlm.fig('input mesh') )
    #    mlm.scat(r_['0,4,-1', squeeze(IS.temperature()), squeeze(1e6*IS.diameter()),squeeze(PE.lateralPosition())], axeLab = ['T', 'D', 'z'], f = mlm.fig('output mesh') )
    #    mlm.scat(r_['0,4,-1', squeeze(PE.temperature()), squeeze(1e6*PE.diameter()),squeeze(PE.lateralPosition()), 1e6*squeeze(IS.diameter()-PE.diameter())], axeLab = ['T', 'D', 'z'], f = mlm.fig('diameter error') )
    mlm.surf3(1e6 * PE.diameter()[:, 0, :, 0],
              PE.lateralPosition()[:, 0, :, 0],
              1e6 * (IS.diameter()[:, 0, :, 0] - PE.diameter()[:, 0, :, 0]),
              axeLab=['D', 'z', 'error'],
              f=mlm.fig('error in diameter'))

    #::::::::::::::::::::::::::::::::::::::   HISTOGRAMS ::::::::::::::::::::::::::::::::::

    ############ TEMP, DIAMETER#######################
    figure(figsize=(20, 20))
    subplot(1, 2, 1)
    #temprature
    #vvvvvvvvvvvvvvvvvvvvvv
    inHist(IS.temperature().ravel() - PE.temperature().ravel())
    #^^^^^^^^^^^^^^^^^^^
    xlab('error in temperature, K')
    legend()
    axisFontSize()
Пример #6
0
    def summary(self, plotOn=True):
        """
        make a bunch of surface plots if appropriate, and display 
        ensemble statistics
        """
        pv = self.parameterVectors
        pk = self.modelArray.flatten()[0].parameterKeys()
        if self.modelArray.ndim == 2:
            #assume we meshed outer diameter and injection velocity
            g = r_['0,3',
                   squeeze(1e6 *
                           pv[..., nonzero(pk == 'outerDiameter')[0]]),
                   squeeze(-pv[..., nonzero(pk == 'injVelY')[0]])]
            axlab = ['diameter, microns', 'injection velocity, m/s']

            arrs = [
                'surfaceTemperature',
                'centerTemperature',
                'meanTemperature',
                'volumeFraction',
                'diameterFraction',
                'finalVelocity',
                'enthalpy',
                'surfaceEnthalpy',
                'moltenFraction',
                'moltenVolume',
                'momentum',
                'verticalPosition',
                'axialPosition',
            ]

            units = [
                'K', 'K', 'K', '', '', 'm/s', r'$\mu$J', 'J/kg', '',
                r'$\mu$$m^3$', 'mg m/s', 'mm', 'mm'
            ]
            A = zeros((len(arrs), ) + self.modelArray.shape)

            for i, M in ndenumerate(self.modelArray):

                A[3][i] = sum(M.PS.p.mesh.nodeVolume) / sum(
                    M.PS.p.meshHistory[0].nodeVolume)
                A[4][i] = M.PS.p.diameter() / (2 *
                                               M.PS.p.meshHistory[0].xInt[-1])
                A[1][i] = copy(M.PS.p.T[0])
                A[2][i] = sum(M.PS.p.mesh.nodeVolume * M.PS.p.T /
                              sum(M.PS.p.mesh.nodeVolume))
                A[0][i] = copy(M.PS.p.surfaceTemperature)
                A[8][i] = M.PS.p.moltenFraction()
                A[9][i] = M.PS.p.moltenVolume() * 1e18
                A[6][i] = sum(M.PS.p.enthalpy() * M.PS.p.mass * 1e6)
                A[7][i] = M.PS.p.enthalpy()[-1]
                A[5][i] = sqrt(sum(M.PS.p.velocity()**2))
                A[10][i] = A[5][i] * M.PS.p.totalMass * 1e6
                A[11][i] = M.PS.p.verticalPosition() * 1e3
                A[12][i] = M.PS.p.axialPosition() * 1e3
                A[12][i] = M.PS.p.axialPosition() * 1e3

            A[2][logical_or(isinf(A[2]), isnan(A[2]))] = 0

            if plotOn:
                F = [mlm.fig(a) for a in arrs]
                for i in range(len(arrs)):
                    try:
                        mlm.surf3(g[0],
                                  g[1],
                                  A[i],
                                  axeLab=axlab + [arrs[i] + ', ' + units[i]],
                                  f=F[i])
                    except ValueError:
                        print 'nans! check ' + arrs[i]

            return dict(
                zip(['diameter', 'injectionVelocity'] + arrs + ['units'],
                    [g[0], g[1]] + [A[i] for i in range(A.shape[0])] +
                    [dict(zip(arrs, units))]))