Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and check conformity #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oddvarlia
Copy link
Contributor

@oddvarlia oddvarlia commented Feb 20, 2025

Reasons for making this change

ERT update of field parameters require only one grid size for all field parameters. To handle this for the cases that:

  • There are multiple zones in the geomodel
  • The structural model has uncertainties which implies that number of layers and the geometry of the geomodel grid varies from realization to realization.

the help grid 'ERTBOX' is introduced. This grid is of fixed size and not realization dependent. The geometry of this help grid is of no importance except that the lateral position and number of grid cells should match as far as possible the geogrid in map view.

A workflow updating field parameters involve a step where the geogrid field parameters for each zone is copied into the ERTBOX in a unique way and also that the values in the ERTBOX grid is copied back into the geogrid zones.
This mapping between geogrid and ERTBOX grid is the same whether the APS method for facies modelling is used in RMS or whether petrophysical parameters are used as field parameters to be updated in ERT.

To simplify maintenance it is an advantage to have this mapping located in one common repo for both applications using APS and for applications updating petrophysical field parameters.

The fmu-tools is chosen to be the location for the common code, and this involves a refactoring of the APS code to use the common code for the mapping.

The mapping depends on the conformity or grid layout of the zones in the geogrid. Up to now the conformity is specified by the users without any check that it actually is consistent with the grid layout. For APS this is specified in the GUI and for the petrophysical field parameters, it is specified in the input settings for the function copy_rms_param.

There exist, however a possibility for grids built in RMS with most common grid layout settings to get the information about grid layout from the RMS job directly. In the current PR , the user specified settings for grid layout in APS is checked with the RMS grid building job when possible. The check is possible if:

  • The grid is built by an RMS grid building job
  • There are only one grid building job (In RMS it is possible to have multiple jobs that create the grid within the same grid if alternative grid building methods is to be tested.
  • The grid building job must only use zone boundaries defined by the method 'Honor
  • The grid building job for each zone must be defined either as proportional or top conform or base conform and the layers are defined by using the zone top or zone base surfaces as reference surfaces. This is called ' Horizon' in the grid building job. Any zone defined by external surfaces where 'Surface' is chosen as reference is not supported in the implementation.

To handle the various cases, the check will accept the user specified settings for conformities for the zones if the check is not possible or the conformities are not implemented. If the grid conformities are one of the implemented versions (Proportional, TopConform, BaseConform), and there is a mismatch between the user specified conformities of a zone and the conformity used in the grid building job for the zone, either an error is raised or the conformities from the grid building job is returned and used depending on in which context the check (and get conformity) is used.

Related issues

Issue #47
Issue #59

@oddvarlia oddvarlia marked this pull request as draft February 20, 2025 14:37
@oddvarlia oddvarlia force-pushed the refactor_and_check_conformity branch 2 times, most recently from ac06ba3 to fd82751 Compare February 25, 2025 14:35
@oddvarlia oddvarlia marked this pull request as ready for review February 25, 2025 20:12
Add check on zone conformity defined in RMS grid building jobs
@oddvarlia oddvarlia force-pushed the refactor_and_check_conformity branch from 3f58059 to affe089 Compare March 6, 2025 15:34
@oddvarlia oddvarlia requested a review from sindre-nistad March 7, 2025 12:12
'the grid and parameters should be shared and realisation = 1'
)
params = {
'project': project,
'model_file_name': get_specification_file(
_type=SpecificationType.RESAMPLE, _format=ModelFileFormat.YML, **kwargs
),
'debug_level': Debug.VERBOSE,
'debug_level': 2,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably still use the Enum so that it is clearer what the intension is

@@ -29,14 +29,12 @@
# (including the added trends for those that should have trends) is then copied back to the geomodel grid.

from pathlib import Path
from roxar import Direction
from rmsapi import Direction
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aware this will break backwards-compatibility of older versions of RMS.

We should probably create an internal module, which tries rmsapi and then fall back to roxar.

# else:
# # One such case is 'mixed conform'
# raise NotImplementedError('{} is not supported'.format(conformity.name))
# return field_values
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out code can be removed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed, then?

@@ -6,8 +6,7 @@
use FIELD keywords for petrophysical properties in ERT in Assisted History Matching.
"""

import roxar
import xml.etree.ElementTree as ET
import rmsapi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as earlier

Comment on lines +274 to +276
if prop.type == rmsapi.GridPropertyType.continuous:
continuous_type_param_list.append(pname)
elif prop.type == roxar.GridPropertyType.discrete:
elif prop.type == rmsapi.GridPropertyType.discrete:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -317,7 +316,7 @@ def from_ertbox_to_geogrid(project, params):
"Use 'Eclipse grid standard' (upper left corner) as "
'common grid index origin (right-handed grid) in FMU projects using ERT.'
)
if ertboxgrid_handedness != roxar.Direction.right:
if ertboxgrid_handedness != rmsapi.Direction.right:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

params = {
'project': project,
'debug_level': Debug.ON,
'debug_level': 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the enum when possible to be clear what the intension is

print('Copy 3D parameter from Geo grid to Ertbox grid')

params = {
'project': project,
'debug_level': Debug.ON,
'debug_level': 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -23,9 +23,11 @@
from aps.utils.roxar.progress_bar import APSProgressBar
from aps.utils.check_rms_interactive_or_batch import check_rms_execution_mode

from fmu.tools.rms.copy_rms_param_to_ertbox_grid import check_grid_layout
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add flu.tool as a dependency in pyproject.toml

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.

2 participants