Commit Graph
202 Commits
Author SHA1 Message Date
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
Tor Harald Sandve 288e97dc39 Make a seqential solver for temperature
Use with TEMP
2025-11-21 12:55:26 +01:00
Tor Harald Sandve 8e63489f75 Add energy module type and use it.
This also add an no_temp implementation that can be used by the standard blackoil model
to avoid storing temperature in the fluid state.
2025-10-24 16:05:32 +02:00
David Landa Marban 1fd280c68d Removing trailing spaces and adding eol at eof 2025-10-02 10:22:55 +02:00
Tor Harald Sandve d8a609a538 Merge pull request #6456 from totto82/avoid_osc_status
Add parameter for restricting status oscillations between stop and open
2025-09-22 14:55:52 +02:00
Atgeirr Flø Rasmussen 5b31ef1edd Add subsystem argument to detail profiling macros. 2025-09-22 11:02:50 +02:00
David Landa Marban d3101a9c80 BIOFILM effects for gas-water systems 2025-09-18 11:15:48 +02:00
Tor Harald Sandve ed425f1d3b Add parameter for restricting status oscillations between stop and open
The parameters can improve convergence for cases where wells jums between stop and open

Default is 99 i.e. by default we dont restrict ossiclations

We have two levels of parameters for this
The first is due restict the number in the inner iterations
(This functionality is already in the code)
--max-well-status-switch-in-inner-iter-wells

The second is to restrict the number during a time-step
--max-well-status-switch-iter-wells

The second could lead to wells being shut too early and should be
used more carefully
2025-09-15 15:10:07 +02:00
Tor Harald Sandve c91097ded4 Merge pull request #6338 from totto82/avoidOsc
Reduce osscilations between stop and open
2025-09-03 08:38:43 +02:00
Tor Harald Sandve 5be6b65d28 Reduce osscilations between stop and open
We add a cap on the number of allowed swichtes per local well solve.
The maximum number is given by --max-well-status-switch-in-inner-iter-wells=
Currently defaulted to 99. I.e. we basicly allow for unlimited switching
2025-09-01 09:12:29 +02:00