The master-slave synchronization code in beginTimeStep() was executing
on every internal substep within a "sync" timestep. This is incorrect
because:
1. The SubStepIteration loop typically splits a sync timestep into
multiple smaller internal substeps for numerical stability
2. After the first internal substep, master and slaves are at different
simulation times and cannot exchange data correctly
3. Repeated sync attempts would cause deadlocks or incorrect data
This fix adds an isFirstSubstepOfSyncTimestep flag to track whether we
are at the start of a coordinated "sync" timestep. The flag is:
- Set to true before each SubStepIteration::run() call
- Cleared to false after the first runSubStep_() returns
We need cross-section areas and vertical depth (TVD) for titled grid
TVD is computed rather using cell depth
TVD = reference_depth + (z - reference_z) * cos(dipAngle) + lateral_distance * sin(dipAngle) * cos(azimuth_difference)
dip-angle is computed from cell corner geometry via normal vector cross product, providing both dip angle and azimuth vector
For the simple we assume areas uniformly change with depth : A(z) = Area/cos(θ)
Weight approximating 1/cos(θ)
where dip-angle is computed from cell corner geometry via normal vector cross product, providing both dip angle and azimuth vector
For the accurate method we compute cross-section areas using shoelace formula: A(z) = sum_ij (xj*yj+1 − xj+1*yj)
Weight is then w = A(z)*∆zi
Store injection_phase by value instead of by reference to prevent
dangling reference when the calculator is returned from a function.
The previous code stored a const reference to the Phase parameter,
which works when the calculator is constructed and used within the
same scope (e.g., in GroupStateHelper::checkGroupConstraintsInj).
However, when the calculator is returned from a e.g a function
the temporary Phase value passed to the constructor is destroyed, leaving
a dangling reference that can cause undefined behavior.
In particular, switch to passing a collection of pointers through
the Summary::DynamicSimulatorState object instead of passing
references to individual state objects. This is in preparation of
adding more state objects, in particular for summary quantities at
the region level without having to pay a large API cost for each of
those.
To this end also switch the output module's initialInPlace()
function to returning a pointer--with nullptr being "no such
value"--instead of a reference to an optional<>.
In particular, don't register a parallel test into the test suite if
the local computer system does not have at least as many CPU cores
as requested by the specific test. We might for instance be running
on an older or lower-end laptop and don't want to confuse the user
by false negative test failures.
As an example, the SPE9_CP_SHORT+8 test (PR #6232) requires a system
with at least eight CPUs which is not always available.
Compensate for mass loss in the energy equation to avoid unphysical temperatures
Activated by default --enable-droft-compensation-temp (Default = true)
Add CMake infrastructure to simplify building and running Python tests:
- Add `python_tests` target: builds only Python modules and test files
Usage: `ninja python_tests`
- Add test fixtures: running `ctest -R python_basic` now automatically
builds the required Python modules first via FIXTURES_REQUIRED
This allows one to quickly iterate on Python tests without building
unrelated C++ test binaries.
This commit extends the test_group_higher_constraints test suite with:
1. Extended hierarchy: Added MANI-2 group (with WELL-B) under PLAT to
create realistic group competition scenarios where fractions < 1.0.
The new hierarchy is:
FIELD -> PLAT -> MANI -> WELL-A, WELL-A2
-> MANI-2 -> WELL-B
-> PLAT-2 -> WELL-C
2. New tests for getWellGroupTargetProducer():
- TestWellGroupTargetProducerIndividualControl: WELL-A under ORAT
- TestWellGroupTargetProducerGrupControl: WELL-A under GRUP
- TestWellGroupTargetProducerWithSiblingIndividualControl: WELL-A
under GRUP with sibling WELL-A2 under ORAT (demonstrates case
where reduction != addback)
3. Updated existing tests:
- TestGroupHigherConstraintsWithGuideRate: scale now 0.922 (was 1.39)
- TestGroupHigherConstraintsProdWithoutGuideRate: scale now 0.901