Commit Graph

8665 Commits

Author SHA1 Message Date
Joakim Hove
5db60aba5e Set external Action::State object in the vanguard 2021-10-12 10:41:29 +02:00
Markus Blatt
cc1adf0b2a
Merge pull request #3586 from blattms/tracer-use-well-container
[refactor] Use well_container and PerforationData for tracers
2021-10-12 09:55:33 +02:00
Bård Skaflestad
0f13f4095b Mark 'comm' As Potentially Unused
The communicator is only needed in parallel builds.
2021-10-10 20:38:45 +02:00
Joakim Hove
b6d043c545
Merge pull request #3580 from joakim-hove/wtest-rename
Remove ecl wells argument to check wells for testing
2021-10-10 09:54:16 +02:00
Bård Skaflestad
61ac76fe90 Make ARGV[ARGC] Into a Nullpointer
This is strictly speaking required by POSIX.
2021-10-09 00:17:32 +02:00
Bård Skaflestad
ad74de2e1a Use Algorithm to Locate '--version' Option 2021-10-09 00:17:32 +02:00
Bård Skaflestad
fca167acfd Split Individual Cases Out to Helper Functions
This commit moves the bodies of the various 'dynamicDispatch_<>()'
cases out to separate helper functions.  Not only does this reduce
the number of nested conditionals, it also helps reasoning about
each case in isolation and aids future maintenance.
2021-10-09 00:17:32 +02:00
Bård Skaflestad
3455dbdac9 Main.hpp: Adjust Whitespace
In preparation of refactoring 'dispatchDynamic_<>()'
2021-10-09 00:17:32 +02:00
Joakim Hove
4da52424c7 Add const 2021-10-08 20:58:49 +02:00
Markus Blatt
fc7609bfd2 [bugfix] Make sure all ranks participate in collective communication.
No need an early return if there are no local wells, anyway. The
algorithms can handle empty containers like a charm.
2021-10-08 16:01:18 +02:00
Markus Blatt
1520f9c85f [bugfix] handle exception when linearizing the wells.
As multisegment wells may throw in applyUMFPack this is now needed and
the exception needs to communicated to all processes. We do this in
the linearize method of the well model.

Before this change this is what could happen:
- The process with the exception would have chopped the time step
- The others would have successfully setup the systems and entered the
  linear solve

This  poduced a deadlock. One processes was waiting in
OPM_END_PARALLEL_TRY  during the setup of the shorter time step and in
collective communication during the setup of the linear solver for the
unchopped time step.
2021-10-08 16:01:07 +02:00
Tor Harald Sandve
d07aed204f Catch numerial issues due to problems with inner iterations wells 2021-10-08 15:26:53 +02:00
Tor Harald Sandve
fdf6ce9c54 change assert with throw for isfinite primary variable 2021-10-08 15:26:52 +02:00
Joakim Hove
0ca1f7a8b2 WellTestState::updateWells -> WellTestState::test_wells 2021-10-08 15:23:03 +02:00
Joakim Hove
0e9d634397 Do not pass ecl wells to WellTestState::updateWells() 2021-10-08 15:17:43 +02:00
Joakim Hove
c599402318
Merge pull request #3591 from joakim-hove/welltest-state-rename
Welltest state rename
2021-10-08 14:07:04 +02:00
Bård Skaflestad
d028937925 Remove Unused 'Comm' Parameter
Remnant from ealier refactoring work.
2021-10-08 12:44:27 +02:00
Joakim Hove
0e365abe36 WellTestState::dropCompletion -> WellTestState::open_completion 2021-10-08 10:40:38 +02:00
Joakim Hove
0648d6bf5d WellTestState::openWell -> WellTestState::open_well 2021-10-08 10:17:14 +02:00
Joakim Hove
d806762f7a WellTestState::hasWellClosed -> WellTestState::well_is_closed 2021-10-08 10:17:14 +02:00
Joakim Hove
52b2c096a2 WellTestState::closeWell -> WellTestState::close_well 2021-10-08 10:17:14 +02:00
Joakim Hove
feaaebf3fc WellTestState::hasCompletion -> WellTestState::completion_is_closed 2021-10-08 09:06:21 +02:00
Bård Skaflestad
1feab761d6 Extract Helper Functions From readDeck
Mostly to reduce the number of nested conditionals and long lines.
2021-10-07 22:01:47 +02:00
Markus Blatt
d4ab9ea4b1 [refactor] Use well_container and PerforationData for tracers
This saves some (expensive?) lookups that already have been done
in the well model. We had to make the well_container accessible from
the well model for this.

Using the perforation data will automatically make sure that the
perforations are not shut and reside on this process in a parallel run.
2021-10-07 21:55:41 +02:00
Markus Blatt
f2ce097b4b
Merge pull request #3575 from Tongdongq/fix-ilu-decomp-gpu
Create and use scale kernel for relaxation of ILU
2021-10-07 15:55:17 +02:00
Joakim Hove
e0ea090960 WellTestState::addClosedCompletion - WellTestState::close_completion 2021-10-07 14:56:20 +02:00
Joakim Hove
ce78326ac1 WellTestState::openAllCompletions -> WellTestState::open_completions 2021-10-07 14:53:06 +02:00
Joakim Hove
0c40771c7a
Merge pull request #3579 from joakim-hove/template-on-content-type
WTEST: only count actually closed wells.
2021-10-07 09:27:41 +02:00
Markus Blatt
011fb1034e
Merge pull request #3571 from atgeirr/allow-non-world-comm
Replacing use of MPI_COMM_WORLD with a variable communicator.
2021-10-06 15:52:17 +02:00
Joakim Hove
4816762b66 Well testing: only count actually closed wells. Change in opm-common 2021-10-06 15:32:17 +02:00
Joakim Hove
eb2ca4798c Templatize over content type instead of full argument type 2021-10-06 12:11:44 +02:00
Atgeirr Flø Rasmussen
09a5320e21 Silence unused variable warning. 2021-10-06 08:52:06 +02:00
Joakim Hove
f27a82ebc3 Use plain WellTestState::hasWellClosed() without reason 2021-10-05 16:52:16 +02:00
Atgeirr Flø Rasmussen
d1391de639 Minor whitespace fixes. 2021-10-05 13:59:16 +02:00
Elyes Ahmed
65f0e4e7f0 Replacing calling Communication with a header 2021-10-05 13:07:52 +02:00
Elyes Ahmed
0202b00d59 clean up after review 2021-10-05 13:07:52 +02:00
Elyes Ahmed
f53c597f90 Replacing use of MPI_COMM_WORLD with a variable communicator. 2021-10-05 13:07:52 +02:00
Tong Dong Qiu
68adf85f52 Create and use scale kernel for relaxation of ILU 2021-10-05 10:49:21 +02:00
Tor Harald Sandve
afdfe55bbc restrict maximum number of times a well can switch to the same control 2021-10-04 10:12:39 +02:00
Joakim Hove
122678e5ea Remove unused function argument 2021-10-01 08:34:58 +02:00
Joakim Hove
2f94f0436b Remove irrelevant private functions 2021-10-01 08:34:27 +02:00
Joakim Hove
38d327b447 Add Some documentation to WellState 2021-10-01 08:26:41 +02:00
Joakim Hove
09920c8f54
Merge pull request #3562 from OPMUSER/master
Keyword Validation Fixes: GCONINJE, WTEST and AQUCT
2021-09-30 17:15:19 +02:00
Joakim Hove
2168b8c296
Merge pull request #3563 from totto82/openComp
open completions after well event
2021-09-30 16:43:39 +02:00
Tor Harald Sandve
1e547ff714
Merge pull request #3564 from totto82/moveCom
communicate before usage not after
2021-09-30 14:34:15 +02:00
Tor Harald Sandve
623ff2c3ce communicate before usage not after 2021-09-30 11:54:56 +02:00
Tor Harald Sandve
dc8c9021b5 open completions after well event 2021-09-30 11:40:34 +02:00
Joakim Hove
6e37b9ae05
Merge pull request #3559 from joakim-hove/wtest-config-empty
Use WellTestConfig.empty() instead of size()
2021-09-30 10:31:17 +02:00
OPMUSER
be7395a137 Keyword Validation Fixes: GCONINJE, WTEST and AQUCT
Keyword Validation Fixes: GCONINJE, WTEST and AQUCT. Just minor edsits
2021-09-30 16:14:40 +08:00
Tor Harald Sandve
cb9254636b rename and cleanup 2021-09-30 09:01:07 +02:00
Tor Harald Sandve
bc8da79779 stop checking operability in the beginning of an timestep 2021-09-30 08:47:47 +02:00
Tor Harald Sandve
c9e93e6155 stop updating operability during iterations 2021-09-30 08:47:47 +02:00
Bård Skaflestad
e80408d1ed
Merge pull request #3560 from totto82/fixTime
fix date for large time steps also for the interface functions
2021-09-29 22:19:46 +02:00
Tor Harald Sandve
06878a8ca8 fix date for large time steps 2021-09-29 15:43:20 +02:00
Joakim Hove
d0c9f70839
Merge pull request #3556 from joakim-hove/flow-main-catch
Call MPI_Abort() in main catch all clause
2021-09-29 15:11:46 +02:00
Joakim Hove
21c2dd0c1d Use WellTestConfig.empty() instead of size() 2021-09-29 15:05:23 +02:00
Joakim Hove
fc139e844e Use const reference 2021-09-29 11:07:21 +02:00
Joakim Hove
a527dc7fdd Remove stale TODO 2021-09-28 23:45:40 +02:00
Joakim Hove
3aaaa23ed1 Implement connection rate summation in SingleWellState 2021-09-28 23:45:40 +02:00
Joakim Hove
86a0662381 Use std::reference_wrapper<> for parallel well info 2021-09-28 21:42:57 +02:00
Joakim Hove
cf340644b2 Add ParallelWellInfo member to SingleWellState 2021-09-28 21:42:57 +02:00
Joakim Hove
5d3e56baa3 Call MPI_Abort() in main catch all clause 2021-09-28 20:53:38 +02:00
Joakim Hove
56afec81b4
Merge pull request #3548 from joakim-hove/broadcast-udq+action
Broadcast UDQState and Action state after restart loading
2021-09-28 19:31:53 +02:00
Bård Skaflestad
0b8778e432
Merge pull request #3547 from totto82/makeWTESTrobust
Make wtest more robust
2021-09-28 12:06:10 +02:00
Atgeirr Flø Rasmussen
e5c85e88ce
Merge pull request #3552 from fgfuchs/cuda_improvements
cusparsesolver wrong size and type in cols,rows fixed
2021-09-28 11:41:17 +02:00
Tor Harald Sandve
c790b14753 Make WTEST more robust
Only open wells that are solvable, operable and economical
2021-09-28 10:07:12 +02:00
Joakim Hove
8943e90e17 Broadcast UDQState and Action state after restart loading 2021-09-28 09:54:15 +02:00
Joakim Hove
ef12186d78 Remove unused query/switch code for GLO - it is always on 2021-09-27 14:11:54 +02:00
Franz Georg Fuchs
a0ccd1e754 cusparsesolver wrong size and type in cols,rows fixed 2021-09-27 13:53:26 +02:00
Markus Blatt
88ae5b5963
Merge pull request #3545 from blattms/fix-parallel-try-catch
[bugfix] Fix deadlocks because of parallel try-catch for some CO2 storage cases
2021-09-27 13:02:34 +02:00
Bård Skaflestad
b63a4ea3a3
Merge pull request #3546 from totto82/fixWSOL
updateWsolvent only after well container is created
2021-09-24 13:41:47 +02:00
Tor Harald Sandve
9381b0857b updateWsolvent only after well container is created 2021-09-24 12:09:02 +02:00
Markus Blatt
5be027348a Fix buggy interplay of parallel exceptions and communication.
There cannot happen any collective blocking communication within a
parallel try-catch clause if exceptions might be thrown before the
communication. The communication has to either be reached by all
processes or no processes.
2021-09-24 10:17:13 +02:00
Markus Blatt
f64230e462 Remove parallel try-catch from prepareTimeStep because of nestedness.
Although not declared as such, prepareTimeStep seems to be an internal
function (despite usage in a test) and hence error control can be done
in code calling it.

There was the following problem with the try-catch approach taken:
The calling site `BlackoilWellModel::assemble` looked like this:

```
OPM_BEGIN_PARALLEL_TRY_CATCH();
{
    if (iterationIdx == 0) {
        calculateExplicitQuantities(local_deferredLogger); // no parallel try-catch
        prepareTimeStep(local_deferredLogger); //includes parallel try-catch
    }
    updateWellControls(local_deferredLogger, /* check group controls */ true);

    // Set the well primary variables based on the value of well solutions
    initPrimaryVariablesEvaluation();

    maybeDoGasLiftOptimize(local_deferredLogger);
    assembleWellEq(dt, local_deferredLogger);
}
OPM_END_PARALLEL_TRY_CATCH_LOG(local_deferredLogger, "assemble() failed: ",
                               terminal_output_);
```

calculateExplicitQuantities had no parallel-try-catch clause inside,
but prepareTimeStep had one.
Unfortunately, calculateExplicitQuantities might throw (on some
processors). In that case non-throwing processors will try to trigger a
collective communication (to check for errors) in
prepareTimeStep. While the one throwing will move to the
OPM_END_PARALLEL_TRY_CATCH_LOG macro at the end and also trigger a different
collective communication. Booom, we have a deadlock.

With this patch there is no (nested parallel)-try-catch clause in the
functions called. (And if an exception is thrown in prepareTimeStep, it
will be logged as being an assemble failure).

The other option would have been to add parallel-try-catch clauses
to all functions called. That would have created a lot more
synchronization points limiting scalability even further.
2021-09-24 10:15:28 +02:00
Markus Blatt
3cda8a2fdb Added missing parallel try-catch clause for updatePrimaryIntensities.
As Problem::updatePrimaryIntensities might throw we need to do this
to prevent dealocks in parallel run in case problem occurs.
2021-09-24 09:25:44 +02:00
Markus Blatt
a927f8e23b Unify parallel try-catch clauses with Macros and catch everything.
Not a big fan of Macros but here at least they seem ot be the only
option. The problem is that the catch clauses must all catch the same
exceptions that have a entry in ExceptionType, because they might be
nested. In addition we did not have a catch all clause, which is added
now and is needed in case a called method throws an unexpected exception.
2021-09-24 09:25:44 +02:00
Bård Skaflestad
1dc3832966
Merge pull request #3540 from hakonhagland/python_set_sched
Initialize blackoil simulator from Opm::Schedule shared with Python.
2021-09-23 13:32:31 +02:00
Håkon Hægland
7a394df43f Include <stdexcept> header to use std::logic_error()
And some minor stylistic changes.
2021-09-23 13:13:23 +02:00
Håkon Hægland
4c5245196b Changed calling convention for shared pointers.
Expect non-reference type shared pointers arguments instead of references
to shared pointer. This will make it clear to the caller that the called
function is making a copy of the pointer for its own use and not trying
to modify the original pointer of the caller.
2021-09-22 23:49:13 +02:00
Joakim Hove
f581208fa0 Load Action state from restart file 2021-09-22 12:43:10 +02:00
Joakim Hove
a11e3222bd
Merge pull request #3534 from joakim-hove/use-single-well-state
Use single well state
2021-09-22 12:35:15 +02:00
Tor Harald Sandve
b294ea5d8b
Merge pull request #3490 from totto82/targUpdate
Update well rates from target during well/group control update
2021-09-22 12:26:29 +02:00
Tor Harald Sandve
a18e3f4136
Merge pull request #3541 from totto82/updateGPmaint
update gpmain before not after timestep
2021-09-22 10:42:11 +02:00
Håkon Hægland
5ad65c70ee Initialize blackoil simulator from schedule shared with Python.
Adds a new constructor to Main.hpp that takes shared pointers to Deck,
EclipseState, Schedule, and SummaryConfig. This makes it possible to
share these variables with Python without worrying about lifetime issues
of the underlying C++ objects. For example, a Python script can first
create an opm.io.schedule.Schedule object which is modified from Python.
Then, assume the same Python script creates an
opm.simulators.BlackOilSimulator which is initialized with the same
schedule object. Since the underlying C++ object is a shared pointer,
the Schedule object in Python may go out of scope (get deleted by Python)
without having the C++ schedule object being deleted. And the Python
BlackOilSimulator may continue to be used after the Python Schedule object
has been deleted since it still has a valid C++ schedule object.
2021-09-21 15:52:59 +02:00
Tor Harald Sandve
2f86231b8d
Merge pull request #3531 from totto82/aquctAndCo2Store
support aquct and co2store
2021-09-21 14:17:58 +02:00
Tor Harald Sandve
eb4997a011 update gpmain before not after timestep 2021-09-21 14:03:35 +02:00
Joakim Hove
b2ac3eaa59
Merge pull request #3535 from totto82/storePrevWellTestState
add well_test_state to WGState
2021-09-21 11:44:58 +02:00
Joakim Hove
30bd1d6314
Merge pull request #3537 from totto82/openWellWtest
update status after WTEST
2021-09-21 11:42:22 +02:00
Tor Harald Sandve
50cf80910b support aquct and co2store 2021-09-21 11:08:10 +02:00
Tor Harald Sandve
cebe557b15
Merge pull request #3536 from totto82/scalarMobIPR
use getMobilityScalar in updateIPR
2021-09-21 11:05:50 +02:00
Tor Harald Sandve
a650b529d1 commit WGstate after shut well from outside 2021-09-21 11:05:03 +02:00
Tor Harald Sandve
30592c7593 update status after WTEST 2021-09-21 10:32:56 +02:00
Tor Harald Sandve
21942f0cc2 use getMobilityScalar in updateIPR 2021-09-21 09:50:20 +02:00
Tor Harald Sandve
6fa9c05985 add well_test_state to WGState to be able to access last valid wellTestState 2021-09-21 09:30:02 +02:00
Tor Harald Sandve
c6660f0aa2 only update when control is changed 2021-09-21 08:53:25 +02:00
Tor Harald Sandve
9db6b2b946 handle unoperable wells
set potentials and rates to zero
2021-09-21 08:53:25 +02:00
Tor Harald Sandve
dc4436961f update well rates from target 2021-09-21 08:53:25 +02:00
Joakim Hove
0472bc3bf2 Remove unused argument 2021-09-20 11:45:24 +02:00
Joakim Hove
5531120411 Use SingleWellState argument instead of full WellState 2021-09-20 11:45:24 +02:00
Joakim Hove
357540bfca Create Action::State external to the vanguard 2021-09-19 10:17:58 +02:00