211 Commits
Author SHA1 Message Date
Bård Skaflestad ad711166a9 Track Per-Region Cumulative Oil Production From Wells
This commit maintains a record of the cumulative produced volume of
oil attributable to each region of each defined region set.  To this
end, we define a special purpose "ConnOPT" region-level summary
variable and update this at the end of each converged time step as
needed.  The variable is defined only if the run requests any of the
*OEW* recovery factor summary vectors.

In that case, we forward the dynamic values to the summary vector
calculation engine in the I/O layer.
2026-08-25 10:33:07 +02:00
Bård Skaflestad 8877e9a801 Merge pull request #7232 from akva2/janitoring_doxy
Janitoring: address doxy warnings
2026-08-12 15:34:28 +02:00
Kai Bao 3edb0d9db4 Take the compositional well status from the schedule
The well state defaulted to OPEN and was only ever shut at runtime by
forceShutWellByName, so a well that the schedule reports as SHUT was
still assembled and flashed. This covers a well that WELSPECS and
COMPDAT have declared but no control keyword has opened yet, and also a
well shut through WCONPROD, WCONINJE or WELOPEN.
2026-08-11 18:06:50 +02:00
Kai Bao 22a88ecb26 Report a compositional well with no control mode
A well can be open without having been given a control mode, e.g. when
WELOPEN opens one before any WCONPROD or WCONINJE record. The state
update asserted on this, which aborts a debug build and is silently
ignored in a release build. Report it the same way the black-oil model
does in WellAssemble instead, so the two agree on the same deck.
2026-08-11 18:06:35 +02:00
Arne Morten Kvarving 1ec58d5634 address doxy warnings 2026-08-10 08:34:42 +02:00
Bård Skaflestad 8914f854f6 Merge pull request #7241 from akva2/janitoring_clang_tidy
Janitoring: quell some clang-tidy warnings
2026-08-07 11:52:26 +02:00
Arne Morten Kvarving 8b78670156 blackoilmodel: do not set a default flux module 2026-08-06 11:36:21 +02:00
Arne Morten Kvarving 05f6583222 multiphasebasemodel: do not set a default flux module 2026-08-06 11:36:21 +02:00
Arne Morten Kvarving f6280f76db avoid implicit signed/unsigned conversions 2026-07-29 08:39:18 +02:00
Kai Bao 6f6a331935 addressing reviewing comments. 2026-07-01 14:11:33 +02:00
Kai Bao 61150b8c33 make CompWellEquations singular-matrix fallback robust for all block sizes
CompWellEquations::invert() replaced a singular well matrix with the identity
only when detail::invertMatrix() threw Opm::NumericalProblem, which happens
just for the 4x4 block (three-component wells). For other sizes a singular
matrix either throws Dune::FMatrixError (generic path) or silently produces
inf/NaN (e.g. the 3x3 path used by two-component wells), so the fallback was
bypassed and the Newton update became NaN. Catch both exception types and
additionally detect a non-finite inverse.

Add tests/test_compwell_equations.cpp covering the Schur-complement
solve/recoverSolutionWell/apply against dense references, plus the singular
fallback for both the 4x4 (throws) and 3x3 (silent inf/NaN) paths.
2026-07-01 13:56:43 +02:00
Kai Bao 917cf6bc16 extract wellbore flash to free functions and add FD Jacobian test
Move the wellbore PT flash and the per-component mass computation out of
CompWell into standalone flashWellboreFluidState()/wellboreComponentMasses()
helpers (CompWellFlash.hpp), removing the duplicated mass loops in
calculateExplicitQuantities()/updateTotalMass(). This makes the
composition/pressure derivatives that flow through the flash unit-testable
without instantiating a Simulator.

Add tests/test_compwell_jacobian.cpp, which checks the AD derivatives of the
component masses, mass fractions and fluid density against central finite
differences. They agree to ~1e-7, confirming the previously-doubted
mass-fraction derivatives are in fact correct.
2026-07-01 13:56:43 +02:00
Kai Bao 2720a270e1 throw when connection's satid
is different from the connection cell's. throw for now, either zero
mobility will be resulted.
2026-07-01 13:56:43 +02:00
Kai Bao 2e2b9bbab3 generalizing the indices when normalizing CompWellPrimaryVariables 2026-07-01 13:56:43 +02:00
Kai Bao 497cd36d4b Split flow_comp into per-component translation units
for parallel builds and bounded per-process memory
2026-06-29 14:35:07 +02:00
Kai Bao 2139629af1 small cleaning up related in compositioal well code 2026-06-27 23:43:00 +02:00
hnil 3b6e763876 fixed review comments 2026-06-23 13:56:25 +02:00
hnilandClaude Fable 5 aac6802a09 Fix formatting of new files
Remove trailing whitespace, add missing end-of-file newlines and add
the standard license header to the new ComponentName files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 10:00:52 +02:00
hnilandClaude Fable 5 4374de70b1 Add serializeOp support for compositional types
The standard-flow main pulls in OPMRST (HDF5) save/load state through
SimulatorFullyImplicit, which requires the whole model and problem to be
serializable. Provide serializeOp for FlashPrimaryVariables (plain
FieldVector contents) and empty implementations for EmptyModel and
CompWellModel, where restart support is not implemented yet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 20:08:03 +02:00
hnil f53f1c7198 Add standard-flow compositional support 2026-06-11 20:08:03 +02:00
Arne Morten Kvarving b5c3f93df6 BlackOilEnergyModule: only include where needed 2026-06-05 15:34:09 +02:00
Arne Morten Kvarving fde3f7f07a BlackOilSolventModule: only include where needed 2026-06-05 13:15:15 +02:00
Arne Morten Kvarving f76738b708 BlackOilPolymerModule: only include where needed 2026-06-05 09:57:55 +02:00
Arne Morten Kvarving fd3a22c73d Merge pull request #7134 from akva2/foam_only_where_needed
BlackOilFoamModule: only include where needed
2026-06-04 19:12:54 +02:00
Arne Morten Kvarving e627bab73f BlackOilFoamModule: only include where needed 2026-06-04 16:32:27 +02:00
Atgeirr Flø Rasmussen 79d112b46d Merge pull request #7123 from SoilRos/feature/cleanup-bcrsmatrix
Clean up BCRSMatrix utilities
2026-06-04 16:30:14 +02:00
Arne Morten Kvarving a5d903cea2 BlackOilExtboModule: only include where needed 2026-06-04 14:29:32 +02:00
Arne Morten Kvarving a22d0f84c7 BlackOilDiffusionModule: only include where needed 2026-06-04 10:06:54 +02:00
Santiago Ospina De Los Ríos 3bdde0d041 Set matrix build mode before setting its size
This is so that the new dune matrix work as expected: it requires to set the build mode each time a matrix is built and the sizes must be specified after setting the build mode. This is compatible with the current BCRSMatrix.
2026-06-03 12:01:59 +02:00
Santiago Ospina De Los Ríos 524e37a534 Cleanup sparse matrix iteration patterns
Improves readability and consistency of sparse matrix element access. This is as a preparation work for a new matrix from dune-istl.
* Use begin and end creator iterators accounting that they may be different types.
* Use iterator arithmetic instead of row implementation details.
* Use sparseRange idiom to loop over the row sparsity pattern.
* Avoid taking mutable references of rows, given that a matrix may return proxy objects.
* Do not assign an non-zero numeric value to the jacobian during its pattern creation.
* Include missing header for block vectors
2026-06-03 12:01:59 +02:00
Arne Morten Kvarving 8f580a9e46 blackoilbrinemodules.hh: only include where needed 2026-06-02 15:27:42 +02:00
Arne Morten Kvarving b1ec5521a0 BlackOilBioeffectsModule: only include where needed 2026-06-02 14:40:14 +02:00
Arne Morten Kvarving 477c3486c9 extbo: only call code when enabled
remove dummy functions in the "disabled" implementation
2026-06-02 12:39:21 +02:00
Arne Morten Kvarving 042c9ca0e0 flowexp_comp: add explicit cast to avoid implicit narrowing 2026-05-28 11:46:28 +02:00
Håkon Hægland 76ee2260fb Pass iteration context into BlackoilWellModelGeneric
Store a reference to the simulator's NewtonIterationContext in the
generic well model base class, and expose it through a new
iterationContext() accessor on the base.

The address of the iteration context is stable for the lifetime of
the simulator (it lives as a member of the problem object), and it
is mutated in-place during NLDD local solves, so a stored reference
correctly observes both global and local-solve state.

Drop the now-redundant iterCtx parameter from three method
signatures:

  - BlackoilWellModelGeneric::updateAndCommunicateGroupData
  - BlackoilWellModelNetworkGeneric::shouldBalance
  - BlackoilWellModelNetworkGeneric::willBalanceOnNextIteration

The implementations read iter_ctx_ directly (or, for the network
class, via well_model_.iterationContext()). On the caller side,
several local `simulator_.problem().iterationContext()` lookups
become unused after the parameter drops and are removed.
2026-05-21 17:03:15 +02:00
Kai Bao ca710acd5c extending the allowing component number to be 10 2026-05-20 09:56:00 +02:00
Kjetil Olsen Lye b2ca7e8769 GPU portability: OPM_HOST_DEVICE/OPM_THROW additions and fluidSystem() use
Decorates inline helpers in blackoil*modules.hh, blackoilprimaryvariables.hh,
directionalmobility.hh, tpfalinearizer.hh, NewTranFluxModule.hpp,
TemperatureModel.hpp and BlackOilEnergyIntensiveQuantitiesGlobalIndex.hpp
with OPM_HOST_DEVICE, replaces a few raw `throw`s with OPM_THROW, and
switches static `FluidSystem::` accesses to instance-based
`fluidState.fluidSystem()` / `getFluidSystem()` so the same code works
when the fluid system lives on the device.  Test
test_gpu_linear_two_phase_material.cu picks up the matching template
adjustments.
2026-05-05 07:55:21 +02:00
David Landa Marban d59ddcfbca Fixing a couple of warnings 2026-03-31 13:56:01 +02:00
Kai Bao 07b45cd26f using the solvent related from BlackOilFluidState 2026-03-17 11:10:16 +01:00
Atgeirr Flø Rasmussen 842e7fc751 Restore old behaviour for relaxation in wells. 2026-03-13 10:05:02 +01:00
Atgeirr Flø Rasmussen aecdf722ac Merge pull request #6880 from jakobtorben/refactor_logic_based_on_iteration_index
Introduce NewtonIterationContext and refactor logic based on iteration index
2026-02-27 15:03:04 +01:00
Jakob Torben 61113726d8 Refactor logic based on iteration index 2026-02-26 17:35:14 +01:00
Kai Bao 125eb0b4b2 correcting typo Surfance -> Surface 2026-02-26 14:12:21 +01:00
Arne Morten Kvarving f00ab30268 replace std::fill with std::ranges::fill where appropriate
the c++-20 constrained algorithm is safer and code is more readable
2026-02-23 10:23:45 +01:00
Tor Harald Sandve 26d5a3497f Speedup the temperature module
- Use its own fluidstate and Evaluation class to avoid having to add an extra derivative to the main equations
- Sotre the scaling factor to avoid calling the parameter all the time
2026-02-18 11:31:27 +01:00
Atgeirr Flø Rasmussen 7d6feee0d9 Merge pull request #6676 from multitalentloes/make_newtranfluxmodule_gpu_friendly
make more files gpu-compatible
2026-02-18 08:47:36 +01:00
Tobias Meyer Andersen 61608c1ff7 simplify code 2026-02-17 13:33:45 +01:00
Arne Morten Kvarving c4c81bb55e quell signed/unsigned comparison warning 2026-02-17 10:55:59 +01:00
David Landa Marban 71c48581c6 Fix warnings for builds with -DWITH_NDEBUG=1 2026-01-08 10:42:49 +01:00
Tobias Meyer Andersen c53730d6b0 make compileable with main branch 2025-12-11 10:49:53 +01:00