コード例 #1
0
def calcPhaseFVF(qLiq,RTp,BoCon,xOil,clsBLK) :

    aOil = BC.Acoef(xOil,clsBLK)
    bOil = BC.Bcoef(xOil,clsBLK)
    cOil = BC.Ccoef(xOil,clsBLK)
    
    Moil = phaseMw(clsBLK.mSTG,clsBLK.mSTO,xOil)

    Aoil = aOil/(RTp*clsBLK.RT)
    Boil = bOil/ RTp

    Boi2 = Boil*Boil
    Boi3 = Boil*Boi2

    E2 = Boil - 1.0
    E1 = Aoil - 3.0*Boi2 -  2.0*Boil
    E0 = Boi3 +     Boi2 - Aoil*Boil

    nRoot,Zsmal,Zlarg = solveCubic(E2,E1,E0)    #-- Local copy of cubic-solver!!

    if qLiq : Voil = Zsmal*RTp - cOil
    else    : Voil = Zlarg*RTp - cOil

    Doil = Moil/Voil

    BoCal = BoCon/Doil

    return BoCal
コード例 #2
0
ファイル: blkProps.py プロジェクト: gmxavier/PVTfree
def calcPhaseFVF(qLiq, RTp, BoCon, xOil, clsBLK, clsIO):

    aOil = BC.Acoef(xOil, clsBLK, clsIO)
    bOil = BC.Bcoef(xOil, clsBLK, clsIO)
    cOil = BC.Ccoef(xOil, clsBLK, clsIO)

    Moil = phaseMw(clsBLK.mSTG, clsBLK.mSTO, xOil, clsIO)

    Aoil = aOil / (RTp * clsBLK.RT)
    Boil = bOil / RTp

    Boi2 = Boil * Boil
    Boi3 = Boil * Boi2

    E2 = Boil - 1.0
    E1 = Aoil - 3.0 * Boi2 - 2.0 * Boil
    E0 = Boi3 + Boi2 - Aoil * Boil

    nRoot, Zsmal, Zlarg = CE.solveCubic(E2, E1, E0)

    if qLiq: Voil = Zsmal * RTp - cOil
    else: Voil = Zlarg * RTp - cOil

    if clsIO.Deb["BLACK"] > 0:
        print(
            "nRoot,Zsmal,Zlarg,RTp,cOil,Voil {:1d} {:8.5f} {:8.5f} {:8.5f} {:8.5f} {:8.5f}"
            .format(nRoot, Zsmal, Zlarg, RTp, cOil, Voil))

    Doil = Moil / Voil

    BoCal = BoCon / Doil

    return BoCal
コード例 #3
0
ファイル: blkRegEOS.py プロジェクト: gmxavier/PVTfree
def calcJacEOSPhase(pObs,xOil,vOil,clsBLK,clsIO) :

    nSat = len(pObs)
    nEOS = clsBLK.nEOS

    RT   = clsBLK.RT

    jacO = NP.zeros((nEOS,nSat))

#== Loop over Saturated Stages ========================================

    for iSat in range(nSat) :

        aCof = BC.Acoef(xOil[iSat],clsBLK,clsIO)
        bCof = BC.Bcoef(xOil[iSat],clsBLK,clsIO)
        cCof = BC.Ccoef(xOil[iSat],clsBLK,clsIO)

        uCof = BC.Ucoef(vOil[iSat],bCof,cCof,clsIO)
        wCof = BC.Wcoef(vOil[iSat],bCof,cCof,clsIO)

        pCal = RT/uCof - aCof/wCof

        drda = -1.0/(     wCof*pObs[iSat])
        drdu = - RT/(uCof*uCof*pObs[iSat])
        drdw = aCof/(wCof*wCof*pObs[iSat])

        dudb = -1.0 ; dudc =  1.0

        dwdb = 2.0*(vOil[iSat] + cCof - bCof)
        dwdc = 2.0*(vOil[iSat] + cCof + bCof)

        drdb = drdu*dudb + drdw*dwdb
        drdc = drdu*dudc + drdw*dwdc

        dAdAo = BC.dAdAo(xOil[iSat],clsBLK,clsIO)
        dAdAg = BC.dAdAg(xOil[iSat],clsBLK,clsIO)
        
        dBdBo = BC.dBdBo(xOil[iSat],clsBLK,clsIO)
        dBdBg = BC.dBdBg(xOil[iSat],clsBLK,clsIO)

        dCdSo = BC.dCdSo(xOil[iSat],clsBLK,clsIO)
        dCdSg = BC.dCdSg(xOil[iSat],clsBLK,clsIO)

        drdAo = drda*dAdAo ; drdAg = drda*dAdAg
        drdBo = drdb*dBdBo ; drdBg = drdb*dBdBg
        drdSo = drdc*dCdSo ; drdSg = drdc*dCdSg

        jacO[0][iSat] = drdAo ; jacO[3][iSat] = drdAg
        jacO[1][iSat] = drdBo ; jacO[4][iSat] = drdBg
        jacO[2][iSat] = drdSo ; jacO[5][iSat] = drdSg

        #print("iS,j1,j2,j3,j4,j5,j6 {:3d} {:10.3e} {:10.3e} {:10.3e} {:10.3e} {:10.3e} {:10.3e}".format(iSat,drdAo,drdBo,drdSo,drdAg,drdBg,drdSg))

    return jacO
コード例 #4
0
def convPressure(dTab, clsBLK, clsIO):

    cCon = clsBLK.Co
    dSTO = clsBLK.dSTO
    dSTG = clsBLK.dSTG
    mSTO = clsBLK.mSTO
    mSTG = clsBLK.mSTG
    slop = clsBLK.BoS
    intr = clsBLK.BoI
    Psat = clsBLK.Psat

    RsSat = dTab[0][clsBLK.iRs]
    RvSat = dTab[0][clsBLK.iRv]

    KoSat = (RsSat + cCon) / (1.0 / RvSat + cCon)  #-- Singh Eqn.(3)

    KgSat = KoSat / (RsSat * RvSat)  #-- Singh Eqn.(4)

    RsPK = -cCon * log(KoSat) / log(KgSat)  #-- Singh Eqn.(B1)
    BoPK = slop * RsPK + intr  #-- Bo vs Rs at Conv Pres

    DoPK = BP.denOil(dSTO, dSTG, RsPK, BoPK, clsIO)
    xOPK = cCon / (cCon + RsPK)
    MoPK = BP.phaseMw(mSTG, mSTO, xOPK, clsIO)
    VoPK = MoPK / DoPK

    aCPK = BC.Acoef(xOPK, clsBLK, clsIO)
    bCPK = BC.Bcoef(xOPK, clsBLK, clsIO)
    cCPK = BC.Ccoef(xOPK, clsBLK, clsIO)

    uCPK = BC.Ucoef(VoPK, bCPK, cCPK, clsIO)
    wCPK = BC.Wcoef(VoPK, bCPK, cCPK, clsIO)

    pCon = clsBLK.RT / uCPK - aCPK / wCPK

    #== Return Convergence Pressure =======================================

    #print("convPressure: pCon {:10.3f}".format(pCon))

    return pCon
コード例 #5
0
ファイル: blkRegEOS.py プロジェクト: SteveFurnival/PVTfree
def calcResEOSPhase(pObs, xOil, vOil, clsBLK, clsIO):

    if clsIO.Deb["BLACK"] > 0: qDeb = True
    else: qDeb = False

    nSat = len(pObs)
    RT = clsBLK.RT

    resP = NP.zeros(nSat)
    ssQ = 0.0

    #print("calcResEOSPhase: aO,bO,sO,aG,bG,sG {:10.3f} {:10.5f} {:10.5f} {:10.3f} {:10.5f} {:10.5f}".format(clsBLK.EOS1["aOil"],clsBLK.EOS1["bOil"],clsBLK.EOS1["sOil"],clsBLK.EOS1["aGas"],clsBLK.EOS1["bGas"],clsBLK.EOS1["sGas"]))

    for iSat in range(nSat):

        aCof = BC.Acoef(xOil[iSat], clsBLK)
        bCof = BC.Bcoef(xOil[iSat], clsBLK)
        cCof = BC.Ccoef(xOil[iSat], clsBLK)

        uCof = BC.Ucoef(vOil[iSat], bCof, cCof)
        wCof = BC.Wcoef(vOil[iSat], bCof, cCof)

        pCal = RT / uCof - aCof / wCof

        resP[iSat] = (pCal - pObs[iSat]) / pObs[iSat]

        if qDeb > 0:
            print("iS,pO,pC,rP {:2d} {:10.3e} {:10.3e} {:10.3e}".format(
                iSat, pObs[iSat], pCal, resP[iSat]))

        ssQ = ssQ + resP[iSat] * resP[iSat]

#== Return SSQ and Residuals ==========================================

    ssQ = 0.5 * ssQ

    #print("ssQ {:10.3e}".format(ssQ))

    return ssQ, resP