Loading src/pythermogis/thermogis_classes/doublet.py +1 −1 Viewed Changes for src/pythermogis/thermogis_classes/doublet.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ import numpy as np import xarray as xr from jpype import JClass from pythermogis.workflow.utc.doublet import calculate_doublet_performance, DoubletInput, DoubletOutput from pythermogis.workflow.utc.utc_properties import UTCConfiguration from pythermogis.workflow.utc.configuration import UTCConfiguration def simulate_doublet( Loading src/pythermogis/transmissivity/calculate_thick_perm_trans.py +65 −0 Viewed Changes for src/pythermogis/transmissivity/calculate_thick_perm_trans.py: 65 added lines, 0 removed lines. Original line number Diff line number Diff line import numpy as np from scipy import stats import xarray as xr from numba import njit, prange from numpy.typing import NDArray def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: float, thickness_sd: float, ln_permeability_mean: float, ln_permeability_sd: float, p_values: xr.DataArray, nSamples: int = 10000) -> float: """ Loading Loading @@ -53,3 +56,65 @@ def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: f transmissivity_pvalues_sampled = transmissivity_samples[sample_indexes.astype(int)] return thickness_pvalues, permeability_pvalues, transmissivity_pvalues_sampled @njit(parallel=True) def calculate_transmissivity( thickness_mean: NDArray[np.float64], thickness_sd: NDArray[np.float64], ln_perm_mean: NDArray[np.float64], ln_perm_sd: NDArray[np.float64], quantile: float, z_score: float, n_samples: int, ): shape = thickness_mean.shape tm_flat = thickness_mean.ravel() ts_flat = thickness_sd.ravel() lpm_flat = ln_perm_mean.ravel() lps_flat = ln_perm_sd.ravel() n_cells = tm_flat.size idx = int(quantile * n_samples) thickness_p = np.empty(n_cells) permeability_p = np.empty(n_cells) transmissivity_p = np.empty(n_cells) for i in prange(n_cells): tm = tm_flat[i] ts = ts_flat[i] lpm = lpm_flat[i] lps = lps_flat[i] if np.isnan(tm) or np.isnan(ts) or np.isnan(lpm) or np.isnan(lps): thickness_p[i] = np.nan permeability_p[i] = np.nan transmissivity_p[i] = np.nan continue # Generate samples for this cell thickness_samples = np.empty(n_samples) ln_perm_samples = np.empty(n_samples) for j in range(n_samples): if ts == 0: thickness_samples[j] = tm else: thickness_samples[j] = max(0.01, np.random.normal(tm, ts)) ln_perm_samples[j] = np.random.normal(lpm, lps) # Transmissivity samples tr_samples = np.exp(ln_perm_samples) * thickness_samples tr_samples.sort() transmissivity_p[i] = tr_samples[idx] # Analytical percentiles thickness_p[i] = tm + z_score * ts if ts > 0 else tm permeability_p[i] = np.exp(lpm + z_score * lps) return ( thickness_p.reshape(shape), permeability_p.reshape(shape), transmissivity_p.reshape(shape), ) No newline at end of file src/pythermogis/workflow/utc/utc_properties.py→src/pythermogis/workflow/utc/configuration.py +21 −23 Viewed Changes for src/pythermogis/workflow/utc/configuration.py: 21 added lines, 23 removed lines. Original line number Diff line number Diff line Loading @@ -62,16 +62,16 @@ class UTCConfiguration: ) property_grid_infos: list[PropertyGridInfo] = field( default_factory=lambda: [ PropertyGridInfo("Permeability", False, "__k.zmap"), PropertyGridInfo("PermeabilityLNSD", False, "__k_lnsd.zmap"), PropertyGridInfo("Porosity", False, "__phi.zmap"), PropertyGridInfo("Thickness", False, "__thick.zmap"), PropertyGridInfo("ThicknessSD", False, "__thick_sd.zmap"), PropertyGridInfo("Depth", False, "__top.zmap"), PropertyGridInfo("NetToGross", False, "__ntg.zmap"), PropertyGridInfo("Temperature", True, "__temperature.zmap"), PropertyGridInfo("HCAccum", True, "__hc_accum.zmap"), PropertyGridInfo("BoundaryShapefile", True, "__BoundaryShapefile.shp"), PropertyGridInfo("permeability", False, "__k.nc"), PropertyGridInfo("permeability_lnsd", False, "__k_ln_sd.nc"), PropertyGridInfo("porosity", False, "__phi.nc"), PropertyGridInfo("thickness", False, "__thick.nc"), PropertyGridInfo("thickness_sd", False, "__thick_sd.nc"), PropertyGridInfo("depth", False, "__top.nc"), PropertyGridInfo("ntg", False, "__ntg.nc"), PropertyGridInfo("temperature", True, "__temperature.nc"), PropertyGridInfo("hc_accum", False, "__hc_accum.nc"), PropertyGridInfo("boundary_shapefile", True, "__BoundaryShapefile.nc"), ] ) copy_aquifer_files_info: list[AquiferFile] = field( Loading @@ -82,15 +82,13 @@ class UTCConfiguration: AquiferFile("__points_QC.shp", "__points_QC.shp"), ] ) scenario: str = "basecase" scenario: str = "BaseCase" scen_suffix: str = "" temp_from_grid: bool = False exclude_hc_accum: bool = True use_bounding_shape: bool = False grid_ext: str = ".nc" p_values: list[float] = field( default_factory=lambda: [10.0, 30.0, 50.0, 70.0, 90.0] ) p_values: list[float] = field(default_factory=lambda: [10.0, 30.0, 50.0, 90.0]) # temp_voxet: 'Voxet' = None surface_temperature: float = 10.0 temp_gradient: float = 31.0 Loading Loading @@ -119,13 +117,13 @@ class UTCConfiguration: max_cooling_temp_range: float = 100.0 hp_minimum_injection_temperature: float = 15.0 ates_charge_temp: float = 80.0 econ_lifetime_years: int = 15 econ_lifetime_years: int = 30 ates_min_flow: float = 0.0 hp_include_elect_heat_in_power: bool = False set_all_values_to_final_rosim_year: bool = False max_flow: float = 500.0 charge_temp: float = 80.0 anisotropy: float = 5.0 anisotropy: float = 3.0 filter_fraction: float = 0.8 salinity_surface: float = 0.0 salinity_gradient: float = 46.67 Loading Loading @@ -160,19 +158,19 @@ class UTCConfiguration: stim_add_skin_prod: float = -3.0 stimulation_capex: float = 0.5 hp_calc_cop: bool = True imposed_cop: float = 3.0 hp_capex: float = 600.0 hp_opex: float = 60.0 imposed_cop: float = 4.0 hp_capex: float = 200.0 hp_opex: float = 10.0 hp_alternative_heating_price: float = 2.8 viscosity_mode: ViscosityMode = "batzlewang" # Economical data economic_lifetime: int = 15 economic_lifetime: int = 30 drilling_time: int = 2 tax_rate: float = 0.25 interest_loan: float = 0.05 inflation: float = 0.02 equity_return: float = 0.07 inflation: float = 0.015 equity_return: float = 0.145 debt_equity: float = 0.8 ecn_eia: float = 0.0 tolerance_utc_increase: float = 0.0 Loading @@ -182,7 +180,7 @@ class UTCConfiguration: elec_purchase_price: float = 8.0 opex_per_energy: float = 0.19 opex_per_capex: float = 0.0 well_cost_scaling: float = 1.5 well_cost_scaling: float = 1.3 well_cost_const: float = 0.25 well_cost_z: float = 700.0 well_cost_z2: float = 0.2 Loading src/pythermogis/workflow/utc/cooling_temp.py +1 −1 Viewed Changes for src/pythermogis/workflow/utc/cooling_temp.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ from pythermogis.workflow.utc.doublet_utils import calc_lifetime from pythermogis.workflow.utc.flow import calculate_volumetric_flow if TYPE_CHECKING: from pythermogis.workflow.utc.configuration import UTCConfiguration from pythermogis.workflow.utc.doublet import DoubletInput from pythermogis.workflow.utc.utc_properties import UTCConfiguration def calculate_cooling_temperature( Loading src/pythermogis/workflow/utc/doublet.py +1 −1 Viewed Changes for src/pythermogis/workflow/utc/doublet.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ from dataclasses import dataclass from typing import NamedTuple from pythermogis.utils.timer import print_time from pythermogis.workflow.utc.configuration import UTCConfiguration from pythermogis.workflow.utc.constants import DARCY_SI from pythermogis.workflow.utc.cooling_temp import calculate_cooling_temperature from pythermogis.workflow.utc.doublet_utils import ( Loading @@ -10,7 +11,6 @@ from pythermogis.workflow.utc.doublet_utils import ( calculate_injection_temp_with_heat_pump, ) from pythermogis.workflow.utc.pressure import calculate_max_pressure, optimize_pressure from pythermogis.workflow.utc.utc_properties import UTCConfiguration from pythermogis.workflow.utc.well_distance import optimize_well_distance EUR_PER_CT_PER_KWH = 0.36 Loading Loading
src/pythermogis/thermogis_classes/doublet.py +1 −1 Viewed Changes for src/pythermogis/thermogis_classes/doublet.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ import numpy as np import xarray as xr from jpype import JClass from pythermogis.workflow.utc.doublet import calculate_doublet_performance, DoubletInput, DoubletOutput from pythermogis.workflow.utc.utc_properties import UTCConfiguration from pythermogis.workflow.utc.configuration import UTCConfiguration def simulate_doublet( Loading
src/pythermogis/transmissivity/calculate_thick_perm_trans.py +65 −0 Viewed Changes for src/pythermogis/transmissivity/calculate_thick_perm_trans.py: 65 added lines, 0 removed lines. Original line number Diff line number Diff line import numpy as np from scipy import stats import xarray as xr from numba import njit, prange from numpy.typing import NDArray def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: float, thickness_sd: float, ln_permeability_mean: float, ln_permeability_sd: float, p_values: xr.DataArray, nSamples: int = 10000) -> float: """ Loading Loading @@ -53,3 +56,65 @@ def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: f transmissivity_pvalues_sampled = transmissivity_samples[sample_indexes.astype(int)] return thickness_pvalues, permeability_pvalues, transmissivity_pvalues_sampled @njit(parallel=True) def calculate_transmissivity( thickness_mean: NDArray[np.float64], thickness_sd: NDArray[np.float64], ln_perm_mean: NDArray[np.float64], ln_perm_sd: NDArray[np.float64], quantile: float, z_score: float, n_samples: int, ): shape = thickness_mean.shape tm_flat = thickness_mean.ravel() ts_flat = thickness_sd.ravel() lpm_flat = ln_perm_mean.ravel() lps_flat = ln_perm_sd.ravel() n_cells = tm_flat.size idx = int(quantile * n_samples) thickness_p = np.empty(n_cells) permeability_p = np.empty(n_cells) transmissivity_p = np.empty(n_cells) for i in prange(n_cells): tm = tm_flat[i] ts = ts_flat[i] lpm = lpm_flat[i] lps = lps_flat[i] if np.isnan(tm) or np.isnan(ts) or np.isnan(lpm) or np.isnan(lps): thickness_p[i] = np.nan permeability_p[i] = np.nan transmissivity_p[i] = np.nan continue # Generate samples for this cell thickness_samples = np.empty(n_samples) ln_perm_samples = np.empty(n_samples) for j in range(n_samples): if ts == 0: thickness_samples[j] = tm else: thickness_samples[j] = max(0.01, np.random.normal(tm, ts)) ln_perm_samples[j] = np.random.normal(lpm, lps) # Transmissivity samples tr_samples = np.exp(ln_perm_samples) * thickness_samples tr_samples.sort() transmissivity_p[i] = tr_samples[idx] # Analytical percentiles thickness_p[i] = tm + z_score * ts if ts > 0 else tm permeability_p[i] = np.exp(lpm + z_score * lps) return ( thickness_p.reshape(shape), permeability_p.reshape(shape), transmissivity_p.reshape(shape), ) No newline at end of file
src/pythermogis/workflow/utc/utc_properties.py→src/pythermogis/workflow/utc/configuration.py +21 −23 Viewed Changes for src/pythermogis/workflow/utc/configuration.py: 21 added lines, 23 removed lines. Original line number Diff line number Diff line Loading @@ -62,16 +62,16 @@ class UTCConfiguration: ) property_grid_infos: list[PropertyGridInfo] = field( default_factory=lambda: [ PropertyGridInfo("Permeability", False, "__k.zmap"), PropertyGridInfo("PermeabilityLNSD", False, "__k_lnsd.zmap"), PropertyGridInfo("Porosity", False, "__phi.zmap"), PropertyGridInfo("Thickness", False, "__thick.zmap"), PropertyGridInfo("ThicknessSD", False, "__thick_sd.zmap"), PropertyGridInfo("Depth", False, "__top.zmap"), PropertyGridInfo("NetToGross", False, "__ntg.zmap"), PropertyGridInfo("Temperature", True, "__temperature.zmap"), PropertyGridInfo("HCAccum", True, "__hc_accum.zmap"), PropertyGridInfo("BoundaryShapefile", True, "__BoundaryShapefile.shp"), PropertyGridInfo("permeability", False, "__k.nc"), PropertyGridInfo("permeability_lnsd", False, "__k_ln_sd.nc"), PropertyGridInfo("porosity", False, "__phi.nc"), PropertyGridInfo("thickness", False, "__thick.nc"), PropertyGridInfo("thickness_sd", False, "__thick_sd.nc"), PropertyGridInfo("depth", False, "__top.nc"), PropertyGridInfo("ntg", False, "__ntg.nc"), PropertyGridInfo("temperature", True, "__temperature.nc"), PropertyGridInfo("hc_accum", False, "__hc_accum.nc"), PropertyGridInfo("boundary_shapefile", True, "__BoundaryShapefile.nc"), ] ) copy_aquifer_files_info: list[AquiferFile] = field( Loading @@ -82,15 +82,13 @@ class UTCConfiguration: AquiferFile("__points_QC.shp", "__points_QC.shp"), ] ) scenario: str = "basecase" scenario: str = "BaseCase" scen_suffix: str = "" temp_from_grid: bool = False exclude_hc_accum: bool = True use_bounding_shape: bool = False grid_ext: str = ".nc" p_values: list[float] = field( default_factory=lambda: [10.0, 30.0, 50.0, 70.0, 90.0] ) p_values: list[float] = field(default_factory=lambda: [10.0, 30.0, 50.0, 90.0]) # temp_voxet: 'Voxet' = None surface_temperature: float = 10.0 temp_gradient: float = 31.0 Loading Loading @@ -119,13 +117,13 @@ class UTCConfiguration: max_cooling_temp_range: float = 100.0 hp_minimum_injection_temperature: float = 15.0 ates_charge_temp: float = 80.0 econ_lifetime_years: int = 15 econ_lifetime_years: int = 30 ates_min_flow: float = 0.0 hp_include_elect_heat_in_power: bool = False set_all_values_to_final_rosim_year: bool = False max_flow: float = 500.0 charge_temp: float = 80.0 anisotropy: float = 5.0 anisotropy: float = 3.0 filter_fraction: float = 0.8 salinity_surface: float = 0.0 salinity_gradient: float = 46.67 Loading Loading @@ -160,19 +158,19 @@ class UTCConfiguration: stim_add_skin_prod: float = -3.0 stimulation_capex: float = 0.5 hp_calc_cop: bool = True imposed_cop: float = 3.0 hp_capex: float = 600.0 hp_opex: float = 60.0 imposed_cop: float = 4.0 hp_capex: float = 200.0 hp_opex: float = 10.0 hp_alternative_heating_price: float = 2.8 viscosity_mode: ViscosityMode = "batzlewang" # Economical data economic_lifetime: int = 15 economic_lifetime: int = 30 drilling_time: int = 2 tax_rate: float = 0.25 interest_loan: float = 0.05 inflation: float = 0.02 equity_return: float = 0.07 inflation: float = 0.015 equity_return: float = 0.145 debt_equity: float = 0.8 ecn_eia: float = 0.0 tolerance_utc_increase: float = 0.0 Loading @@ -182,7 +180,7 @@ class UTCConfiguration: elec_purchase_price: float = 8.0 opex_per_energy: float = 0.19 opex_per_capex: float = 0.0 well_cost_scaling: float = 1.5 well_cost_scaling: float = 1.3 well_cost_const: float = 0.25 well_cost_z: float = 700.0 well_cost_z2: float = 0.2 Loading
src/pythermogis/workflow/utc/cooling_temp.py +1 −1 Viewed Changes for src/pythermogis/workflow/utc/cooling_temp.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ from pythermogis.workflow.utc.doublet_utils import calc_lifetime from pythermogis.workflow.utc.flow import calculate_volumetric_flow if TYPE_CHECKING: from pythermogis.workflow.utc.configuration import UTCConfiguration from pythermogis.workflow.utc.doublet import DoubletInput from pythermogis.workflow.utc.utc_properties import UTCConfiguration def calculate_cooling_temperature( Loading
src/pythermogis/workflow/utc/doublet.py +1 −1 Viewed Changes for src/pythermogis/workflow/utc/doublet.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ from dataclasses import dataclass from typing import NamedTuple from pythermogis.utils.timer import print_time from pythermogis.workflow.utc.configuration import UTCConfiguration from pythermogis.workflow.utc.constants import DARCY_SI from pythermogis.workflow.utc.cooling_temp import calculate_cooling_temperature from pythermogis.workflow.utc.doublet_utils import ( Loading @@ -10,7 +11,6 @@ from pythermogis.workflow.utc.doublet_utils import ( calculate_injection_temp_with_heat_pump, ) from pythermogis.workflow.utc.pressure import calculate_max_pressure, optimize_pressure from pythermogis.workflow.utc.utc_properties import UTCConfiguration from pythermogis.workflow.utc.well_distance import optimize_well_distance EUR_PER_CT_PER_KWH = 0.36 Loading