Commit Graph

8939 Commits

Author SHA1 Message Date
Markus Blatt
ec56782288
Merge pull request #3690 from akva2/wellcontrib_cleanups
Some simple cleanup in BDA WellContributions
2021-11-15 10:18:12 +01:00
Tor Harald Sandve
ae5a1df29c
Merge pull request #3638 from blattms/exclude-pv-aquifer-cnv
Exclude pv of numerical aquifer cells in ratio of cells violating CNV
2021-11-12 13:27:58 +01:00
Arne Morten Kvarving
e25caba8ed changed: refactor BDA well contributions
split in API specific classes for Cuda/OpenCL

this to
1) it's cleaner
2) it avoids pulling in openCL code in cuda classes which leads
to clashes between nvidia headers and opencl.hpp

there is still too much API specific things in interface between the
bda components to work through a virtual interface so we still have to cast
to the relevant implementation in various places.
2021-11-11 14:49:33 +01:00
Arne Morten Kvarving
352d31a1e9 BdaBridge: avoid FPGA include in header
already includ in the cpp file where it is required.
2021-11-11 13:39:46 +01:00
Arne Morten Kvarving
7fb39f8308 BdaBridge: avoid includes in header 2021-11-11 13:39:25 +01:00
Arne Morten Kvarving
be6c857b16 bda: use forwarding for WellContributions 2021-11-11 13:29:12 +01:00
Arne Morten Kvarving
4a1fb0b86a use std::vector for val_pointers 2021-11-11 13:15:29 +01:00
Arne Morten Kvarving
2b0508af8b changed: use unique_ptr for MultisegmentWellContributions
less manual pointer management is always good
2021-11-11 13:15:29 +01:00
Tor Harald Sandve
ef439cd6d6
Merge pull request #3678 from totto82/fixGasliftX2
Fix gasslift reduction when under LRAT, GRAT or WRAT
2021-11-11 13:11:31 +01:00
Arne Morten Kvarving
5bfac05827
Merge pull request #3688 from blattms/fix-wellcontrib-without-opencl
Fixes compilation of WellContributions with deactivated OpenCL.
2021-11-11 11:59:45 +01:00
Markus Blatt
c54e85a8eb Fixes compilation of WellContributions with deactivated OpenCL.
OpenCL header was included and OpenclKernels used unconditionally
in WellContributions.cpp. As this file is compiled if CUDA is found,
too it lead to undefined references for e.g. cl::CommandQueue if
opencl headers were there and compile error if not.
2021-11-10 19:41:59 +01:00
Arne Morten Kvarving
dc136746df cosmetics: do not indent for namespace
also avoid an unnecessary close/open for namespace Opm
2021-11-10 14:24:51 +01:00
Tor Harald Sandve
cd9e742ad5 remove assert and handle opposite rates in wecon 2021-11-10 13:14:22 +01:00
Bård Skaflestad
2bd5b30cda
Merge pull request #3681 from akva2/vexcl_no_auto_func_param
fixed: auto function parameters requires the concept-ts
2021-11-10 11:19:30 +01:00
Bård Skaflestad
fd743de749
Merge pull request #3680 from akva2/use_runstatic
Use Main::runStatic in PyBlackoilSimulator
2021-11-10 11:14:05 +01:00
Arne Morten Kvarving
24e252f46d fix serial build after PR #3675
annoyingly, dune has a casting operator for mpicollectivecommunication
-> MPIComm but for some reason does not have a casting operator for
the dummy collectivecommunication -> No_Comm
2021-11-10 10:41:24 +01:00
Arne Morten Kvarving
f27931c2e2 fixed: auto function parameters requires the concept-ts
use a regular template parameter instead
2021-11-10 10:25:27 +01:00
Bård Skaflestad
6f0b06715e
Merge pull request #3676 from akva2/use_single_sum_call
GasLiftGroupInfo: use a array to allow for one sum call
2021-11-10 10:16:39 +01:00
Arne Morten Kvarving
7f7fbab2f4 remove FLOW_BLACKOIL_ONLY hack from Main.hpp
now that the python simulator uses runStatic, the
runDynamic template is never instanced, and thus there
are no linker issues.
2021-11-10 10:07:11 +01:00
Arne Morten Kvarving
7bce64cde9 use multi-var broadcast for rates 2021-11-10 08:56:04 +01:00
Arne Morten Kvarving
09f61e0e6f WellGroupHelpers: use an array to allow for one sum call 2021-11-10 08:50:39 +01:00
Arne Morten Kvarving
04ed31f800 GasLiftGroupInfo: use an array to allow for one sum call 2021-11-10 08:48:33 +01:00
Arne Morten Kvarving
e67bae5453 fix: serial build after PR #3671 2021-11-09 15:57:24 +01:00
Bård Skaflestad
676cdb8307
Merge pull request #3674 from akva2/broadcast_variadic
added: utility to broadcast multiple variables in one operation
2021-11-09 14:51:23 +01:00
Joakim Hove
c97447892e
Merge pull request #3671 from joakim-hove/broadcast-mult-update
Broadcast mult update
2021-11-09 14:50:11 +01:00
Joakim Hove
06e71f1345 Broadcast updated transmissibility after runtime updates of MULT? 2021-11-09 14:22:19 +01:00
Joakim Hove
5f4efbde73 broadcast<T> with Schedule and TransMult specialization 2021-11-09 14:22:19 +01:00
Tor Harald Sandve
a765ab213b fix WRAT GRAT reduction 2021-11-09 13:40:55 +01:00
Bård Skaflestad
c563f14aff
Merge pull request #3673 from totto82/fixGasliftX
Add check for group production control for LRAT and WRAT in the gasslift code
2021-11-09 13:32:02 +01:00
Arne Morten Kvarving
2120cbf043 added: utility to broadcast multiple variables in one operation 2021-11-09 13:02:05 +01:00
Tor Harald Sandve
7728df33bb Fix LRAT reduction 2021-11-09 10:45:10 +01:00
Tor Harald Sandve
d2fd5505ca Check group production LRAT and WRAT targets 2021-11-09 08:24:57 +01:00
Tor Harald Sandve
23225d24e5 Fix bug in runOptimize1_ 2021-11-09 08:21:42 +01:00
Markus Blatt
ad44564f27
Merge pull request #3619 from Tongdongq/opencl-refactor
Opencl refactor
2021-11-08 16:45:57 +01:00
Bård Skaflestad
40fdb9e1d6 Mark GRAVITY Keyword as Supported in the Simulator
The input layer now converts this input to DENSITY data.
2021-11-07 22:34:31 +01:00
Atgeirr Flø Rasmussen
84392a25b4
Merge pull request #3648 from joakim-hove/phase-usage-constructor
Create PhaseUsage constructor
2021-11-05 15:35:50 +01:00
Joakim Hove
34260544eb
Merge pull request #3647 from joakim-hove/update-rates-after-actionx
Update rates after actionx
2021-11-05 12:01:22 +01:00
Joakim Hove
fd5640774b Call SingleWellState::update_targets for ACTIONX affected wells 2021-11-05 09:48:27 +01:00
Bård Skaflestad
07d6de3bbc Switch to Passing VFP Wrapper Tables as References
We don't need to copy those mapping tables on each call.
2021-11-04 21:28:55 +01:00
Tong Dong Qiu
803a2ac2f4 Allow CMake to set CHOW_PATEL variables 2021-11-04 15:47:33 +01:00
Tong Dong Qiu
920eeee426 Rename namespace bda to Opm::Accelerator 2021-11-04 15:47:33 +01:00
Tong Dong Qiu
b945502a82 Minor improvements 2021-11-04 15:45:33 +01:00
Tong Dong Qiu
78b1714481 Move apply_stdwells kernels to OpenclKernels 2021-11-04 14:25:39 +01:00
Tong Dong Qiu
1583292bf4 Move opencl kernels to static class 2021-11-04 14:25:22 +01:00
Tong Dong Qiu
b8587daaa7 Move ChowPatel decomposition to appropriate file 2021-11-04 13:58:06 +01:00
Bård Skaflestad
869de90b56
Merge pull request #3663 from blattms/remove-warn-opencl
Fixes warning about catching polymorphic type by value.
2021-11-03 18:30:57 +01:00
Markus Blatt
02bbe995c3 Fixes warning about catching polymorphic type by value.
Removed message in amgclbackend was:
warning: catching polymorphic type ‘class
boost::property_tree::json_parser::json_parser_error’ by value
[-Wcatch-value=]
2021-11-03 18:07:56 +01:00
Tor Harald Sandve
f755cc3be1
Merge pull request #3645 from totto82/fixNoWellReduction
Adjust reduction rate when well control is considered for GRUP
2021-11-03 15:32:18 +01:00
Bård Skaflestad
2971a3f051
Merge pull request #3659 from joakim-hove/refactor-wellstate-init
Refactor wellstate init
2021-11-03 13:16:34 +01:00
Joakim Hove
44ad5ab190 Remove superfluos is injector or producer test 2021-11-03 12:35:28 +01:00
Joakim Hove
05317e1d72 Extract functionality to update target rates to SingleWellState 2021-11-03 12:30:40 +01:00
Joakim Hove
5a986ee430 Move updateStatus functionality to SingleWellState 2021-11-03 12:30:40 +01:00
Joakim Hove
53dba36513 Move resetConnectionFactor to SingleWellState 2021-11-03 12:30:40 +01:00
Tor Harald Sandve
a57374fae9 Adjust reduction rate when well control is considered for GRUP
The reduction rate is computed differently for cases without wells under GRUP
For a well to check whether to switch to GRUP it needed to use the reduction rate
that would have been computed if this particular well was under GRUP control
and thus recompute the reduction rate without entering the no-grup path
2021-11-03 11:42:18 +01:00
Bård Skaflestad
1e34d714bf Report Well Level Production Guide Rates if Group Controlled
This commit extends the guide rate reporting to always extracting
and reporting pertinent production guide rates at the well level
(i.e., WxPGR) if at least one of the groups in the well's upline has
an entry in GCONPROD.  This is for increased compatibility with
ECLIPSE.
2021-11-02 16:19:56 +01:00
Bård Skaflestad
0c70eac490 Report Well Level Injection Guide Rates if Group Controlled
This commit uses the new GroupTreeWalker helper class to ensure that
we always extract and report pertinent injection guide rates at the
well level (i.e., WxIGR) if at least one of the groups in the well's
upline has an entry for the corresponding phase in GCONINJE.  This
is for increased compatibility with ECLIPSE.

Prior to this change we would report zero-valued WWIGR vectors on a
real field case which made analysing simulation results needlessly
difficult.
2021-11-02 16:19:56 +01:00
Bård Skaflestad
2b0aa379f5 Extract Group Tree Walk to Helper Class
This commit extracts a helper class, GroupTreeWalker, from the
current implementation of 'calculateAllGroupGuiderates()'.  This is
in preparation of adding a similar approach to extracting WxIGR for
all wells for which at least one group in the upline has an entry in
GCONINJE.

The user can add visitor operations for wells and groups, typically
with side effects, and then choose whether to run a pre-order walk
(visit groups before their children) or a post-order walk (visit
children-i.e., wells, before their parents).
2021-11-02 16:19:56 +01:00
Atgeirr Flø Rasmussen
5503e6ca06 Remove ISTLSolverEbosFlexible and flow_blackoil_dunecpr.
The class ISTLSolverEbos has all features of the removed class, and
is not much more complex. The flow_blackoil_dunecpr is the only
program using it, and is redundant.
2021-11-02 15:02:48 +01:00
Markus Blatt
932ddcd32d
Merge pull request #3652 from akva2/use_opencl_hpp
changed: probe for cl/opencl.hpp and use if found
2021-11-02 09:31:05 +01:00
Arne Morten Kvarving
7de50b94c7 changed: probe for cl/opencl.hpp and use if found
this to avoid a spam of warnings
2021-11-01 19:41:05 +01:00
Joakim Hove
101b277bfe
Merge pull request #3642 from joakim-hove/remove-groupstate-dump
Remove debugging aid GroupState::dump
2021-11-01 17:51:32 +01:00
Joakim Hove
5336822242 Remove unused utility class PhasePresence 2021-11-01 17:06:50 +01:00
Joakim Hove
bcdc974585 Create PhaseUsage constructor 2021-11-01 17:04:42 +01:00
Joakim Hove
ec780676e2 Split initSinglewell for producer and injector 2021-11-01 16:02:34 +01:00
Joakim Hove
d213bc9d78 Initialize static perforation data in SingleWellState constructor 2021-11-01 16:02:34 +01:00
Joakim Hove
6c16b5dbb8 Move variable to local scope 2021-11-01 16:02:34 +01:00
Joakim Hove
93218b05c2 Use multiple returns in init single well 2021-11-01 16:02:34 +01:00
Joakim Hove
2527970d11 Replace two assert() with one throw 2021-11-01 16:02:34 +01:00
Joakim Hove
029d1794f8 Remove local variable 2021-11-01 16:02:34 +01:00
Joakim Hove
807ac101d8 Add name member to SingleWellState 2021-11-01 16:02:34 +01:00
Joakim Hove
03cf7b0327 Move updateStatus functionality to SingleWellState 2021-11-01 16:02:31 +01:00
Atgeirr Flø Rasmussen
624d8b1343
Merge pull request #3651 from akva2/remove_gcc7_compat
use std::filesystem directly
2021-11-01 15:30:03 +01:00
Joakim Hove
129288b2bd Add operator[] to WellState 2021-11-01 13:47:40 +01:00
Joakim Hove
ab63d14bcd Remove debugging aid GroupState::dump 2021-11-01 13:47:36 +01:00
Joakim Hove
d150f400fe Move code from WellState to SingleWellState 2021-11-01 13:23:17 +01:00
Atgeirr Flø Rasmussen
5f81b77d14
Merge pull request #3639 from blattms/dune-fem-master
Fixes compilation with dune-fem 2.8
2021-11-01 13:10:17 +01:00
Arne Morten Kvarving
06bd25575f use std::filesystem directly 2021-11-01 12:31:58 +01:00
Atgeirr Flø Rasmussen
fa3b619ec9
Merge pull request #3644 from blattms/use-cl2.hpp
[enhancement][opencl} Use cl2.hpp instead of cl.hpp (missing on bullseye)
2021-11-01 10:10:30 +01:00
Bård Skaflestad
767b5ca58b Switch Guide Rate Accumulation to Post-Order Traversal
This guarantees, under the assumption that the group tree does not
have cycles, that we do not accumulate group-level guide rate values
until all of its children are fully evaluated.  We use an iterative
depth-first post-order tree traversal with an explicit stack instead
of a recursive implementation.

The previous implementation, which tried to do the same kind of
child-to-parent accumulation, might visit a parent group multiple
times which in turn might lead to losing updates.  This is a more
formalised approach to the value accumulation than was originally
employed.
2021-10-29 21:21:49 +02:00
Bård Skaflestad
f212c946c7 Separate MICP Case Out to Helper Function
In keeping with the other simulation cases.
2021-10-29 16:15:44 +02:00
Atgeirr Flø Rasmussen
fe8df97266
Merge pull request #3637 from akva2/fix_mpiabort_no_input_case
changed: special case no input deck given handling
2021-10-29 15:35:35 +02:00
Atgeirr Flø Rasmussen
2a7a9d46ce
Merge pull request #3640 from totto82/inj_comm
communicate inj_resv/surface_rates
2021-10-29 15:35:24 +02:00
Atgeirr Flø Rasmussen
b4fe98b739
Merge pull request #3636 from joakim-hove/mark-as-supported-diffuse-diffc-gpmaint
Mark keywords DIFFC, DIFFUSE and GPMAINT as supported
2021-10-29 12:25:00 +02:00
Arne Morten Kvarving
a056aa858a changed: special case no input deck given handling
we do not want to invoke MPI_Abort in this case
2021-10-29 12:16:01 +02:00
Markus Blatt
9197ee3e20 Prevent deprecation warning about cl2.hpp: __CL_ENABLE_EXCEPTIONS. 2021-10-28 17:09:22 +02:00
Markus Blatt
4de52a8d30 Use OpenCl's CL/cl2.hpp instead of CL/cl.hpp
We still request Standard version 1.2 only.
We need to use KernelFunctor instead of make_kernel.
In addition cl::Sources now works on std::string and
does not support std::pair<const char*, in> anymore.
2021-10-28 16:42:43 +02:00
Tor Harald Sandve
b9f16018ac remove unused inj_potentials 2021-10-28 14:17:33 +02:00
Tor Harald Sandve
93c7ba6b92 communicate inj_surface_rates 2021-10-28 08:55:50 +02:00
Joakim Hove
5a54bb0728
Merge pull request #3634 from alfbr/error-message
Do not print confusing message to terminal.
2021-10-27 11:21:09 +02:00
Markus Blatt
a1e90be2aa Use grid view from simulator for element mapper.
With dune-fem the type of the grid view is
Dune::Fem::AdaptiveLeafGridPart and not the LeafGridView
of the grid. The old approach therefore did not compile
as we passed the wrong view.
2021-10-26 21:55:04 +02:00
Markus Blatt
85b5a60270 [bugfix] Exclude pv of numerical aquifer cells for CNV violation.
In some models there will be only a few cells with rather high pore volume representing the numerical aquifer. Including them (as non-violated cells) in the ratio will make the ratio lower than without the aquifer there and might lead to accepting vectors as converged when they should not.
2021-10-26 12:01:46 +02:00
Joakim Hove
a79fd67104 Mark keywords DIFFC, DIFFUSE and GPMAINT as supported 2021-10-26 07:42:14 +02:00
Bård Skaflestad
3cfec109db
Merge pull request #3620 from blattms/removeSetupCart-rebased
[refactor] Remove cartesianToCompressed Mapping from well model
2021-10-25 16:43:08 +02:00
Alf Birger Rustad
a10387fcec Do not print confusing message to terminal. 2021-10-25 15:35:30 +02:00
Markus Blatt
fa9e93529b Only consider perforation in the interior of the local grid.
This is needed for distributed wells to save most of the code
from checking whether a perforation is in the interior.

We add new methods compressedIndexForInterior that return -1
for non-interior cells and use that for the wells. This restores
the old behaviour before 1cfe3e0aad
2021-10-19 16:50:42 +02:00
Bård Skaflestad
67f4cf62f1 Report Group Level Injection Guide Rates if Present
We used to tie reporting these quantities to whether or not a group
had any guide rates for production (GuideRate::has()), but this is
clearly insufficient for injection guide rates.
2021-10-19 14:15:36 +02:00
Bård Skaflestad
a7c6203a73 Initialise Guide Rate Object From Restart File
This commit adds an overload set named

    loadRestartGuideRates

which, collectively, initialises the contained GuideRate object
using guide rate values from the restart file.  This is necessary,
but not quite sufficient, to restart models in prediction mode with
group-level constraints.
2021-10-19 13:22:31 +02:00
Bård Skaflestad
8014442a1d Split Restart File Loading Into Multiple Stages
Mostly for readability in preparation of initialising the guide rate
object with values from the restart file.  The new stages, each with
its own 'loadRestart*Data()' member function are

  - Connection
  - Segment
  - Well
  - Group

While here, also switch to using std::any_of() in place of a raw
loop.
2021-10-19 13:22:31 +02:00
Bård Skaflestad
37f589bff1
Merge pull request #3598 from bska/report-siunits-injgr-grouplevel
Report Group Level Inject Guiderate Values in Strict SI Units
2021-10-19 13:20:58 +02:00
Markus Blatt
23e0b06387 Allow communicators other than MPI_COMM_WORLD. 2021-10-19 12:44:41 +02:00
Bård Skaflestad
89adc1919b
Merge pull request #3611 from joakim-hove/broadcast-wtest-state
Broadcast wtest state
2021-10-19 12:01:17 +02:00
Joakim Hove
695254fc7c Broadcast WellTestState after initialization 2021-10-19 11:16:41 +02:00
Joakim Hove
daabe1ca76 Make sure WellTestState is initialized also on non IO rank 2021-10-19 11:16:41 +02:00
Joakim Hove
9a9ccb90b8 Make sure to filter out wells from other processes in WellTestState 2021-10-19 11:16:41 +02:00
Joakim Hove
c8cbd32f85 Add method WellContainer<T>::wells() 2021-10-19 11:16:41 +02:00
Tor Harald Sandve
1cfe3e0aad remove cartesian to compressed vector 2021-10-19 11:03:46 +02:00
Bård Skaflestad
1d0ee3c005 Report Group Level Inject Guiderate Values in Strict SI Units
The output layer expects its input values to be strictly SI, but we
know that the GuideRate container's values are in output units.

Forgotten in PR #3467 (commit 517db198f8).
2021-10-19 09:32:38 +02:00
Tor Harald Sandve
5717a95cb4
Merge pull request #3607 from totto82/operHist
Check operabiliy for wells under history
2021-10-19 09:03:34 +02:00
Joakim Hove
56c7c74016 Handle NEXTSTEP behavior in time stepper 2021-10-18 11:52:33 +02:00
Tor Harald Sandve
160c80b574 check operability history wells 2021-10-18 09:21:04 +02:00
Tor Harald Sandve
d925e74b76
Merge pull request #3569 from totto82/operInj
check operability injectors
2021-10-18 08:50:50 +02:00
Tor Harald Sandve
350875e7c5
Merge pull request #3583 from totto82/brinethermal
brine+thermal
2021-10-15 14:41:26 +02:00
Atgeirr Flø Rasmussen
fc80451e3d Silence unused argument warning. 2021-10-15 13:26:44 +02:00
Atgeirr Flø Rasmussen
4c213b25e0 Order of initialization should match order of definition. 2021-10-15 13:24:55 +02:00
Tor Harald Sandve
1c9c5c484b check operability injectors 2021-10-15 12:32:02 +02:00
Tor Harald Sandve
f6f5badfde Add brine and thermal simulator 2021-10-15 11:50:17 +02:00
Tor Harald Sandve
70c9d2e237
Merge pull request #3590 from daavid00/micp-2021-10
micp
2021-10-14 22:28:28 +02:00
daavid00
48b175904a first version of micp implementation in flow 2021-10-14 17:44:57 +02:00
Atgeirr Flø Rasmussen
5e1853b8e4
Merge pull request #3588 from totto82/improve_switch_output
make multiple well control switching output more readable
2021-10-14 10:56:53 +02:00
Tor Harald Sandve
83ef3730b2 make multiple well control switching output more readable 2021-10-14 09:40:34 +02:00
Atgeirr Flø Rasmussen
dead95ba18
Merge pull request #3519 from totto82/continueOnConvergenceFailure
Option for continue on solver convergence failure
2021-10-14 09:31:23 +02:00
Joakim Hove
4b85fc74ae
Merge pull request #3594 from joakim-hove/wtest-rst
load WellTestState from restart file
2021-10-13 11:27:41 +02:00
Arne Morten Kvarving
8eb63409cb fixed: double call to MPI_Finalize
I missed this one when moving the MPI handling into RAII style
2021-10-13 09:35:16 +02:00
Joakim Hove
2c68f12769 Load WellTestState from restart file 2021-10-13 08:46:48 +02:00
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
Bård Skaflestad
a8078ed695
Merge pull request #3528 from blattms/parallel-throw-untabulated
bugfix: Detect exception during beginReportStep in parallel & abort
2021-09-15 22:41:04 +02:00
Bård Skaflestad
90520f248f
Merge pull request #3527 from totto82/fixNupcol
pass updated well rates totarget reduction not the nupcol ones
2021-09-15 21:44:14 +02:00
Markus Blatt
b056557f57 bugfix: Detect exception during beginReportStep in parallel a. abort
Previously, exceptions happening at this stage have deadlocked
flow. E.g.  UniformTabulated2DFunction in opm-material throws
a NumericalIssue if the values passed are outside the tabulated
reason. This function is e.g. called in 2-phase CO2-storage cases
during BlackoilModel::initializeWellState

BTW: This is only the first step as it is not very user friendly that
a simulation aborts at this (late) stage.
2021-09-15 20:50:49 +02:00
Tor Harald Sandve
bd066d9300
Merge pull request #3524 from totto82/speedUpPot
Do not iterate inside computeBhpFromThp in MSW
2021-09-15 12:44:52 +02:00
Tor Harald Sandve
dd454063d4 pass updated well rates totarget reduction not the nupcol ones + cleanup 2021-09-15 09:47:31 +02:00
Tor Harald Sandve
8e9a43c29b
Merge pull request #3512 from totto82/relaxStw
add option for relaxed convergence for stw
2021-09-15 07:56:12 +02:00
Bård Skaflestad
1dc9cf755e
Merge pull request #3492 from blattms/dune-2.8
Fixes and removes deprecation warnings for Dune 2.8
2021-09-14 21:11:25 +02:00
Tor Harald Sandve
81d9a8c178 add option for relaxed convergence for stw 2021-09-14 14:32:14 +02:00
Tor Harald Sandve
49dfe1006f cleanup 2021-09-13 15:11:38 +02:00
Tor Harald Sandve
43a858ef25 rename computeBhpFromThpPotential to computeBhpFromThpIterations in std wells 2021-09-13 14:07:21 +02:00
Tor Harald Sandve
c8a59946e3 avoid iter in computeBhpFromThp 2021-09-13 14:01:56 +02:00
Tor Harald Sandve
a799c6fc8c
Merge pull request #3522 from totto82/scalarPerfRate
make scalar version of computePerfRate for MSW
2021-09-13 13:39:47 +02:00
Markus Blatt
c84b55c452 Fixes ILU for Dune 2.8
We got compile errors like:

/home/build/opm-simulators/opm/simulators/linalg/FlexibleSolver1.cpp:24:1:   required from here
/usr/include/dune/istl/ilu.hh:140:29: error: 'double' is not a class, struct, or union type

without this patch.
Hence we use the new internal ILU functions if available.
2021-09-13 12:25:49 +02:00
Tor Harald Sandve
bc1bc90504
Merge pull request #3520 from totto82/fixAssertGaslift
oil target may be limited by LRAT as well
2021-09-13 11:32:43 +02:00
Tor Harald Sandve
09cf878649
Merge pull request #3521 from totto82/avoidAvg
only compute fip avg pressure when gpmaint
2021-09-13 11:32:24 +02:00
Tor Harald Sandve
972a832d65 make scalar version of computePerfRate 2021-09-13 09:36:16 +02:00
Joakim Hove
53755bcfa6
Merge pull request #3515 from joakim-hove/add-parser-argument
Add Parser argument to restart loader
2021-09-10 16:27:56 +02:00
Tor Harald Sandve
f203c2106e only compute fip avg pressure when gpmaint 2021-09-10 15:49:02 +02:00
Tor Harald Sandve
a550400fa0 Continue on solver convergence failure 2021-09-10 13:49:20 +02:00
Tor Harald Sandve
305de4016e oil target may be limited by LRAT as well 2021-09-10 13:19:07 +02:00
Bård Skaflestad
e866f1f705
Merge pull request #3516 from akva2/drop_using_statements
Drop using statements
2021-09-09 16:00:24 +02:00
Joakim Hove
eeab23ebab Add Parser argument to restart loader 2021-09-09 15:08:14 +02:00
Atgeirr Flø Rasmussen
d1bfd48b6e Add missing include for unordered_map. 2021-09-09 12:17:54 +02:00
Arne Morten Kvarving
ce4028b2f0 drop using statement for getAllowCrossFlow
rather qualify member function calls with this->
2021-09-09 11:53:48 +02:00
Arne Morten Kvarving
7609f7e1f7 drop using statement for ebosCompIdxToFlowCompIdx
rather qualify member function calls with this->
2021-09-09 11:53:35 +02:00
Arne Morten Kvarving
36cec80269 drop using statement for flowPhaseToEbosPhaseIdx
rather qualify member function calls with this->
2021-09-09 11:53:35 +02:00