TNO Intern

Commit e207d247 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

renaming the stochastic doublet performance calculator

parent 4ceb56e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ from pythermogis import simulate_doublet
from pythermogis.physics.temperature_grid_calculation import calculate_temperature_from_gradient
from pythermogis.thermogis_classes.utc_properties import instantiate_utc_properties_builder

def calculate_doublet_performance_deterministic(reservoir_properties: xr.Dataset, utc_properties = None, rng_seed = None) -> xr.Dataset:
def calculate_doublet_performance(reservoir_properties: xr.Dataset, utc_properties = None, rng_seed = None) -> xr.Dataset:
    """
    """
    validate_input(reservoir_properties)
+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import numpy as np
import xarray as xr
import typer

from pythermogis import calculate_doublet_performance_deterministic
from pythermogis import calculate_doublet_performance

app = typer.Typer(pretty_exceptions_enable=False)

@@ -44,7 +44,7 @@ def simulate_doublet(
        print("\n---simulation input---")
        print(input_data)

    output_data = calculate_doublet_performance_deterministic(input_data)
    output_data = calculate_doublet_performance(input_data)

    if verbose:
        print("\n---simulation output---")
+22 −24
Original line number Diff line number Diff line
from pythermogis import calculate_doublet_performance_deterministic
from pythermogis import calculate_doublet_performance
import xarray as xr

def test_deterministic_doublet():
@@ -11,39 +11,37 @@ def test_deterministic_doublet():
        "permeability": 200
    })

    results1 = calculate_doublet_performance_deterministic(reservoir_properties)
    results2 = calculate_doublet_performance_deterministic(reservoir_properties)
    results1 = calculate_doublet_performance(reservoir_properties)
    results2 = calculate_doublet_performance(reservoir_properties)
    xr.testing.assert_equal(results1, results2)

def test_deterministic_doublet_temperature_provided():

    reservoir_properties = xr.Dataset(
    {
        "thickness": ((), 10),
        "porosity": ((), 0.5),
        "ntg": ((), 0.5),
        "depth": ((), 2000),
        "temperature": ((), 89),
        "permeability": ((), 200)
    reservoir_properties = xr.Dataset({
        "thickness": 10,
        "porosity": 0.5,
        "ntg": 0.5,
        "depth": 2000,
        "temperature": 89,
        "permeability": 200
    })

    results1 = calculate_doublet_performance_deterministic(reservoir_properties)
    results2 = calculate_doublet_performance_deterministic(reservoir_properties)
    results1 = calculate_doublet_performance(reservoir_properties)
    results2 = calculate_doublet_performance(reservoir_properties)
    xr.testing.assert_equal(results1, results2) # assert that results are equal, showing no stochastic variations

def test_deterministic_doublet_transmissivity_provided():

    reservoir_properties = xr.Dataset(
    {
        "thickness": ((), 10),
        "porosity": ((), 0.5),
        "ntg": ((), 0.5),
        "depth": ((), 2000),
        "temperature": ((), 89),
        "transmissivity": ((), 2000),
        "permeability": ((), 200)
    reservoir_properties = xr.Dataset({
        "thickness": 10,
        "porosity": 0.5,
        "ntg": 0.5,
        "depth": 2000,
        "temperature": 89,
        "transmissivity": 2000,
        "permeability": 200
    })

    results1 = calculate_doublet_performance_deterministic(reservoir_properties)
    results2 = calculate_doublet_performance_deterministic(reservoir_properties)
    results1 = calculate_doublet_performance(reservoir_properties)
    results2 = calculate_doublet_performance(reservoir_properties)
    xr.testing.assert_equal(results1, results2) # assert that results are equal, showing no stochastic variations
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ def test_example_5():
    output_data_path.mkdir(parents=True, exist_ok=True)

    # if set to True then simulation is always run, otherwise pre-calculated results are read (if available)
    run_simulation = False
    run_simulation = True

    # grids can be in .nc, .asc, .zmap or .tif format: see pygridsio package
    new_cellsize = 5000  # in m, this sets the resolution of the model; to speed up calcualtions you can increase the cellsize