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.
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.
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.
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.
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.
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>
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>
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.
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
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.
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.
- 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