Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 2, 2025
1 parent 8982476 commit a020699
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CHANGELOG
* We have decided internally to revert the versioning schema back to SemVer, starting at ``1.0.0``, in order to improve better backward and forward compatibility support for plugins.
* Fix bug related to Probabilistic History Matching result reader. The shape of result was wrong.
* Add the heat transfer mechanism for fluid materials composed by a parcel of radiation and convection.
* Add the PvtModelConstantPropertiesDescription: This model is used to define the PVT properties of the fluid as a table with constant values.
* Add the PvtModelConstantPropertiesDescription: This model is used to define the PVT properties of the fluid as a table with constant values.
* Changed the constructor of result metadata objects in ``alfasim_sdk.result_reader.aggregator`` from ``attr`` to ``dataclasses.dataclass`` to make then more easily integrated into the (de)serialization engine of popular packages such as ``pyserde`` and ``pydantic``.
* Changed function ``read_global_sensitivity_coefficients`` and ``read_uncertainty_propagation_results`` to accept multiple keys so it can perform bulk reads without having to open the result file every time.
* Added ``GlobalSensitivityAnalysisResults``, ``HistoryMatchingDeterministicResults``, ``HistoryMatchingProbabilisticResults`` and ``UncertaintyPropagationResults``, which are objects to read and interact with the Uncertainty Quantification analyses results in a more user-friendly way.
Expand Down
59 changes: 33 additions & 26 deletions src/alfasim_sdk/_internal/alfacase/case_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -2372,13 +2372,13 @@ class PvtModelConstantPropertiesDescription:
:ivar gas_water_surface_tension:
default: Scalar(7.197e-2, "N/m")
:ivar oil_water_surface_tension:
:ivar oil_water_surface_tension:
default: Scalar(7.197e-2, "N/m")
:ivar gas_specific_enthalpy:
default: Scalar(2.260e6, "J/kg")
:ivar oil_specific_enthalpy:
:ivar oil_specific_enthalpy:
default: Scalar(104.86e3, "J/kg")
.. include:: /alfacase_definitions/PvtModelConstantPropertiesDescription.txt
Expand All @@ -2391,24 +2391,23 @@ class PvtModelConstantPropertiesDescription:
.. include:: /alfacase_definitions/list_of_unit_for_specific_energy.txt
"""

gas_density = attrib_scalar(default=Scalar(1.0, 'kg/m3'))
oil_density = attrib_scalar(default=Scalar(1000.0, 'kg/m3'))
water_density = attrib_scalar(default=Scalar(1000.0, 'kg/m3'))
gas_viscosity = attrib_scalar(default=Scalar(5e-6, 'Pa.s'))
oil_viscosity = attrib_scalar(default=Scalar(5e-2, 'Pa.s'))
water_viscosity = attrib_scalar(default=Scalar(5e-2, 'Pa.s'))
gas_specific_heat = attrib_scalar(default=Scalar(1010.0, 'J/kg.K'))
oil_specific_heat = attrib_scalar(default=Scalar(4181.3, 'J/kg.K'))
water_specific_heat = attrib_scalar(default=Scalar(4181.3, 'J/kg.K'))
gas_thermal_conductivity = attrib_scalar(default=Scalar(2.4e-2, 'W/m.K'))
oil_thermal_conductivity = attrib_scalar(default=Scalar(5.91e-1, 'W/m.K'))
water_thermal_conductivity = attrib_scalar(default=Scalar(5.91e-1, 'W/m.K'))
gas_oil_surface_tension = attrib_scalar(default=Scalar(7.197e-2, 'N/m'))
gas_water_surface_tension = attrib_scalar(default=Scalar(7.197e-2, 'N/m'))
oil_water_surface_tension = attrib_scalar(default=Scalar(7.197e-2, 'N/m'))
gas_specific_enthalpy = attrib_scalar(default=Scalar(2.260e6, 'J/kg'))
oil_specific_enthalpy = attrib_scalar(default=Scalar(104.86e3, 'J/kg'))

gas_density = attrib_scalar(default=Scalar(1.0, "kg/m3"))
oil_density = attrib_scalar(default=Scalar(1000.0, "kg/m3"))
water_density = attrib_scalar(default=Scalar(1000.0, "kg/m3"))
gas_viscosity = attrib_scalar(default=Scalar(5e-6, "Pa.s"))
oil_viscosity = attrib_scalar(default=Scalar(5e-2, "Pa.s"))
water_viscosity = attrib_scalar(default=Scalar(5e-2, "Pa.s"))
gas_specific_heat = attrib_scalar(default=Scalar(1010.0, "J/kg.K"))
oil_specific_heat = attrib_scalar(default=Scalar(4181.3, "J/kg.K"))
water_specific_heat = attrib_scalar(default=Scalar(4181.3, "J/kg.K"))
gas_thermal_conductivity = attrib_scalar(default=Scalar(2.4e-2, "W/m.K"))
oil_thermal_conductivity = attrib_scalar(default=Scalar(5.91e-1, "W/m.K"))
water_thermal_conductivity = attrib_scalar(default=Scalar(5.91e-1, "W/m.K"))
gas_oil_surface_tension = attrib_scalar(default=Scalar(7.197e-2, "N/m"))
gas_water_surface_tension = attrib_scalar(default=Scalar(7.197e-2, "N/m"))
oil_water_surface_tension = attrib_scalar(default=Scalar(7.197e-2, "N/m"))
gas_specific_enthalpy = attrib_scalar(default=Scalar(2.260e6, "J/kg"))
oil_specific_enthalpy = attrib_scalar(default=Scalar(104.86e3, "J/kg"))

has_water: bool = attr.ib(default=False)

Expand Down Expand Up @@ -2652,10 +2651,10 @@ def ideal_gas_density_derivative_respect_pressure_const_temperature(p, t):

def ideal_gas_density_derivative_respect_temperature_const_pressure(p, t):
return -p / (r * t**2)

def constant_gas_density_model(p, t):
return rho_g_ref + 0 * p

def constant_gas_density_derivative_respect_pressure_const_temperature(p, t):
return 0 * p

Expand Down Expand Up @@ -2739,14 +2738,22 @@ def oil_water_surface_tension_model(p, t):
if ideal_gas:
data = [
ideal_gas_density_model(p, t).flatten(),
ideal_gas_density_derivative_respect_pressure_const_temperature(p, t).flatten(),
ideal_gas_density_derivative_respect_temperature_const_pressure(p, t).flatten(),
ideal_gas_density_derivative_respect_pressure_const_temperature(
p, t
).flatten(),
ideal_gas_density_derivative_respect_temperature_const_pressure(
p, t
).flatten(),
]
else:
data = [
constant_gas_density_model(p, t).flatten(),
constant_gas_density_derivative_respect_pressure_const_temperature(p, t).flatten(),
constant_gas_density_derivative_respect_temperature_const_pressure(p, t).flatten(),
constant_gas_density_derivative_respect_pressure_const_temperature(
p, t
).flatten(),
constant_gas_density_derivative_respect_temperature_const_pressure(
p, t
).flatten(),
]

data += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
has_water=True
)
)
PVT_MODEL_CONST_TABLE_DEFINITION = case_description.PvtModelConstantPropertiesDescription()
PVT_MODEL_CONST_TABLE_DEFINITION = (
case_description.PvtModelConstantPropertiesDescription()
)
PVT_MODELS_DEFINITION = case_description.PvtModelsDescription(
default_model="acme",
compositional={
Expand Down

0 comments on commit a020699

Please sign in to comment.