arbrandt / OPGEE

Oil Production Greenhouse Gas Emissions Estimator
18 stars 3 forks source link

Bottomhole flowing pressure issue for shallow fields #495

Open UncleDrO opened 1 year ago

UncleDrO commented 1 year ago

Reproducing the problem in OPGEE v3.0b BETA

This will result in Run-time error 13: Type mismatch

Obviously this is a minimalistic input. However, I have run into this issue working with actual global oil fileds data, even if these were rather sparse. Identical inputs calculate smoothly in OPGEE v2.0c. Just distilled the problem down to the core.

Tracing the error

Debugging shows a problem on line 494 of BulkAssessment macro. This points to cell ActiveField!J257 and subsequently to Reservoir!L75 to Reservoir!M75 to Reservoir!M73 to Reservoir!M71. Cell M71 on Reservoir sheet contains evaluation of the bottomhole flowing pressure using Lake LW (2007), p 997, eqn 10.36. This is described in OPGEE v3.0b Documentation section 6.3.1, specifically equation 6.25.

The error in cell M71 arises because the expression under square root in eqn 6.25 evaluates to a negative value.

Furthermore, I notice that eqn 6.24 in Documentation is simply an approximation for high pressure p_e (a truncated Taylor series) of the general eqn 6.25. Therefore, it seems to me that simply the general eqn 6.25 can be used in evaluation of p_we at all pressure values.

But more importantly, it is necessary to assure that the argument inside square root of eqn 6.25 is non-negative. Or perhaps some other method for calculation bottomhole flowing pressure for most shallow fields needs to be used?

How should this be fixed properly?