Beispiel #1
0
def getExample1Data(conditionData, conditions, shockTubeEffectiveHeatingTimes, smilesInExperiments):
    """
    Parses the simulation's data to make generic data objects to compare with shock tube data taken from figure 1 of
    #Y. Hiadka, K. Sato, H. Hoshikawa, T. Nishimori, H. Tanaka, K. Inami, N. Ito. Combust. Flame, 120 3 (2000), pp. 245-264
    """
    #First get the time points close to
    allResults=[]
    for T, timepoint in shockTubeEffectiveHeatingTimes.iteritems():
        for smiles in smilesInExperiments:
            temperatureResults=GenericData(label=label='Temperature',
                                      data = []
                                      units = 'K')
            for conIndex, data in conditionData:
                if conditions[conIndex].T0==T:
                    #index1 is the index of time from the simulation closest to timepoint
                    #data is organized as (timeArray, rest of data)
                    index1=findNearest(data[0], timepoint)
                    for speciesData in data[1]:
                        if smiles==speciesData.species:

                    if smiles not in exptCompDict1: exptCompDict1[smiles]=[]
                    #need to multiply by 20, in the experiment, they don't seem to count the Ar in the mole fraction
                    exptCompDict1[smiles].append(resultsDictionary[T][1][index1][index2+1]*20)
                (index1, timepoint2)=rt.getNearestTime(timepoint1, resultsDictionary[T][2])
                for index2, smiles in enumerate(majorSpecies[0:4]):
                    if smiles not in exptCompDict2: exptCompDict2[smiles]=[]
                    exptCompDict2[smiles].append(resultsDictionary[T][3][index1][index2+1]*20)
Beispiel #2
0
    # Plot the results if matplotlib is installed.
    # See http://ma tplotlib.org/ to get it.
if '--plot' in sys.argv[1:]:
    import matplotlib.pyplot as plt
    #first test
    # plt.semilogy(times1, data1[:,1], 'r', label="sim1")
    # plt.semilogy(times2, data2[:,1], label='sim2')
    # plt.legend()
    # plt.show()

    exptCompDict1={}
    exptCompDict2={}

    #Plot vs experiment
    for T, timepoint1 in shockTubeEffectiveHeatingTimes.iteritems():
        (index1,timepoint2)=rt.getNearestTime(timepoint1, resultsDictionary[T][0])
        for index2, smiles in enumerate(majorSpecies[0:4]):
            if smiles not in exptCompDict1: exptCompDict1[smiles]=[]
            #need to multiply by 20, in the experiment, they don't seem to count the Ar in the mole fraction
            exptCompDict1[smiles].append(resultsDictionary[T][1][index1][index2+1]*20)
        (index1, timepoint2)=rt.getNearestTime(timepoint1, resultsDictionary[T][2])
        for index2, smiles in enumerate(majorSpecies[0:4]):
            if smiles not in exptCompDict2: exptCompDict2[smiles]=[]
            exptCompDict2[smiles].append(resultsDictionary[T][3][index1][index2+1]*20)

    x=1

    plt.clf()
    plt.subplot(2, 2, 1)
    plt.plot(C2H6molfrac.keys(), C2H6molfrac.values(), 'o', label="Expt")
    plt.plot(shockTubeEffectiveHeatingTimes.keys(),exptCompDict1['CC'], 'r', label='Trusted')