Commit Graph

282 Commits

Author SHA1 Message Date
Arne Morten Kvarving
a14f5392ee fixed: pass the fipnum data into the adaptive timer stepper
summary substep reports requires FIP data
2017-02-09 09:35:40 +01:00
Kai Bao
19eb0d96c8 adding applyVREPGroupControl() to StandardWellsDense. 2017-01-25 14:11:27 +01:00
Kai Bao
f53bf6f957 adding a pointer to rate_converter in BlackoilModelEbos
in StandardWellsDense.
2017-01-25 14:11:27 +01:00
Kai Bao
af26b70fc9 adding a rate converter to BlackoilModelEbos
and also function updateRateConverter() to update its state.
2017-01-25 14:11:27 +01:00
Andreas Lauser
7d5c5f8acc Merge pull request #1029 from totto82/bugfix_swatinit
BUGFIX Pass solution from flowEbos to ebos initially
2017-01-20 15:02:50 +01:00
Tor Harald Sandve
ce2aa77cbd BUGFIX Pass solution from flowEbos to ebos initially
The initial solution in ebos and  in flowebos are different in cases where
swatinit is present. Pass the initial solution and recalculate the
intensive quantities make sure that the flowEbos initial solution is
used.
2017-01-19 09:18:55 +01:00
Kai Bao
9e93ebcc64 check whether the group targets are converged. 2017-01-16 16:18:35 +01:00
Andreas Lauser
d87b788d09 BlackoilModelEbos: make computeFluidInPlace() work unconditionally
i.e. it now works regardless of whether the cache for intensive
quatities is available or not.
2017-01-16 12:42:35 +01:00
Atgeirr Flø Rasmussen
0028b35e03 Merge pull request #1018 from andlaus/simplify_isParallel
simplify BlackoilModelEbos::isParallel()
2017-01-12 10:41:15 +01:00
Tor Harald Sandve
28bbe20344 Merge pull request #1012 from andlaus/cleanup_StandardWellsDense
small improvements to StandardWellsDense
2017-01-12 10:27:18 +01:00
Andreas Lauser
3a9146866a simplify BlackoilModelEbos::isParallel() 2017-01-11 18:57:47 +01:00
Andreas Lauser
f2115b44ac BlackoilModelEbos: remove the last traces of "SolutionState"
it was not used for real for a while anyway.
2017-01-11 17:07:08 +01:00
Andreas Lauser
b324d17003 small improvements to StandardWellsDense
the most significant change is that only a "PhaseUsage" object must be
passed to its constructor instead of a full "fluid object". also, the
pointers to the vector of "active" phases has been converted into a
full object. (this helps to avoid potential use-after-free errors.)
2017-01-11 17:02:20 +01:00
Markus Blatt
aacbdb1777 Switch off non-owner entries during accumulation.
Previously entries attached to cells that are present
on multiply processes were acumulated several times.
2017-01-11 12:20:32 +01:00
Andreas Lauser
ef731672c9 remove the BlackoilPropsAdInterface abstraction layer
instead, directly use BlackoilPropsAdFromDeck.
2017-01-02 13:19:23 +01:00
Atgeirr Flø Rasmussen
ae1d78f505 Remove unused argument, silence warnings. 2016-12-29 14:34:16 +01:00
Atgeirr Flø Rasmussen
3e120d6e33 Merge pull request #964 from totto82/reuse_cache2
Reuse cache revisited
2016-12-20 14:46:00 +01:00
Atgeirr Flø Rasmussen
45fed6d591 Merge pull request #975 from totto82/clean_up_2p
Use templates to avoid hardcoded typedef
2016-12-19 13:01:05 +01:00
Tor Harald Sandve
4fdf57db04 Consider the timestep converged only when number of iteration > minIter 2016-12-19 10:55:28 +01:00
Tor Harald Sandve
a4bc2d455e Fix rebase 2016-12-19 10:55:28 +01:00
Tor Harald Sandve
ae5d812bc5 BUGFIX cache reuse.
invalidate cachedQuantities when updated and when timestep fails
2016-12-19 10:55:28 +01:00
Tor Harald Sandve
ad6b3f995f BUGFIX pass pvtnum to density in convertResults() in FlowEbos 2016-12-15 13:20:09 +01:00
Tor Harald Sandve
2bfa96fddf Templatize to avoid hardcoded typedef
Prepare for changing the size of the blocks by templatize BVectors and
Evalution
2016-12-12 14:52:30 +01:00
Andreas Lauser
ef15d76831 Merge commit 'refs/pull/947/head' of https://github.com/OPM/opm-simulators into no_opm-parser_pointers
* https://github.com/OPM/opm-simulators:
  [bugfix] add defunct_well_names to BlackoilModelEbos.
  [bugfix] fix ownerMask for parallel FIP code.
  flow_ebos: tell the ebos in ourselves to not handle SWATINIT
  [bugfix] Make initialization work in parallel for flow_ebos.
  [bugfix] make flow_ebos work when no wells are present.
  flow_ebos: only instantiate the grid once
2016-12-06 19:43:47 +01:00
Andreas Lauser
f7910af7d7 flow_ebos: do not use (smart) pointers for opm-parser objects anymore
this patch also includes code to make FlowMainEbos more autonomous
(i.e. it does not derive from FlowMainBase anymore). this allows more
flexibility how and what stuff gets created.
2016-12-05 20:11:43 +01:00
Robert Kloefkorn
2eca5d71e6 [bugfix] fix ownerMask for parallel FIP code. 2016-12-01 22:25:46 +01:00
Andreas Lauser
e6acf888cc flow_ebos: tell the ebos in ourselves to not handle SWATINIT
because the flow part also wants to do this. (and it is quite a bit
more stubborn!)
2016-12-01 16:50:31 +01:00
Robert Kloefkorn
1c2a2c417c [bugfix] make flow_ebos work when no wells are present. 2016-12-01 16:50:28 +01:00
Atgeirr Flø Rasmussen
63b0498843 Merge pull request #951 from andlaus/improve_SimulatorReport
extend and clean up the SimulatorReport
2016-11-30 19:34:11 +01:00
Andreas Lauser
5bb23cfe9d Merge pull request #946 from andlaus/implement_two-phase_blackoil
Implement two phase blackoil
2016-11-28 15:16:19 +01:00
Andreas Lauser
8c5f92dbc4 extend and clean up the SimulatorReport 2016-11-25 21:19:57 +01:00
Tor Harald Sandve
d23270c98f Fix the 2p simulator
Only tested for oil+water case
The blockmatrix and vectors are hardcoded to be 3
and a trivial equation is used for the Gas phase.
2016-11-22 15:01:48 +01:00
Andreas Lauser
5e0804b39f some twophase fixes for flow_ebos
this changes the conversion of the results to hopefully make it work
with twophase simulations. Note that flow_ebos still does not work
because there is a crash in the well model that I don't understand
(and also, I've disabled an assertation in the well model plus I'm not
completely sure if the conversion code need to do something about the
primary variables in the twophase case).
2016-11-22 15:01:48 +01:00
Markus Blatt
a16bce8785 Fixes unsused parameter warnings for ebos stuff 2016-11-21 15:23:12 +01:00
Robert Kloefkorn
59f40ba14e [cleanup][WellModelMatrixAdapter] use only one implementation of the matrix
adapter to avoid confusion.
2016-11-18 12:47:54 +01:00
Robert Kloefkorn
a0da20378c [bugfix][WellModelMatrixAdapter] fix applyscaleadd method. 2016-11-18 12:47:54 +01:00
Robert Kloefkorn
439a084508 [bugfix][BlockoilModelEbos] fix invalidation of intensive quantities after
linear solver failure.
2016-11-18 12:47:54 +01:00
Andreas Lauser
293f7ca1c7 Merge pull request #916 from totto82/frankenstein_fix_appleyard2
Improvments in convergence for flow_ebos
2016-11-14 15:02:00 +01:00
Andreas Lauser
4271da8d84 flow_ebos: fix the build
mainly, the "linsolver_" attribute is called "istlSolver_" in the
BlackoilModelEbos class. Also, this problem possibly only occured if
MPI was enabled...
2016-11-14 13:36:01 +01:00
Tor Harald Sandve
739c0906ef Improvments in convergence for flow_ebos
- restrict pressure changes. Set default to 1.0 (this also effects flow)
- change default number of linear iterations to 150
- tell stabilized newton the residual occilates even if it occilates in
only one phase (this also effects flow)
- avoid problems realated to division on small numbers

Tested on SPE9, norne and Model 2 with significant improvments.
2016-11-14 13:26:38 +01:00
Tor Harald Sandve
5a917a4828 Output FIP in flow_ebos 2016-11-14 09:34:40 +01:00
Andreas Lauser
5c67d79c72 adapt to the rename of "applications/ebos" to "ebos" inside eWoms 2016-11-11 15:05:13 +01:00
Andreas Lauser
42e55ee38b fix the build if MPI is not available
I'm not really sure if the fix is semantically correct (Dune
communicators are strange beasts if you're new to them), but at least
this patch fixes the build without MPI and the resulting flow_ebos
binary seems to work fine.
2016-11-11 14:25:19 +01:00
Robert Kloefkorn
90247a02b2 [feature] make convergenceReduction work in parallel (needs testing). 2016-11-02 17:44:06 +01:00
Robert Kloefkorn
4ff23191eb [feature] make flow and flow_ebos use the same linear solver setup. 2016-11-02 16:41:11 +01:00
Robert Kloefkorn
01bb7ee4d7 [cleanup] only print first letter of phaseName in iteration output. 2016-11-02 11:25:43 +01:00
Tor Harald Sandve
362968c315 New WellStateFullyImplicitBlackoilDense
The WellStateFullyImplicitBlackoil is reverted to master and all
extentions moved to WellStateFullyImplicitBlackoilDense
2016-11-01 13:44:38 +01:00
Andreas Lauser
a773fd4c85 use accessor methods to access the value and derivatives of Evaluation objects 2016-11-01 13:30:41 +01:00
Robert Kloefkorn
31724030c9 Merge branch 'frankenstein' into PR/remove-Eigen-from-BMEbos 2016-10-21 14:13:58 +02:00
Robert Kloefkorn
c8374a4b95 [cleanup] Remove Eigen from BlackoilModelEbos. 2016-10-21 13:26:48 +02:00
Andreas Lauser
6754bad00b Merge branch 'master' into frankenstein
* master:
  Update to shared_ptr-less parser interface.
2016-10-20 20:16:42 +02:00
Tor Harald Sandve
89fcbe3e60 InvalidateCache when restaring the timestep
Keep track of whether it is a restart or not and invalidate the
intensive quantitiesCache in ebos when restarting the timestep due to
convergence issues.
2016-10-19 12:08:49 +02:00
Andreas Lauser
45f11d8820 StandardWellsDense: fix some valgrind complaints
note that I don't know if these changes are semantically correct (I
doubt it), but this patch fixes the valgrind complaints I saw for
SPE9_CP and on Norne.

Also, this makes the timing of flow_ebos for SPE9 determinisic between
runs: without this, I got some random time steps fail in a given run
and in the next run a completely different set of timesteps
failed. Since this was on the same same machine, without any
recompiles and no changes to the deck or any other input parameters, I
initially attributed the behavior to cosmic rays ;)

@totto82: could you have a thorough look on this?
2016-10-17 18:56:38 +02:00
Andreas Lauser
43601b98af flow_ebos: only invalidate the intensive quantities after an iteration if necessary
"if necessary" means that the solution has changed (which is the case
iff the linear solver needs to do some work...
2016-10-07 11:46:08 +02:00
Tor Harald Sandve
8e2657ce4d Some tuning in the Appleyard 2016-09-30 08:57:52 +02:00
Tor Harald Sandve
69811e9585 Use correct pvtregions in rsSat and rvSat calculations 2016-09-30 08:57:52 +02:00
Andreas Lauser
5278b88e2e Merge remote-tracking branch 'remotes/totto82/frankenstein_mod' into frankenstein_merge_master
* remotes/totto82/frankenstein_mod:
  Fix seg-fault for cases without wells
  Some micro performance improvments and cleaning
  Add THP support in the denseAD well model
  Only solve the linear system when it is not converged.
  Revert changes to NewtonIterationBlackoilInterleaved.cpp
  add and use class wellModelMatrixAdapter
  Remove unused code and remove Eigen vectors
  New updateState
  Some cleaning and small changes
2016-09-14 15:03:17 +02:00
Andreas Lauser
4ecd6ca64a fix some serious screw-ups
almost all of them were caused by recent changes in the master
branch:

- there were methods added which depend on the types `V` and
`DataBlock`. these do not make much sense in the context of the
frankenstein simulator. Also, these types are defined globally for the
whole Opm namespace in `BlackoilModelBase_impl.hpp` (which should be
prosecuted as a fellony IMO)! Besides this, their names are useless;
'V' is the letter which comes after `U` in the alphabet and when it
comes to computers basically everything can be seen as a chunk of data
(i.e., a `DataBlock`).
- it seems like the new and shiny dense-AD based well model was never
compiled with assertations enabled, at least some asserts referenced
non-existing variables.
- the recent output-related API changes were pretty unfortunate
because they had the effect of tying the (sub-optimal, IMO) internal
structure of the model even closer to the output code: as far as I can
see, `rq` does only make sense if the model works *exactly* like
BlackoilModelBase and friends. (for flow_ebos, this could be
replicated, but first it would be another unnecessary conversion step
and second, most of the quantities in `rq` are of type `ADB` and much
of the "frankenstein" excercise is devoted to getting rid of these.) I
thus reverted back to an old version of the output code and created a
`frankenstein` branch in my personal `opm-output` github fork.
2016-09-13 23:58:59 +02:00
Tor Harald Sandve
49f3306abe Some micro performance improvments and cleaning
-- The jacobian and residual in the reservoir is updated directly
-- The sparsity pattern are provided to the well matrices.
-- Some cleaning in updateWellState()
2016-09-09 14:58:54 +02:00
Tor Harald Sandve
0c21f2e3de Only solve the linear system when it is not converged. 2016-09-08 11:24:24 +02:00
Tor Harald Sandve
746f9a56cc add and use class wellModelMatrixAdapter
The well contribution is substracted in the MatrixAdapter
i.e. Ax - BinvDCx
2016-09-07 14:37:48 +02:00
Tor Harald Sandve
a4dcc4b13d Remove unused code and remove Eigen vectors
-- isRS and phaseCondition is removed and hydroCarbonState in the state
is used instead
-- input of pressurediffs to computeHydrostaticCorrection() is changed
to double from Vector in WellHelpers.hpp
2016-09-07 12:25:54 +02:00
Tor Harald Sandve
83ff3271af New updateState
-- a new updateState is implemented based on dune vectors
-- the old is kept for comparision in this PR
-- the updateState is not identical.
Tested on spe1, spe9 and norne and it improves the convergence compares
to the old one.
2016-09-07 10:37:42 +02:00
Tor Harald Sandve
952ccf8338 Some cleaning and small changes
- unused code is removed
- the scaled normed is stored in residual_norm_history for usage in
stabilized newton
- number of linear iterations is outputted
- linear solver tolerance is reduced to 0.01
- make compute wellFlux local
- rewrite ADB::V to std::vector<double>
2016-09-06 13:52:43 +02:00
Andreas Lauser
1d2a5d7f1b fix the headers
remove the now unnecessary inclusion of
"NewtonIterationBlackoilInterleaved.cpp" (mind the .cpp extension!)
and include "dune/istl/solvers.hh" instead.
2016-08-28 15:48:18 +02:00
Robert Kloefkorn
b092b2504c make code compile and run. 2016-08-26 11:54:59 +02:00
Tor Harald Sandve
699a0ede01 Remove remaning usage of ADBs
-- the code is still kept for comparison
2016-08-26 10:55:09 +02:00
Tor Harald Sandve
190076f5da Temperary commit
-- works on SPE1 but not SPE9
-- if number of perforations are increased to 3 in SPE1 the same error
as in SPE9 occur.
2016-08-25 15:25:01 +02:00
Tor Harald Sandve
4bdf74eb11 Reorganize the wellModel
- All well-related stuff is moved to StandardWellsDense.hpp
- Some unused functions are removed from BlackoilModelEbos.hpp
2016-08-23 09:58:21 +02:00
Tor Harald Sandve
b023cb15a5 Reset wellcontrols from well_state 2016-08-19 13:50:27 +02:00
Tor Harald Sandve
f60e26faf7 Minor convergence improvments
- set current control when initializing the wellstate
- re calculate wellVariable after well control has changed.
2016-08-18 12:23:46 +02:00
Tor Harald Sandve
49f478480d Remove usage of state in the model
1) The wellsolution is stored in wellVariables as a vector of DenseAD
objects. The wellVariables is computed from the wellstate  in
setWellVariables()
2) BHP and well fluxes are not stored directly but calculated based on
the wellVariables
3) The initial well accumulation term is stored as a vector of doubles.
4) addWellFluxEq() uses DenseAd flux and accumulation terms
5) computePropertiesForWellConnectionPressures() no longer uses state as
input. The wellstate is used to get the bhp pressure.
6) The current wellcontrol is set when updated in updateWellControls()
in order to use well_controls_get_current_type(wc) insted of
well_controls_iget_type(wc, currentIdx)

Tested on SPE1, SPE9 and Norne.
Effects the convergence but the results are identical.
2016-08-18 12:23:46 +02:00
Tor Harald Sandve
dec60a8bd8 The well model no uses the fluidState and fluidsystem from ebos
The well model is modified to use the fluidState and fluidsystem from
ebos. UpdateLegacyState() is no longer needed.
2016-08-18 12:23:46 +02:00
Tor Harald Sandve
1754181761 BUGFIX Make the wellVariables constant
The wellVariables where left out in makeConstantState()
With this fix norne runs
2016-08-18 12:23:45 +02:00
Tor Harald Sandve
5cd7468b51 Implement new well model
Start using the well model desribed in SPE 12259 "Enhancements to the
Strongly Coupled, Fully Implicit Well Model: Wellbore CrossFlow Modeling
and Collective Well Control"

The new well model uses three well primary variables: (the old one had
4)
1) bhp for rate controlled wells or total_rate for bhp controlled wells
2) flowing fraction of water Fw = g_w * Q_w / (g_w * Q_w + q_o * Q_o +
q_g + Q_g)
3) flowing fraction of gas  Fg = g_g * Q_g / (g_w * Q_w + q_o * Q_o +
q_g + Q_g)
where g_g = 0.01 and q_w = q_o = 1;

Note 1:
This is the starting point of implementing a well model using denseAD
The plan is to gradually remove Eigen from the well model and instead
use the fluidState object provided by the Ebos simulator
Note 2:
This is still work in progress and substantial cleaning and testing is
still needed.
Note 3: Runs SPE1, SPE9 and norne until 950 days.
2016-08-18 12:23:45 +02:00
Andreas Lauser
c919b1e6e1 flow_ebos: set the correct pressure value in all cases
for the gas-only case with vaporized oil enabled, the oil pressure was
used, but ebos uses the gas pressure as a primary variable in that
case. (the reason is that it is faster to check if oil appears if the
gas pressure is available in that case.) This patch corrects that and
does no longer use the PrimaryVariables::set$FOO_PV() methods because
these methods are hard to keep in sync with the indices for the
primary-variables-as-a-Dune::FieldVector feature (which is actually
quite important for the linear solver).
2016-08-12 16:52:36 +02:00
Andreas Lauser
8e81023e1d BlackoilModelEbos: remove redundant constructor parameters 2016-08-09 18:38:23 +02:00
Andreas Lauser
626d3e1da5 flow_ebos: only instantiate a single deck and a single EclipseState 2016-08-09 18:38:23 +02:00
Andreas Lauser
adb8a2cf96 fix the end-of-episode detection code 2016-08-09 18:38:23 +02:00
Andreas Lauser
f29bf8f694 flow_ebos: retrieve the simulation grid from the ebos simulator object 2016-08-09 18:38:23 +02:00
Andreas Lauser
77f103fca5 instantiate the ebos Simulator object in SimulatorFullyImplicitBlackoilEbos
this gets rid of some ugly hacks with static variables...
2016-08-09 18:38:23 +02:00
Robert Kloefkorn
3db63b0a22 add flow_ebos, an ebos based simulator
it uses ebos for linearization of the mass balance equations and the
current flow code from opm-simulators for all the rest. currently, the
results match the ones from plain `flow` for SPE1, SPE9 and Norne, but
performance is not optimal: on SPE9, converting from and to the legacy
data structures takes about a third of the time to do the actual mass
balance assembly. nevertheless `flow_ebos` is almost as fast as plain
`flow` for SPE9. (for Norne `flow_ebos` is about 15% slower, even
though the results match quite closely. the reason for this is that it
requires more iterations for some reason.)
2016-08-09 18:38:23 +02:00