TNO Intern

Commit 21dd9b85 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Testing performance

parent 49f7c2c7
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes
    if not np.isnan(mask) or temperature < utc_properties.minProdTemp():
        return (mask_value,) * 14

    use_java_backend = True
    use_java_backend = False
    if use_java_backend:
        doublet = instantiate_thermogis_doublet(utc_properties, rng_seed)
        JavaDoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput")
+4 −5
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ from pythermogis.workflow.utc.doublet_utils import calculate_injection_temp_with
from pythermogis.workflow.utc.pressure import calculate_max_pressure, optimize_pressure
from pythermogis.workflow.utc.cooling_temp import calculate_cooling_temperature
from pythermogis.workflow.utc.well_distance import optimize_well_distance, \
    optimize_well_distance
    optimize_well_distance_original
from utils.timer import print_time

EUR_PER_CT_PER_KWH = 0.36
@@ -81,7 +81,6 @@ def calculate_doublet_performance(props: UTCConfiguration, input: DoubletInput,
        well_distance,
        injection_temperature,
    )

    if drawdown_pressure == 0:
        return None
    timer = print_time(timer, "maximum pressure: ", verbose=verbose)
@@ -103,7 +102,7 @@ def calculate_doublet_performance(props: UTCConfiguration, input: DoubletInput,
    timer = print_time(timer, "cooling temperature: ", verbose=verbose)

    if props.optim_well_dist:
        well_distance = optimize_well_distance(
        well_distance = optimize_well_distance_original(
            props,
            input,
            drawdown_pressure,
@@ -131,7 +130,7 @@ def calculate_doublet_performance(props: UTCConfiguration, input: DoubletInput,
    if pressure_results is None:
        return None

    # everything underneath here is lightning
    # everything underneath here is fast, no point in optimizing
    heat_power_per_doublet = pressure_results.heat_power_per_doublet
    flowrate = pressure_results.flowrate
    discounted_heat_produced_p = pressure_results.discounted_heat_produced
@@ -188,7 +187,7 @@ def calculate_doublet_performance(props: UTCConfiguration, input: DoubletInput,
            * (1 - props.tax_rate)
    )
    opex_first_prod_year = total_opex_ts[props.drilling_time]
    timer = print_time(timer, "economics: ", verbose=verbose)
    print_time(timer, "economics: ", verbose=verbose)

    return DoubletOutput(
        power=heat_power_per_doublet,
+0 −2
Original line number Diff line number Diff line
@@ -152,7 +152,6 @@ def optimize_pressure(
                    pres_max = pres_max * 1.01

    if flow_results is not None and flow_results.flowrate > props.max_flow:

        iter_count = 0
        pres_min = 0.0
        pres_max = drawdown_pressure
@@ -179,7 +178,6 @@ def optimize_pressure(
        if flow_results.flowrate > props.max_flow:
            drawdown_pressure -= pres_tol


    flow_results = calculate_volumetric_flow(
        props=props,
        input_data=input,
+3 −3
Original line number Diff line number Diff line
import numpy as np
from scipy.optimize import brenth
from scipy.optimize import brenth, brentq

from pythermogis.workflow.utc.doublet_utils import calc_lifetime
from pythermogis.workflow.utc.flow import calculate_volumetric_flow
@@ -111,12 +111,12 @@ def optimize_well_distance(
) -> float:
    # find the well distance between the min and max which comes closest to the optimal
    # doublet lifetime, as defined in props.
    well_distance = brenth(
    well_distance = brentq(
        f1,
        props.optim_dist_well_dist_min,
        props.optim_dist_well_dist_max,
        xtol=10,
        maxiter=1000,
        maxiter=100,
        args=(props, input, drawdown_pressure, injection_temp),
    )
    return well_distance
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ class PyThermoGIS(TestCase):
        print(f"Python calculation took {time_elapsed:.1f} seconds.")

    def read_input_grids(self):
        new_cellsize=5e3 # in m
        new_cellsize=15e3 # in m
        input_grids = resample_grid(read_grid(self.test_files_out_path / "ROSL_ROSLU__thick.zmap"), new_cellsize=new_cellsize).to_dataset(name="thickness_mean")
        input_grids["thickness_sd"] = resample_grid(read_grid(self.test_files_out_path / "ROSL_ROSLU__thick_sd.zmap"), new_cellsize=new_cellsize)
        input_grids["ntg"] = resample_grid(read_grid(self.test_files_out_path / "ROSL_ROSLU__ntg.zmap"), new_cellsize=new_cellsize)
Loading