TNO Intern

Commit ffb756cd authored by Florian Knappers's avatar Florian Knappers
Browse files

finished doubletcalc

parent 3b2a12d0
Loading
Loading
Loading
Loading
Loading
+79 −25
Original line number Diff line number Diff line
import math
from typing import TYPE_CHECKING

from dataclasses import dataclass
@@ -9,6 +10,7 @@ from pythermogis.workflow.utc.rock import get_geothermal_gradient
if TYPE_CHECKING:
    from pythermogis.workflow.utc.doublet import DoubletInput

INCH_SI = 0.0254

@dataclass
class Doublet1DResults:
@@ -43,36 +45,46 @@ def doubletcalc(
    injector = Well(
        aquifer=aquifer,
        well_type="injector",
        pipe_segments=...,
        aquifer_top_depth=...,
        pipe_scaling=...,
        target_segment_length=...,
        outer_diameter=...,
        skin=...,
        pump_present=...,
        pump_pressure=...,
        pump_depth=...,
        pump_efficiency=...,
        pressure_balance_tolerance=...,
        pipe_segments=WellPipeSegment(
            ah_depth=input.depth,
            tv_depth=get_along_hole_length(input.depth, well_distance, props.well_curv_scaling, props.max_tvd_stepout_factor),
            inner_diameter=props.inner_diameter * INCH_SI,
            rougness=props.roughness * 1e-3 * INCH_SI
        ),
        aquifer_top_depth=input.depth,
        pipe_scaling=0,
        target_segment_length=props.segment_length,
        outer_diameter=props.outer_diameter * INCH_SI,
        skin=get_total_skin_injection(props, input),
        pump_present=False,
        pump_pressure=0,
        pump_depth=0,
        pump_efficiency=0,
        pressure_balance_tolerance=10,
        viscosity_mode=props.viscosity_mode,
        heat_exchanger_exit_temperature=...,
        heat_exchanger_exit_temperature=injection_temp,
    )
    producer = Well(
        aquifer=aquifer,
        well_type="producer",
        pipe_segments=...,
        aquifer_top_depth=...,
        pipe_scaling=...,
        target_segment_length=...,
        outer_diameter=...,
        skin=...,
        pump_present=...,
        pump_pressure=...,
        pump_depth=...,
        pump_efficiency=...,
        pressure_balance_tolerance=...,
        pipe_segments=WellPipeSegment(
            ah_depth=input.depth,
            tv_depth=get_along_hole_length(input.depth, well_distance, props.well_curv_scaling, props.max_tvd_stepout_factor),
            inner_diameter=props.inner_diameter * INCH_SI,
            rougness=props.roughness * 1e-3 * INCH_SI
        ),
        aquifer_top_depth=input.depth,
        pipe_scaling=0,
        target_segment_length=props.segment_length,
        outer_diameter=props.outer_diameter * INCH_SI,
        skin=get_total_skin_production(props, input),
        pump_present=True,
        pump_pressure=drawdown_pressure,
        pump_depth=get_pump_production_depth(props, input.depth),
        pump_efficiency=props.pump_efficiency,
        pressure_balance_tolerance=10,
        viscosity_mode=props.viscosity_mode,
        heat_exchanger_exit_temperature=...,
        heat_exchanger_exit_temperature=injection_temp,
    )
    doublet = Doublet(
        aquifer=aquifer,
@@ -95,3 +107,45 @@ def doubletcalc(
        production_temp=doublet.nodes['prod_top'].temperature,
        heat_power_produced=[doublet.geothermal_power] * props.econ_lifetime_years,
    )

def get_total_skin_injection(props, input):
    if (not props.use_stimulation()) or (input.transmissivity_with_ntg() > props.stim_kh_max()):
        stim_add_skin_inj = 0.0
    else:
        stim_add_skin_inj = props.stim_add_skin_inj()

    return props.skin_injector() + stim_add_skin_inj

def get_total_skin_production(props, input):
    if (not props.use_stimulation()) or (input.transmissivity_with_ntg() > props.stim_kh_max()):
        stim_add_skin_prod = 0.0
    else:
        stim_add_skin_prod = props.stim_add_skin_prod()

    return props.skin_producer() + stim_add_skin_prod

def get_pump_production_depth(props, depth: float) -> float:
    return min(props.pump_depth(), depth / 2)

def get_along_hole_length(
    true_vertical_depth: float,
    well_distance: float,
    curve_scaling_factor: float,
    max_true_vertical_depth_stepout_factor: float,
) -> float:

    if curve_scaling_factor == 0:
        # Vertical well: along-hole length equals TVD
        return true_vertical_depth

    # Horizontal distance from drilling location
    stepout = 0.5 * well_distance

    max_stepout = true_vertical_depth * max_true_vertical_depth_stepout_factor
    horizontal_distance = stepout - max_stepout if (stepout - max_stepout) > 0 else 0

    stepout -= horizontal_distance

    oblique_distance = math.sqrt(stepout**2 + true_vertical_depth**2) * curve_scaling_factor

    return oblique_distance + horizontal_distance
 No newline at end of file