This commit introduces a set of consistency checks for the oil phase
saturation functions. These plug into the framework introduced in
commit c3939c544 (PR #5438). We implement the following four checks
for the gas/oil two-phase system
- 0 <= SOGCR < 1
- SWL + SGU <= 1
- SOGCR < 1 - SWL - SGL
- SOGCR < 1 - SWL - SGCR
which all guarantee a non-negative (mobile) oil saturation in the
gas/oil system. Similarly, we implement the following four checks
for the oil/water two-phase system
- 0 <= SOWCR < 1
- SGL + SWU <= 1
- SOWCR < 1 - SWL - SGL
- SOWCR < 1 - SWCR - SGL
which provide the same guarantees as outlined above, but for the
oil/water system.
We add a base class, PhaseCheckBase<Scalar>, which provides a common
representation of the violated/critical predicates and implement the
specific checks as derived types of this base class.
This commit switches the parallel implemenation of function
Opm::gatherConvergenceReport() into using the general serialisation
framework (classes Opm::Serializer<> and Opm::Mpi::Packer). In
particular, we add serializeOp() functions to each of the types
- ConvergenceReport
- ConvergenceReport::ReservoirFailure
- ConvergenceReport::ReservoirConvergenceMetric
- ConvergenceReport::WellFailure
and defer the job of converting the objects between in-memory and
byte stream representations to Opm::Serializer<>. The new special
purpose class CollectConvReports inherits from the latter and uses
its pack() and unpack() member functions, along with its internal
m_buffer data member, to distribute each rank's convergence report
object to all ranks. We add this feature here, in a very narrowly
scoped use case, to enable testing and experimentation before we
consider adding this distribution mechanism as a general feature in
Opm::MpiSerializer.
The h5diff program returns 1 (failure) if there are any differences at all,
even if using a relative or absolute difference tolerance and seeing no
differences above the tolerance. In that situation, the output will be empty,
but the return value 1.
To make this test behave similar to the other regression tests, we now check
if its output is empty instead.
Also: set relative tolerance to 0.01 and remove the absolute test. This test
is not meant to trigger for numerics changes, but should capture errors in
the writing of the HDF5 file.
This commit adds a new public member function
SatfuncConsistencyChecks<>::collectFailures(root, comm)
which aggregates consistency check violations from all ranks in the
MPI communication object 'comm' onto rank 'root' of 'comm'. This
amounts to summing the total number of violations from all ranks and
potentially resampling the failure points for reporting purposes.
To this end, extract the body of function processViolation() into a
general helper which performs reservoir sampling and records point
IDs and which uses a call-back function to populate the check values
associated to a single failed check. Re-implement the original
function in terms of this helper by wrapping exportCheckValues() in
a lambda function. Extract similar helpers for numPoints() and
anyFailedChecks(), and add a new helper function
SatfuncConsistencyChecks<>::incorporateRankViolations()
which brings sampled points from an MPI rank into the 'root's
internal data structures.
One caveat applies here. Our current approach to collecting check
failures implies that calling member function reportFailures() is
safe only on the 'root' process in a parallel run. On the other
hand functions anyFailedChecks() and anyFailedCriticalChecks() are
safe, and guaranteed to return the same answer, on all MPI ranks.
On a final note, the internal helper functions are at present mostly
implemented in terms of non-owning pointers. I intend to switch to
using 'std::span<>' once we enable C++20 mode.
The intention is that this will ultimately replace the existing
RelpermDiagnostics component which does not really work in parallel
and which does not report enough context to help diagnose underlying
issues. For now, though, we just add the shell of a new set of
checks and hook that up to the build.
Class SatfuncConsistencyChecks<Scalar> manages a configurable set of
consistency checks, the implementations of which must publicly
derive from SatfuncConsistencyChecks<Scalar>::Check. Client code
will configure a set of checks by first calling
SatfuncConsistencyChecks<Scalar>::resetCheckSet()
then register individual checks by calling
SatfuncConsistencyChecks<Scalar>::addCheck()
and finally build requisite internal structures by calling
SatfuncConsistencyChecks<Scalar>::finaliseCheckSet()
Client code will then run the checks by calling
SatfuncConsistencyChecks<Scalar>::checkEndpoints()
typically in a loop. Class SatfuncConsistencyChecks<Scalar> will
count consistency check failures and attribute these to each
individual check as needed. We also maintain separate counts for
"Standard" and "Critical" failures. The former will typically
generate warnings while the latter will typically cause the
simulation run to stop. Individual checks get to decide which check
is "Critical", and client code gets to decide how to respond to
"Critical" failures.
Member function SatfuncConsistencyChecks<Scalar>::reportFailures()
will generate a textual report of the known set of consistency check
failures at a give severity level.
As an internal implementation detail, SatfuncConsistencyChecks uses
"reservoir sampling"
(https://en.wikipedia.org/wiki/Reservoir_sampling) to track details
about individual failed checks. We maintain at most a fixed number
of individual points (constructor argument).
-Only output or restart solution tracers for gas/oil tracers with DISGAS/VAPOIL enabled (no solution tracers in water phase!).
-Initial tracers (free/solution) will be set to zero initially if TBLK/TVDP is not given.
- Do not calculate mass transfer between free and solution tracers if it is not necessary.
-Calculate well rates using updated tracer concentrations
This PR switches to calling the SummaryState constructor which is
aware of the value of undefined UDQs (OPM/opm-common#4052) directly.
While here, also sort headers, split some long lines, and prefer
initialisation lists to constructor body assignments.
This commits adds cmake functionality that can
hipify the cuistl framework to support AMD GPUs.
Some tests have been written as HIP does not mirror
CUDA exactly.
CONVERT_CUDA_TO_HIP is the new CMAKE argument.
CMAKE version is increased to include HIP
as a language (3.21 required).
A macro is added to create a layer of indirection
that will make only cuistl files that have been
changed rehipified.
Some BDA stuff is extracted to make sure CUDA
is not accidentally included.
This commit includes the fraction of pore-volume whose CNV targets
are violated as a new per-iteration quantity in the INFOITER file
(--output-extra-convergence-info=iteration), with the column header
"CnvErrPvFrac". We collect the values which are already calculated
in
BlackoilModel<>::getReservoirConvergence()
and store these as a pair of numerator and denominator in the
ConvergenceReport class. Note that we need both the numerator and
the denominator in order to aggregate contributions from multiple
ranks.
While here, also make a few more objects 'const' and calculate
column widths directly instead of the maximum number of characters
in writeConvergenceHeader().
if we use a separate instance the actnum arrays get out of sync. in
particular the two cells with PORV == 0 will not be marked as inactive
in the actnum array of the separate instance. this leads to a segfault
in lookUpData as the field props will have those cells filtered, while the grid
still has the cells active.