### Running Doublet simulations with custom simulation parameters
To adjust properties of the simulation, you can pass a `utc_properties` instance to the calculate_doublet_performance function.
A `utc_properties` instance is a JClass implementation of the Java UTCProperties class. It is generated by using the `utc_properties_builder`, upon which custom properties can be set, and used to build an instance of the `utc_properties`.
Be aware, that you will need access to the ThermoGIS java source code to fully understand what these properties do and not all properties are actually utilised in this python api (especially those which refer to paths to files).
Common properties to change include:
-`setUseHeatPump(Boolean)`: if true, include a heat-pump when modelling
-`setUseStimulation(Boolean)`: if true, apply reservoir stimulation when simulating a doublet
-`setSurfaceTemperature(float)`: The temperature of the surface
-`setTempGradient(float)`: The gradient at which temperature increases with depth, in C/km
-`setDhReturnTemp(float)`: The goal of the direct heat return temperature
-`setStimKhMax(float)`: The maximum transmissivity above which no stimulation will occur (if UseStimulation = True)
Here is an example, where the default utc_properties is used, but the UseHeatPump option is set to True. this is achievied by instantiating a `utc_properties_builder` class, running `.useHeatPump(True)` on that class, and then building the
`utc_properties` themselves, with the `.build()` method of the `utc_properties_builder`.
Given thickness provided as a normal distribution and ln(permeability) provided as a normal distribution, and a specific p-value, then generate the values for that p-value of the
-thickness
-permeability
-transmissivity
Note: Transmissivity is a function of ln(permeability) * thickness, and so no analytical solution exists to combine these two probability distributions and so the transmissivity distribution has to be sampled.
Given thickness provided as a normal distribution and ln(permeability) provided as a normal distribution, and a specific p-value, then generate the values for that p-value of the
@@ -71,11 +33,10 @@ def generate_thickness_permeability_transmissivity_for_pvalues(thickness_mean: f
# Sampling method for transmissivity
thickness_samples=thickness_dist.rvs(nSamples)
thickness_samples=np.where(thickness_samples<0.0,0.1,thickness_samples)# Ensure no negative thicknesses
Perform a ThermoGIS Doublet performance simulation. This will occur across all dimensions of the input_data (ie. input data can have a single value for each required variable, or it can be 1Dimensional or a 2Dimensional grid)
The default doublet simulation settings are for the ThermoGIS BaseCase; but major input parameters can be set using the input_params variable. This is a dictonary which by default contain the following keys:
To change only one of these input parameters you can provide a dictionary with a single key to this method, and it will use the default values for the rest of the model parameters.
e.g. input_params = {"use_stimulation":True}
:param input_data:
A xr.Dataset (input_data) with the required variables: "thickness_mean", "thickness_sd", "porosity", "ntg", "depth", "ln_permeability_mean", "ln_permeability_sd", Performance will be calculated across all dimensions.
Optional Extra parameters: "temperature", "mask".
If no temperature values are provided, temperature will be calculated using a gradient specified by the input_params dictionary and the depth variable.
If mask values are provided, then any non-nan values in the mask variable will be set to zero across all variables in the returned output_data object.
:param input_params:
A dictionary containing parameters for use by the doublet calculation, If no input_params are provided then the values for the default thermogis scenario are used (the "BaseCase" scenario).
:param utc_properties:
:param rng_seed:
:param p_values:
A list of p_values for the doublet calculation to perform over; if no p_values are provided then the default value of P50 is used.
raiseValueError(f"provided input Dataset does not contain the following required variables: {missing_variables}")
defapply_input_params(input_params:dict)->dict:
"""
if input_params is None, return the basecase input_params, if input_params contains keys, then change these keys in the basecase input params to the values provided by the user
ifinput_paramsisNone:# If no input_params provided, return the basecase
returninput_params_basecase
else:# If input_params provided, then go through the keys in the basecase dictionary, and any keys in common can be changed to the user provided input_params
raiseFileNotFoundError(f"Java executable not found at {jvm_path}")
raiseFileNotFoundError(f"Java executable not found at {jvm_path}, check that you have installed a JVM correctly and set the JAVA_HOME environment variable.")
raiseFileNotFoundError(f"Java executable not found at {thermogis_jar_path}")
raiseFileNotFoundError(f"Jar file not found at {thermogis_jar_path}, check that you have downloaded the ThermoGIS Jar and set the THERMOGIS_JAR environment variable.")