Commit Graph

1101 Commits

Author SHA1 Message Date
Andreas Lauser
ed0e839eb5 avoid single precision floating point underflows in MiscibleMultiPhaseComposition
for single-precision FP scalars, this was the same as setting a
tolerance of 0. maybe this should be done instead?!
2018-03-03 13:17:33 +01:00
Andreas Lauser
135f81073d add a few OPM_UNUSED decorations to variables which are only used within static_assert
for some reason icc produces a warning about this.
2018-03-03 13:17:33 +01:00
Atgeirr Flø Rasmussen
a7d929e638 Merge pull request #288 from atgeirr/missing-include
Include <stdexcept> for std::runtime_error.
2018-02-14 14:46:06 +01:00
Atgeirr Flø Rasmussen
da4b160438 Include <stdexcept> for std::runtime_error. 2018-02-14 13:02:40 +01:00
Andreas Lauser
e5e43fa7a8 Merge pull request #287 from andlaus/separate_opm-common_concerns
move some basic infrastructure from opm-common to here
2018-02-08 16:24:51 +01:00
Andreas Lauser
27386851a2 move some basic infrastructure from opm-common to here
all of these classes have only been used in opm-material and its
downstreams in the first place.
2018-02-07 16:44:44 +01:00
Joakim Hove
9aa47b2969 Merge pull request #282 from andlaus/cp_to_cv
Cp to cv
2018-01-31 17:51:13 +01:00
Atgeirr Flø Rasmussen
94f0f8b985 Merge pull request #283 from akva2/relocate_files_in_common
changed: opm/common/[->utility/]ConditionalStorage.hpp
2018-01-31 13:17:57 +01:00
Andreas Lauser
7fece91b76 Merge pull request #284 from atgeirr/master
Silence some warnings
2018-01-30 15:47:43 +01:00
Atgeirr Flø Rasmussen
a9018ece34 Add OPM_UNUSED to unused temperature arguments. 2018-01-30 15:06:26 +01:00
Atgeirr Flø Rasmussen
578426f4cd Remove unused arguments. 2018-01-30 15:06:13 +01:00
Atgeirr Flø Rasmussen
904a5c674b Put code in separate scope to avoid shadowing. 2018-01-30 15:05:48 +01:00
Arne Morten Kvarving
46892f54f0 changed: opm/common/[->utility/]ConditionalStorage.hpp 2018-01-30 12:24:04 +01:00
Andreas Lauser
096c22be92 ECL thermal: assume heat capacities for constant volume instead for constant pressure
this implies that the internal energy instead of the enthalpy is
specified by the fluid PVT classes.
2018-01-30 12:19:17 +01:00
Andreas Lauser
be4245a397 improve the documentation of the NCP flash solver 2018-01-30 12:18:34 +01:00
Andreas Lauser
b86664f3a9 Merge pull request #280 from andlaus/fix_fluidstate_getters2
fix Opm::getInvB_(fluidState) once more
2018-01-22 16:09:48 +01:00
Andreas Lauser
64eae1c92f fix Opm::getInvB_(fluidState) once more
after #278, the generic version of getInvB_() was always used because
no argument for fluidState.invB() was specified when invoking the
GENERATE_HAS_MEMBER() macro, so has_invB<FluidState>() returned false
for any fluid state. since the getInvB_() function is not used by the
master version of `flow` yet, it was unaffected by this issue and this
is also the reason why neither Jenkins complained nor any performance
regression could be seen after #278. That said, for implementing
non-trivial boundary conditions, it is very helpful to have a unified
code path for the case where boundary conditions are specified using
generic fluid states and black-oil model specific ones as well as with
the flux computations in the interior of the domain.

Note that I only found this issue due to the fact that on my current
WIP branch linearization got 10% slower for Norne. This means that the
generic version of this function must be correct and, considering the
fact that the massFraction() method is quite elaborate for
BlackOilFluidState, this is also a very strong indication that on
modern processors the performance of even the linearization part of
the simulation is more limited by memory latency than by the execution
speed of the ALUs.
2018-01-22 14:24:41 +01:00
Andreas Lauser
a03f9a73cc Merge pull request #278 from andlaus/fix_fluidstate_getters
Fix fluid state getters for blackoil quantities
2018-01-19 13:01:17 +01:00
Andreas Lauser
fdf506794f make the ordering of the template parameters of the get*_(fluidState) functions consistent
the order of template parameter now always is FluidSystem, FluidState,
Evaluation. This requires some downstream mop-up patches.
2018-01-19 11:40:25 +01:00
Andreas Lauser
f46b23fcbb add the PVT region index as a parameter for getInvB_()
this is only relevant for the generic-fluidstate version. In most
cases, 0 should be passed as the PVT region index.
2018-01-19 11:38:18 +01:00
Andreas Lauser
4416b4ae83 fix typo in version of getInvB_() for generic fluid states 2018-01-19 11:31:50 +01:00
Andreas Lauser
d3b20fa5c5 use has_invB() to decide if the generic or trivial versions of getInvB_() are used
this used to be has_pvtRegionIndex(). While there currently is no
difference in practice because the only fluid state that exhibits a
pvtRegionIndex() method also has invB(), a bug is a bug...
2018-01-19 11:30:55 +01:00
Andreas Lauser
847213f36e Merge pull request #275 from andlaus/implement_TOLCRIT
implement support for the TOLCRIT ECL keyword
2018-01-08 15:41:03 +01:00
Andreas Lauser
68ed9ea7b3 implement support for the TOLCRIT ECL keyword 2018-01-08 11:58:53 +01:00
Andreas Lauser
e4d4454671 Merge pull request #273 from andlaus/avoid_heat
thoroughly rename the thermal laws
2018-01-05 13:59:35 +01:00
Andreas Lauser
86a0e9befc ECL thermal gas PVT: add the heat of vaporization to the gas enthalpy
this does only matters for temperature changes due to dissolution and
evaporization of gas in oil or oil in gas. The comprehensive solution
would be to make the enthalpy of the phases composition dependent, but
ECL does not seem to support this when using the black-oil model.
2018-01-04 15:25:12 +01:00
Andreas Lauser
bf3cffa6b4 thoroughly rename the thermal laws
this was only partially done so far: the term "heat" should be avoided
if possible because it is a somewhat fuzzy concept. Thus, replace it
by "energy" and "thermal" where it is not a well established
term. ("well established" basically means "heat capacity".)
2018-01-04 15:25:11 +01:00
Andreas Lauser
d2588eac7d compute the inverse formation volume factor for generic fluid states
before, if the fluid state did not provide an invB() method,
Opm::getInvB_() just returned 0.0. with this, it uses the composition
and density of the phase in question to compute that quantity.

(also, this commit contains a few stylistic cleanups for
BlackOilFluidSystem)
2018-01-02 10:33:22 +01:00
Andreas Lauser
1f114a2bc9 Merge pull request #268 from andlaus/improve_BlackOilFluidState
improve the BlackOilFluidState class
2017-12-15 09:26:51 +01:00
Andreas Lauser
644240e6b9 improve the BlackOilFluidState class
now the assign() function should work and all functions should exhibit
a doxygen string. note that the inverse formation volume factors are
zero if the fluid state passed as the argument to assign() does not
feature an invB() member function.
2017-12-14 17:54:22 +01:00
Andreas Lauser
a4aa334c02 Merge pull request #267 from andlaus/implement_blackoil_energy
Implement blackoil energy
2017-12-14 10:44:33 +01:00
Andreas Lauser
f8ecd7ceaa implement the ECL thermal laws
Like for the material laws, an EclThermalLaw manager class is provided
to simplify initialization of the parameter objects from ECL decks.
2017-12-14 10:43:54 +01:00
Andreas Lauser
7b8951ed83 refactor the "heat conduction" laws into "thermal laws"
thermal laws are the heat conduction laws plus "solid energy laws"
which can be used to specify the relations which govern the volumetric
internal energy of the solid matrix of the porous medium.
2017-12-14 10:43:54 +01:00
Andreas Lauser
f195effcdd VanGenuchtenParams: remove superfluous include 2017-12-14 10:43:54 +01:00
Andreas Lauser
0bd4596e8d BlackOilFluidSystem: implement enthalpy() 2017-12-14 10:43:54 +01:00
Andreas Lauser
255fa88bd5 BlackOilFluidSystem: honor the STCOND keyword to specify the standard conditions 2017-12-14 10:43:54 +01:00
Andreas Lauser
7e651c2317 black-oil: improve the thermal fluid PVT classes
- Introduce an enthalpy() method to all low-level PVT classes
- change the approach to define temperature dependent density for oil
  and gas to the OPM-specific keywords GASDENT and OILDENT. Funnily
  enough, ECL already has a WATDENT keyword.
2017-12-14 10:43:54 +01:00
Andreas Lauser
835a74cc1e extend BlackOilFluidState by energy related quantities
i.e. enthalpy, internal energy and temperature. To make sure that this
does not affect simulatiors which do not use energy, two additional
template parameters, `enableTemperature` and `enableEnergy` are
introduced and the energy quantities are only stored
conditionally. The first parameter allows to store a temperature in
the fluid state without storing enthalpies while the second stores
everything (i.e., setting it to true also implies the first).
2017-12-14 10:43:54 +01:00
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