Menu

Retrieving Volumetric Fraction

2019-09-10
2019-09-12
  • Luca Finardi

    Luca Finardi - 2019-09-10

    Hello Daniel,

    in the attached flowsheet the feed is 100 m3/h water at 5.75 % vol Ethanol, corresponding approx to 4.57 % mass fraction.
    If I run the script after model run, I get both Ethanol volumetric fraction and volumetric flow 0.0 in all streams.

    What am I doing wrong?

    Thanks for the help.

    Luca

     
  • Daniel Medeiros

    Daniel Medeiros - 2019-09-10

    I think that the volumetric flow property is only calculated for phases, not for the overall mixture... try getting properties from the LIquid1 phase instead.

     
  • Luca Finardi

    Luca Finardi - 2019-09-11

    Thanks Daniel, I tried this but it still did not work

    ms11 = Flowsheet.GetFlowsheetSimulationObject('MSTR-001')
    ph = 'Liquid1'
    Overall = ms11.GetPhase(ph)
    EtOH = ms11.GetPhase(ph).Compounds['Ethanol']
    F = Overall.Properties.volumetric_flow * 3600.   # m3/h total
    f_E = EtOH.VolumetricFlow * 3600.                # m3/h EtOH
    x_E = EtOH.VolumetricFraction                    # % vol EtOH
    
    print F, f_E, x_E
    

    How can I retrieve the pure Ethanol liquid density (at T&P) in order to calculate the % vol from the % weight?

    Thanks
    Luca

     
  • Daniel Medeiros

    Daniel Medeiros - 2019-09-11

    The following uses the rigorous definition for the calculation of partial molar volumes. I've probably implemented it only for PR and SRK property packages... can you create a ticket so I can implement it on the next update? Thanks!

    import System
    from System import *
    import clr
    from DWSIM import *
    
    ms11 = Flowsheet.GetFlowsheetSimulationObject('MSTR-001')
    ph = 'Overall'
    Overall = ms11.GetPhase(ph)
    
    V = Overall.Properties.massflow / Overall.Properties.density # m3
    
    ne_0 = Overall.Compounds['Ethanol'].MolarFlow
    nw_0 = Overall.Compounds['Water'].MolarFlow
    
    n_0 = Overall.Properties.molarflow
    
    msc = ms11.Clone()
    
    print V, ne_0, nw_0, n_0
    
    ne_1 = ne_0 + 1
    nw_1 = nw_0
    
    n_1 = ne_1 + nw_1 # mol
    
    xe_1 = ne_1 / n_1 # molfrac
    xw_1 = nw_1 / n_1 # molfrac
    
    print xw_1, xe_1
    
    msc.SetOverallComposition(Array[Double]([xw_1, xe_1]))
    msc.GetPhase(ph).Properties.massflow = None
    msc.GetPhase(ph).Properties.volumetric_flow = None
    msc.GetPhase(ph).Properties.molarflow = n_1
    
    msc.Calculate()
    
    Overall = msc.GetPhase(ph)
    
    V1 = Overall.Properties.massflow / Overall.Properties.density # m3
    
    # partial molar volume for ethanol
    pmv_e = (V1 - V)/(ne_1 - ne_0) # m3/mol
    
    # molar volume for ethanol
    mv_e = xe_1 * pmv_e # m3 EtOH
    
    # volumetric fraction ethanol
    xv_e = mv_e / V1
    xv_w = 1 - xv_e
    
    print("xv_w = " + str(xv_w) + ", xv_e = " + str(xv_e))
    
     

    Last edit: Daniel Medeiros 2019-09-11
  • Luca Finardi

    Luca Finardi - 2019-09-12

    Thanks Daniel for this good suggestion.
    I have only a doubt: I think that the last part of your calc shoud be:

    # molar volume for ethanol in the original stream
    mv_e = ne_0 * pmv_e # m3 EtOH
    
    # volumetric fraction ethanol in the original stream
    xv_e = mv_e / V
    xv_w = 1 - xv_e
    
    print("xv_w = " + str(xv_w) + ", xv_e = " + str(xv_e))
    

    do you agree?

    I hand back-calculated the vol fractions between 2 known EtOH % vol and solution densities (i.e 5.75 %vol density 990.1 and 6.5 % vol density 989.1) and found an error 7.5%.
    May be this deviation is due to volume contraction of the Aq-EtOH mixtures.

    I will open the ticket as you mentioned.

    Thanks.

    Luca

     
    • Daniel Medeiros

      Daniel Medeiros - 2019-09-12

      You're right. The second stream (cloned) is used only to calculate pmv_e, all the other properties should be taken from the original stream.

      The deviation is indeed due to mixing effects, and will vary according to the method you've used to calculate mixture density.

      Thanks for the ticket!
      Daniel

       
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.