Commit Graph

613 Commits

Author SHA1 Message Date
Andreas Lauser
aacdf72356 BlackOilFluidState: document it properly 2017-12-14 10:43:54 +01:00
Andreas Lauser
ab0183f6d8 quad.hpp: simplify the error prevention mechanism for Dune::className()
there is no need to include quad.hpp before dune's
classname.hh. Instead we just include classname.hh into quad.hpp and
it will work unconditionally.
2017-12-14 10:42:23 +01:00
Andreas Lauser
300bbe4fe8 Merge pull request #263 from andlaus/remove_blackoil_satinterpolation
BlackOilFluidSystem: remove interpolation between saturated and unsaturated quantities
2017-12-13 09:49:28 +01:00
Andreas Lauser
b9b81b38b6 BlackOilFluidSystem: re-add the linear interpolation between saturated and undersaturated conditions
since the undersaturated PVT relations may use bi-linear 2D
interpolation but the saturated ones always use linear 1D
interpolation, not having this leads to a discontinuity. that
discontinuity turns out to be very bad news if the partial derivatives
are calculated using finite differences. On the other hand, the
untersaturated PVT relations cannot be used unconditionally (this
would be the clean solution, IMO) because this causes the results to
deflect from those produced by ECL. The hack to make DR[SV]DT work is
to only use the saturated PVT quantities if the R value is
sufficiently large. (This may lead to issues in the future because
there now is a discontinuity w.r.t. R, but let's burn that bridge when
we come to it.)
2017-12-11 15:35:01 +01:00
Andreas Lauser
fc1a042669 black oil: only use the saturated quantities if the R factor is large enough
in the oil case the previous condition that the saturation of the gas
phase is non-zero is cheaper to evaluate, but it does not work when
the maximum Rs value at which the gas phase starts to appear is lower
than the Rs value of the saturated gas. In particular this happens for
the DRSDT keyword.

note that the best solution would be to eliminate these case
distinctions alltogether, but this does not work because ECL does not
seem to use bi-linear interpolation if the pressure gets larger than
the maximum pressure specified by the PVT table. (it only seems to use
the pressure to extrapolate linearly.)
2017-12-11 15:35:01 +01:00
Andreas Lauser
45870255f7 fluid states: remove phaseIsPresent()
this method is now unused and before, it only caused trouble. To
replicate it, use fluidState.saturation(phaseIdx) > 0.0.
2017-12-11 15:35:01 +01:00
Andreas Lauser
a15cb08d2e do not use fluidState.phaseIsPresent() anymore
this lead to problems if finite differences were used because to
calculate the derivative, it may deflect the saturations.
2017-12-11 15:35:01 +01:00
Andreas Lauser
5f650785a9 BlackOilFluidSystem: remove interpolation between saturated and unsaturated quantities
this causes problems with things like DRSDT where
"isSaturated(oilPhasIdx)" is not necessarily related to the presence
of the gas phase. (analogous for DRVDT.)

The impact of performance seems to be negligible:

```
Total time (seconds):         550.185
Solver time (seconds):        534.769
 Assembly time (seconds):     251.509 (Failed: 4.51604; 1.79558%)
 Linear solve time (seconds): 263.03 (Failed: 5.78332; 2.19873%)
 Update time (seconds):       11.0526 (Failed: 0.220144; 1.99177%)
 Output write time (seconds): 18.1411
Overall Well Iterations:      902 (Failed: 7; 0.776053%)
Overall Linearizations:       1890 (Failed: 33; 1.74603%)
Overall Newton Iterations:    1553 (Failed: 33; 2.12492%)
Overall Linear Iterations:    23525 (Failed: 511; 2.17216%)
```

before and

```
Total time (seconds):         556.463
Solver time (seconds):        541.06
 Assembly time (seconds):     253.165 (Failed: 4.42903; 1.74946%)
 Linear solve time (seconds): 267.343 (Failed: 4.52042; 1.69087%)
 Update time (seconds):       11.334 (Failed: 0.214721; 1.89449%)
 Output write time (seconds): 18.0694
Overall Well Iterations:      903 (Failed: 8; 0.885936%)
Overall Linearizations:       1909 (Failed: 33; 1.72865%)
Overall Newton Iterations:    1572 (Failed: 33; 2.09924%)
Overall Linear Iterations:    23866 (Failed: 391; 1.63831%)
```

after this patch, i.e., on my machine the runtime for Norne went from
550 to 556 seconds due to slightly larger number of non-linear and
linear iterations. Note that this also happens if the 1e-4 threshold
value is changed instead of the case distinction being removed. (This
hints on the into the direction that the performance difference is
just numerical noise.)
2017-12-11 15:35:01 +01:00
Andreas Lauser
1f0be92300 add a unit test for BlackOilFluidSystem 2017-12-11 15:35:01 +01:00
Andreas Lauser
53d9d92d65 make Tabulated1DFunction more consistent with UniformXTabulated2DFunction
these are basically cosmetic cleanups.
2017-12-11 15:35:01 +01:00
Andreas Lauser
94b6124fba improve implementation of UniformXTabulated2DFunction
in particular, do not mingle the segment index and the relative
position within the segment into a single number anymore.
2017-12-11 15:35:01 +01:00
Andreas Lauser
408ceb820b Merge pull request #265 from andlaus/remove_useComplexRelations
fluid systems: remove the complex relations flag from the fluid systems
2017-12-04 15:20:30 +01:00
Andreas Lauser
9c57728405 fluid systems: remove the complex relations flag from the fluid systems
this flag is way too non-descript (a complex relation for one person
may be a simple one for another), the implementation is pretty
inconsistent and it makes the code more complicated and harder to
maintain. Thus, IMO the approach turned out to be a bummer, so let's
pull the plug.
2017-12-04 11:08:50 +01:00
Andreas Lauser
0d6ef73d9e Merge pull request #264 from andlaus/add_BlackOilFluidState
add a tailor-made fluid state for black-oil models
2017-12-01 17:52:51 +01:00
Andreas Lauser
7cb5e91e2b add a tailor-made fluid state for black-oil models
this is basically a slightly cleaned up version of
Ewoms::BlackOilFluidState.
2017-12-01 17:25:08 +01:00
Andreas Lauser
5f7ac68b1a Merge pull request #260 from totto82/supportSOF2
Add support for SOF2 for 2p runs.
2017-11-24 10:29:28 +01:00
Tor Harald Sandve
f6146db122 Add support for SOF2 for 2p runs.
Make it possible to use SOF2 in combination with either
SGFN og SWFN for gas-oil and water-oil case respectivly.
2017-11-23 10:46:55 +01:00
Andreas Lauser
cb75a7ad6f Merge pull request #259 from andlaus/fix_n2_heatcap
N2: make the heat capacity consistent with the enthalpy again
2017-11-17 19:19:21 +01:00
Andreas Lauser
0d613a7c25 N2: make the heat capacity consistent with the enthalpy again
I missed the fact that in the enthalpy() function, the polynomial
coefficients are divided, i.e., this component defines a polynomial
for the heat capacity and integrates it for the enthalpy. (not
the other way around.)
2017-11-17 19:09:01 +01:00
Andreas Lauser
0e78de262d Merge pull request #258 from andlaus/fix_component_enthalpy
fix heatCapacity() and enthaply() of some components
2017-11-17 19:00:49 +01:00
Andreas Lauser
db87b77896 fix heatCapacity() and enthaply() of some components
I looked at all components: For the ones that use simple enthalpy
relations, heatCapacity() and enthalpy() should now be
consistent. (Here "simple" means "an approach that I understood without
reading literature for several hours".)
2017-11-16 16:30:24 +01:00
Tor Harald Sandve
ef91bbf7d2 SWATINIT Also scale capPres when water saturation is below residual
This assure that the initial state is in eqvilibrium also for cells with
where SWATINIT is set below residual value.
2017-09-21 14:50:08 +02:00
Andreas Lauser
93d448457c Merge pull request #246 from totto82/gasoil
Allow for 2p gasoil case
2017-09-05 21:28:14 +02:00
Tor Harald Sandve
a13a3a3f62 Allow for 2p gasoil case 2017-09-04 12:32:27 +02:00
Andreas Lauser
d68dd09aee Merge pull request #245 from andlaus/limit_VAPPARS
limit the reduction due to VAPPARS to a factor of 1000
2017-07-31 15:01:13 +02:00
Andreas Lauser
2457b4d5af VAPPARS: considerably increase the epsilon value for the numerator
again, the effect of this on the results should be negligible, but the
numerical performance should become much better.
2017-07-28 23:04:18 +02:00
Andreas Lauser
87122bb2f5 limit the reduction due to VAPPARS to a factor of 1000
a reduction of Rs and Rv of a factor 1000 should be enough physically
and the numerical stability is quite a bit better with this. In
particular, this is should not really matter because the whole concept
of VAPPARS is a staggeringly ugly hack from the outset.
2017-07-28 23:02:37 +02:00
Andreas Lauser
2f537717c8 Merge pull request #244 from andlaus/VAPPARS_limit_SoMax
VAPPARS: limit the maximum oil saturation to 1.0
2017-07-28 20:54:46 +02:00
Andreas Lauser
b631809de8 VAPPARS: limit the maximum oil saturation to 1.0
It should never become larger than 1, but during a Newton-Raphson
update it may happen anyway.
2017-07-28 19:13:10 +02:00
Andreas Lauser
3a65e712c9 Merge pull request #242 from andlaus/Evaluation_default_copy
Evaluation: use the trivial copy constructor and copy operator
2017-07-27 20:14:24 +02:00
Andreas Lauser
be96015760 Merge pull request #243 from andlaus/no_by_value_catch
TabulatedComponent: don't catch std::exception by value
2017-07-27 20:03:14 +02:00
Andreas Lauser
2b4114907e TabulatedComponent: don't catch std::exception by value
std::exception is a polymorphic type and catching these by values
generates warnings when using the latest GCC from SVN. Besides this,
catching objects by value is bad style and was unintended from the
start.
2017-07-27 18:04:43 +02:00
Andreas Lauser
6cdae5f4c2 Evaluation: update the generated code 2017-07-27 18:02:55 +02:00
Andreas Lauser
8a0de34ad0 Evaluation: use the trivial copy constructor and copy operator
this potentially allows the compiler to do better optimizations.
2017-07-27 18:02:55 +02:00
Andreas Lauser
a66273c6aa Merge pull request #241 from andlaus/keep_track_of_reservoir_temperature
BlackOilFluidSystem: Keep track of the reservoir temperature
2017-07-27 18:01:23 +02:00
Andreas Lauser
0bc9299010 BlackOilFluidSystem: Keep track of the reservoir temperature
In fact, the temperature at the reservoir is not constant, so this
should be more thought of as "representative temperature" of the
reservoir.

In ECL, this value is specified using the RTEMP or the RTEMPA
keywords, opm-parser provides this via the table manager. (NB: is this
really something that belongs there?)
2017-07-27 16:06:58 +02:00
Andreas Lauser
2f08e57ad8 Merge pull request #240 from andlaus/fix_headercheck
make all headers autonomous again
2017-07-20 13:10:44 +02:00
Andreas Lauser
b65defe489 make all headers autonomous again
i.e., they can be included without having other files included before them.
2017-07-20 12:08:47 +02:00
Andreas Lauser
9583b402c7 Merge pull request #237 from andlaus/remove_deprecated
RegularizedBrooksCoreyParams: remove long deprecated method
2017-06-30 14:33:17 +02:00
Andreas Lauser
99039f6d62 RegularizedBrooksCoreyParams: remove long deprecated method
this method is unused in the whole OPM project and has long been
renamed to setPcLowSw().
2017-06-29 18:42:39 +02:00
Andreas Lauser
3ddc7a5340 Merge pull request #234 from dr-robertk/PR/cleanup-scalar
[cleanup] make code compile when Scalar is non POD type.
2017-06-27 13:13:39 +02:00
Andreas Lauser
0a2591f3fd Merge pull request #236 from andlaus/fix_debug_mode_warning
fix an unused typedef warning that only occurs in debug mode
2017-06-27 13:13:01 +02:00
Andreas Lauser
e9dfe00335 Merge pull request #235 from andlaus/fix_critsat
EclEpsScalingPoints: make determining the critical saturations more robust
2017-06-26 13:29:30 +02:00
Andreas Lauser
3c7e12976f fix an unused typedef warning that only occurs in debug mode 2017-06-26 10:40:17 +02:00
Andreas Lauser
967af088bb EclEpsScalingPoints: make determining the critical saturations more robust
these loops are somewhat tricky. the new versions are infinitessimally
slower, but hopefully much more robust.
2017-06-24 13:13:02 +02:00
Robert Kloefkorn
aec9fe5834 [cleanup] make code compile when Scalar is non POD type. 2017-06-23 10:46:55 +02:00
Atgeirr Flø Rasmussen
d0ef28833a Merge pull request #220 from andlaus/eval_specializations_v2
Eval specializations v2
2017-06-15 10:39:57 +02:00
Andreas Lauser
72fd2c8a7e Merge pull request #233 from andlaus/densead_declutter
Densead declutter
2017-06-15 10:33:42 +02:00
Andreas Lauser
87222f3c6a disable a static assertation in the DenseAD convenience functions
the problem is that some of these function names clash with those for
code using AutoDiffBlock. This is normally not a problem because of
the SFINAE rule, but the static assertation makes the compiler bail
out before SFINAE kicks in.

IMO this is a little unfortunate because without this static_assert
compiler errors are bound to becomming quite a bit more obscure, but
as long there is code which uses both AD approaches at the same time,
I cannot see a way to keep the assert without moving one approach or
the other to a different namespace (or renaming the math function for
one).
2017-06-14 11:06:04 +02:00
Andreas Lauser
0f6540bdad DenseAD: make less fuzz about it
this patch converts to code to use the convenience functions instead
of the math toolboxes whereever possible. the main advantage is that
Opm::foo(x) will work regardless of the type of `x`, but it also
reduces visual clutter.

also, constant Evaluations are now directly created by assigning
Scalars, which removes further visual noise.

while I hope it improves the readability of the code,
functionality-wise this patch should not change anything.
2017-06-13 17:25:03 +02:00