
SMART〜Key Analytical Differentiation Issues Hidden in the Black Oil Simulation
ブラック・オイル・シュミレーションの開発に於いて最もTime Consumingな作業は解析微分を求めることであろう。要は淡々と偏微分を算出すれば良いだけであるが実際Hidden Issueが多々ある。今回紹介する論点はSPE Comparison Project課題を用いて演算パフォーマンスの検証過程で収束性に疑念を抱きその解決に悩んだ代表的なIssueである。その具体的事例を解決策を含めてご紹介しよう。The most time consuming task in the development of the black oil simulation is the derivation of the analytical derivative. In short, all that is required is to generate the partial derivatives in a straightforward manner, but in reality there are many hidden problems associated with this derivation. The problem presented here is a typical one, difficult to solve, where convergence has been questioned in the course of verifying computational performance using the SPE Comparative Solution Project. I wish to present some specific examples of these problems together with their solutions.
Partial Derivative w.r.t Grid Pressure
ブラック・オイル・シミュレーションに於いて油層の求めるべき独立変数としてグリッド圧力(Px)、水飽和率(Sw)、ガス飽和率(Sg)及び溶解ガス油比(Rs)を適用するのが一般的であるが、IMEXに代表されるようにRsの代わりに飽和圧力(Pb)を用いる場合もある。前者の方が独立変数の更新手続きに多少Taskが増加するが、Logic的に大きな差異はない。しかしながら、前者の手法の方がMass Accumulation Term、Flow Term、Source Termから構成される残差方程式の偏微分が数学的に洗練された方程式を構成する優位性がある。このことからIn-houseの高性能Simulator SMARTでは前者の独立変数を採択している一方、PrimitiveなiSMARTでは後者の手法を適用している。
通常、残差方程式のMass Accumulation Termに於けるグリッド圧力による偏微分はFree Gasが存在する条件下次式で表される。
dmFo(IOIL) = dmFodPx
しかしながら、Free Gasが存在する場合(以下、YFG)、必ずしもOilのRs valueがSaturated Rs valueより大きいとは限らないので、Free Gasが存在するGridに於いては、本来のFree Oilに於ける圧力による微分要素に加えてRsによる溶解ガスの微分要素も加味するべきである。この考えに至る迄二ヶ月ほど考え込んだ苦い記憶がある。以下の処理コードを追加することで、微分値の精度を補正、高めることができる。Flow Termについても同様の処理をしている。
if (YFG) then !YFG (Yes Free Gas)
if (RSK_i.ge.RSAK_i) then; dRsdPx = ZRSAZPXK_i
else; dRsdPx = 0.0
endif
dmFo(IOIL) = dmFodPx + dmFodRs *dRsdPx
dmFo(IGAS) = dmFodSg
dmFo(IWAT) = dmFodSw
dmDg(IOIL) = dmDgdPx + dmDgdRs *dRsdPx
dmDg(IGAS) = dmDgdSg
dmDg(IWAT) = dmDgdSw
else !NFG (No Free Gas)
dmFo(IOIL) = dmFodPx
dmFo(IGAS) = dmFodRs
dmFo(IWAT) = dmFodSw
dmDg(IOIL) = dmDgdPx
dmDg(IGAS) = dmDgdRs
dmDg(IWAT) = dmDgdSw
endif
尚、気化油ガス比(Rv)も介在する場合、更に複雑な処理が要求される。
Partial Derivative w.r.t Phase Saturation
水相及びガス相に関するFlow Termに於ける相飽和率による偏微分式の導出については若干の留意が必要である。通常、水相のFlow Termに於ける水飽和率(Sw)による偏微分は次式で与えられる。
mob(ility) = tran(smisibility) *KRWK_i *RBVWK_i
dis(tance) = 0.5 *(XYZ_i - XYZ_j)
pot(ential) = (PXK_i - PXK_j) - (PCOWK_i - PCOWK_j) - dis *(RWK_i + RWK_j)
Fw = mob * pot
!dFwdRx = mob*dpotdRx + dmobdRx*pot
!dFwdSw = mob*dpotdSw + dmobdSw*pot = dmobdSw*pot
!∴ dFwdSwI = tran *ZRBVWK_i *ZKRWZSWK_i *pot
しかしながら、上偏微分式には水-油界面張力の要素が全く考慮されていない。ここで、重ね合わせ原理を用いて補正する必要性があることに気づかれるであろう。詰まり、グリッド圧力にする偏微分要素と相飽和率による界面張力の偏微分要素を重ね合わせる補正が要求される。下記コードを参照されたし。
!dpotdSw = -dPcowdSw
!dFwdSw = mob*dpotdSw + dmobdSw*pot
!∴ =-dFwdPx *dPcowdSw + tran *Krw *drBVWdSw *pot
dFwdSwI =-dFwdPxI *ZPCOWZSWK_i + tran *KRWK_i *ZRBVWZSWK_i *pot
この補正法は解析微分の導出に最も苦労する坑井モデルでは多用される。
Partial Derivative Relative Permeability
SMART・iSMARTには各相に於ける相対浸透率の算定に関して3種類の方法を組込んでいる。3相(油、水、ガス)の賦存状態に於けるBasicな方法とStoneモデル(所謂,First及びSecond Model Formula)である。Stoneモデルについては淡々と偏微分を導出するだけであるが、Basicな油相対浸透率(Kro)の算出法に当たっては一捻りの補正が必要である。因みに、油層状態における3相共存状態の概念図を下図に示す。

問題は自動微分による検証の過程で判明した補正である。具体的な箇所は以下の偏微分に該当する。
!Default Kro Model
!Kro = (gmob *krog + wmob *krow) /tmob = A /B
!dKro = A' /B – A *B' /B^2 = C – D
!D = A *B' /B^2 = (gmob*krog + wmob*krow) *dtmob /tmob^2
!dtmobdsw = 1; dtmobdsg = 1
dDdsw = (gmob *krog + wmob *krow) *dtmobdsw /tmob^2
= (gmob *krog + wmob *krow) /tmob^2
...
SMARTに対して自動微分の組込みに成功していないので、具体例な補正法を現段階で開示すことは避けたい。自動微分の組込み・検証を終えた段階で機会があれば公開したい。
Closing
これまで紹介してきた偏微分の補正によって、SPE Comparative Solution Projectの課題の内、Second並びにNinthで収束性が顕著に向上することを確認している。
Reservoir Simulationに於いて構成する物性の挙動・現象を知る為には、学術的には数値微分・自動微分のみでは不十分、解析微分の組込みが不可欠であると言えよう。
坑井モデルに於ける解析微分については別途紹介したい。
以上
Happy birthday!
Abbreviation
dmFo: Derivative in the free oil mass accumulation term
KRW: Water relative permeabiliy
PCOW: oil-water capillary pressure
PX: Grid pressure
RBVW: Water phase 1/(FVF*μ)
RS: Solution gas oil ratio
RSA: Saturated RS
RW: Water Density
F: Flow term
XYZ: Depth
ZAZB: derivative of A w.r.t B
IOIL-WAT,GAS: Phase index of Oil, Water, Gas
_i: Grid i
_j: Grid j adjacent to Grid i
K: K level
References
- Stone, H.L., “Probability Model for Estimating Three-Phase Relative Permeability”, SPE 2116.
- Stone, H.L., “Probability Model for Estimating Three-Phase Relative Permeability and Residual Oil Data”, SPE 19439.
〆