def Call_Calc_ChemPot( MFrac ):      # This function will calculate the ChemPotential, the input is MolFraction
    for iphase in range(ThT.NPhase): # Loop for Phases
        node_init = iphase * ThT.NComp ; node_final = iphase * ThT.NComp + ThT.NComp 
                                     # For phase 0, 1st component : node_init = 0 & node_final = 0 * 1 + 1 = 1
                                     # For phase 1, 2nd component : node_init = 2 & node_final = 1 * 2 + 2 = 4 
        ChemPot = [0. for z in range(ThT.NComp * ThT.NPhase) ] # Creating a temporary array ChemPot

        print MFrac[ node_init:node_final ], node_init, node_final
        ChemPot[ node_init:node_final ] = chemp.Calc_ChemPot( iphase, MFrac[ node_init : node_final ] )
        # ChemPot[ 0 : 1 ] = chemp.Calc_ChemPot( iphase, MFrac[ 0 : 1 ] ) 
    # End Loop for Phases
    return ChemPot
Exemple #2
0
def Call_Calc_ChemPot(MFrac):  # This function will ...

    for iphase in range(ThT.NPhase):  # Loop for Phases
        node_init = iphase * ThT.NComp
        node_final = iphase * ThT.NComp + ThT.NComp
        ChemPot = [0. for z in range(ThT.NComp * ThT.NPhase)
                   ]  # Creating a temporary array ChemPot

        #print MFrac[ node_init:node_final ], node_init, node_final
        ChemPot[node_init:node_final] = chemp.Calc_ChemPot(
            iphase, MFrac[node_init:node_final])

        # End Loop for Phases
        ''' NOT SURE WHY O YOU NEED i AND j here ... BOTH CONDITIONALS DO THE SAME THING
                if i == j: # What am I doing here ...  What is the diff here in this conditional ???
                    print MFrac[ node_init:node_final ], node_init, node_final
                    ChemPot[ node_init:node_final ] = chemp.Calc_ChemPot( iphase, MFrac[ node_init : node_final ] )
                else:
                    print '  i am in the else case ' #' for the component ', ThT.Species[i],' with respect to' , ThT.Species[j]
                    ChemPot[ node_init:node_final ] = chemp.Calc_ChemPot( iphase, MFrac[ node_init : node_final ] )
                # end of the  i=j conditional representing ... '''

    return ChemPot
            chempot = [0. for i in range(ThT.NComp**2)]
            for i in range(ThT.NComp):
                for j in range(ThT.NComp):
                    node = i * ThT.NComp + j
                    node_init = iphase * ThT.NComp
                    node_final = iphase * ThT.NComp + ThT.NComp
                    #print ' you are at the node ', node_init , node_final
                    ChemPot = [
                        0. for z in range(ThT.NComp * ThT.NPhase)
                    ]  # Set up an array of chemical potential for each component at each phase (dimension NComp * NPhase )
                    #print ' ChemPot = ', ChemPot
                    if i == j:
                        print '  for the component ', ThT.Species[i]
                        print MFrac[
                            node_init:node_final], node_init, node_final
                        ChemPot[node_init:node_final] = chemp.Calc_ChemPot(
                            iphase, MFrac[node_init:node_final])
                    else:
                        print '  i am in the else case '  #' for the component ', ThT.Species[i],' with respect to' , ThT.Species[j]
                        ChemPot[node_init:node_final] = chemp.Calc_ChemPot(
                            iphase, MFrac[node_init:node_final])
                    print
                    time.sleep(0)
    """ Calculating Gibbs molar """
    PhaseFrac = [0. for i in range(ThT.NPhase)]
    PhaseFrac[0] = 0.35
    PhaseFrac[1] = 1. - PhaseFrac[0]
    sumGibbs = 0.
    sumfeed = 0.

    for icomp in range(ThT.NComp):
        Vphase = 0
Exemple #4
0
                i]  # overall feed mass fraction of the component
            print ''

            node_init = iphase * ThT.NComp
            node_final = iphase * ThT.NComp + ThT.NComp
            #print node_init , node_final
            ChemPot = [
                0. for i in range(ThT.NComp * ThT.NPhase)
            ]  # Set up an array of chemical potential for each component at each phase (dimension NComp * NPhase )

            if i == j:
                print '  for the component ', ThT.Species[i]
                #for iphase in range( ThT.NPhase ):
                print MFrac[node_init:node_final], node_init, node_final
                ChemPot[node_init:node_final] = chemp.Calc_ChemPot(
                    iphase, MFrac[node_init:node_final]
                )  # This function will return the chemical potential of phase IPhase
                print ' the ChemPot = ', ChemPot[
                    node_init:
                    node_final]  # components and then it can be be operated to obtain the molar Gibbs energy.
                print
            else:  # this is for the rest of the elements of the square matrix of the aij
                print '  for the component ', ThT.Species[
                    i], ' with respect to', ThT.Species[j]
                print
            print
            time.sleep(0)
'''
def Calc_ChemPot( iphase, MFrac ):
    sz = np.shape(MFrac)[0]
    print ' now i am in the chempot function '