pyopmnearwell.ml.integration module
“Run simulations with machine learned well models.
Check the https://github.com/cssr-tools/ML_near_well/ repo for examples on how to use
the recompile_flow
and run_integration
functions.
recompile_flow
can only used for well models at the moment, however the
functionality could easily be extended to replace other parts of the OPM simulator
before recompiling.
- pyopmnearwell.ml.integration.recompile_flow(scalingsfile: Path, opm_path: Path, StandardWell_impl_template: Path, StandardWell_template: Path, stencil_size: int = 3, local_feature_names: list[str] | None = None) None
Fill
StandardWell_impl
and recompileflow_gaswater_dissolution_diffuse
.Note: Once scaling layers are implemented directly into OPM, this might be deprecated. However, it might still be needed to deal with different stencils and
features per cell.
- Args:
- scalingsfile (pathlib.Path): Path to the csv file containing the input and
output scalings for the model.
opm_path (pathlib.Path): Path to a OPM installation with ml functionality. StandardWell_impl_template (pathlib.Path): Template for
StandardWell_impl.hpp
. Decides the neural network architecture.StandardWell_template (pathlib.Path): Template for
StandardWell.hpp
. stencil_size (int, optional): The size of the vertical stencil of the model.Defaults to 3.
- local_feature_names (Optional[list[str]], optional): List of local feature names
that are input to the model. Defaults to Optional.
- Returns:
None
- Raises:
ValueError: If
scalingsfile
contains an invalid row.
- pyopmnearwell.ml.integration.run_integration(runspecs: dict[str, Any], savepath: Path, makofile: str | Path) None
Runs
pyopmnearwell
simulations for the specified runspecs.Note: All “variables” in runspecs need to have the same number of values.
- Args:
- runspecs (dict[str, Any]): Contains at least two keys “variables” and
“constants”. The values of both keys are dictionaries and their union has to contain all parameters to fill the simulation template. Each key in the “variables” dictionary is a list and this function loops through all lists in parallel and runs a simulation for each.
savepath (str): Path to save the output files. makofile (str): Path to the
pyopmnearwell
deck template for the simulations.- Returns:
None