Skip to content

13411 export sector model from data#13766

Merged
kriben merged 10 commits intodevfrom
13411-export-sector-model-from-data
Mar 20, 2026
Merged

13411 export sector model from data#13766
kriben merged 10 commits intodevfrom
13411-export-sector-model-from-data

Conversation

@kriben
Copy link
Collaborator

@kriben kriben commented Mar 18, 2026

No description provided.

kriben added 8 commits March 20, 2026 09:36
Add cropDataKeywordsInDeckFile() that reads raw cell values directly from
OPM deck keywords (via isDataKeyword/getRawDoubleData/getIntData) and crops
them to the sector box. This handles relperm endpoint arrays (SWL, SWU,
SGCR, SOWCR, etc.) that are specified via direct listing in the .DATA file
and not available in eclipse case results. Runs before
replaceKeywordValuesInDeckFile, which now skips already-cropped keywords.
… export

Verify that PORO, EQLNUM, and SATNUM are correctly cropped from 6000
to 600 values when exporting a 10x10x6 sector from the 20x30x10
model5 grid, and that cropped values match the original uniform data.
ACTNUM is handled separately during export, so it should not be
cropped by the generic data keyword cropping logic.
Add a new .DATA file with K-layer based EQLNUM regions (1-4) and a
test that verifies correct spatial cropping of EQLNUM, EQUIL records,
and PORO when exporting a sector model.
…ector intersection

Data keywords (PORO, EQLNUM, etc.) inside BOX/ENDBOX contain values for the
sub-box only. When BOX coordinates are transformed to sector coordinates, the
data size must match the transformed box dimensions. Crop boxed data keywords
to the intersection of the BOX region with the sector, preserving the
BOX/ENDBOX structure in the exported deck. If the box does not intersect the
sector, the data keyword is removed.
Replace 7 separate deck iterations (cropDataKeywordsInsideBoxContext,
expandBoxContextInDeckFile, and 5 replace*KeywordIndices wrappers) with
a single transformKeywordsInDeckFile function that tracks BOX/ENDBOX
state once and handles all keyword types as they are encountered.
…File

ACTNUM is already correctly computed by updateCornerPointGridInDeckFile
with proper inactive cell handling. Prevent replaceKeywordValuesInDeckFile
from overwriting it with all-1s via extractKeywordData, which treats
ACTNUM as a category result and sets defaultExportValue=1 for all cells.
@kriben kriben force-pushed the 13411-export-sector-model-from-data branch from cd96225 to 841c324 Compare March 20, 2026 08:37
@magnesj
Copy link
Member

magnesj commented Mar 20, 2026

RifOpmDeckTools::item can be removed by using initializer list:

    items.push_back( RifOpmDeckTools::item( A::I1::itemName, static_cast<int>( transformResult->min().x() + 1 ) ) );
    items.push_back( RifOpmDeckTools::item( A::I2::itemName, static_cast<int>( transformResult->max().x() + 1 ) ) );
    items.push_back( RifOpmDeckTools::item( A::J1::itemName, static_cast<int>( transformResult->min().y() + 1 ) ) );
    items.push_back( RifOpmDeckTools::item( A::J2::itemName, static_cast<int>( transformResult->max().y() + 1 ) ) );
    items.push_back( RifOpmDeckTools::item( A::K1::itemName, static_cast<int>( transformResult->min().z() + 1 ) ) );
    items.push_back( RifOpmDeckTools::item( A::K2::itemName, static_cast<int>( transformResult->max().z() + 1 ) ) );

can be simplified by using initializer list to

    items.push_back( { A::I1::itemName, static_cast<int>( transformResult->min().x() + 1 ) } );
    items.push_back( { A::I2::itemName, static_cast<int>( transformResult->max().x() + 1 ) } );
    items.push_back( { A::J1::itemName, static_cast<int>( transformResult->min().y() + 1 ) } );
    items.push_back( { A::J2::itemName, static_cast<int>( transformResult->max().y() + 1 ) } );
    items.push_back( { A::K1::itemName, static_cast<int>( transformResult->min().z() + 1 ) } );
    items.push_back( { A::K2::itemName, static_cast<int>( transformResult->max().z() + 1 ) } );

Tests cover record-level processing (no overlap, partial overlap with
clamping, completely inside sector) and full deck transformation with
BOX/ENDBOX for both MULTIPLY and ADD keywords.
@kriben kriben force-pushed the 13411-export-sector-model-from-data branch from a24b90d to fe8735a Compare March 20, 2026 09:30
@kriben kriben requested a review from jonjenssen March 20, 2026 09:46
@kriben kriben marked this pull request as ready for review March 20, 2026 09:46
@kriben kriben merged commit 27c0647 into dev Mar 20, 2026
18 checks passed
@kriben kriben deleted the 13411-export-sector-model-from-data branch March 20, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants