Skip to content

Commit

Permalink
!fixup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caio-ramos committed Jan 2, 2025
1 parent 79b381b commit eb832ef
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/alfacase/test_case_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ def test_pvt_model_table_parameters_description_create_constant():
ideal_gas=False, rho_g_ref=rho_g_ref
)
# Check gas_density_derivative_respect_pressure
gas_density_derivative_expected_values = 1 / (r * t.flatten())
gas_density_derivative_expected_values = 0.0 / (r * t.flatten())

assert pvt.table_variables[0] == approx(gas_density_expected_values)
assert pvt.table_variables[1] == approx(gas_density_derivative_expected_values)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
.. rubric:: Definitions

.. tab:: CaseDescription

.. parsed-literal::

class PvtModelConstantPropertiesDescription
gas_density: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(1.0, 'kg/m3', 'density')
oil_density: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(1000.0, 'kg/m3', 'density')
water_density: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(1000.0, 'kg/m3', 'density')
gas_viscosity: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(5e-06, 'Pa.s', 'mass per time per length')
oil_viscosity: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.05, 'Pa.s', 'mass per time per length')
water_viscosity: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.05, 'Pa.s', 'mass per time per length')
gas_specific_heat: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(1010.0, 'J/kg.K', 'specific heat capacity')
oil_specific_heat: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(4181.3, 'J/kg.K', 'specific heat capacity')
water_specific_heat: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(4181.3, 'J/kg.K', 'specific heat capacity')
gas_thermal_conductivity: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.024, 'W/m.K', 'thermal conductivity')
oil_thermal_conductivity: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.591, 'W/m.K', 'thermal conductivity')
water_thermal_conductivity: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.591, 'W/m.K', 'thermal conductivity')
gas_oil_surface_tension: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.07197, 'N/m', 'force per length')
gas_water_surface_tension: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.07197, 'N/m', 'force per length')
oil_water_surface_tension: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.07197, 'N/m', 'force per length')
gas_specific_enthalpy: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(2260000.0, 'J/kg', 'specific energy')
oil_specific_enthalpy: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(104860.0, 'J/kg', 'specific energy')
has_water: bool = False

.. tab:: Schema

.. parsed-literal::

gas_density: # optional
value: number
unit: string
oil_density: # optional
value: number
unit: string
water_density: # optional
value: number
unit: string
gas_viscosity: # optional
value: number
unit: string
oil_viscosity: # optional
value: number
unit: string
water_viscosity: # optional
value: number
unit: string
gas_specific_heat: # optional
value: number
unit: string
oil_specific_heat: # optional
value: number
unit: string
water_specific_heat: # optional
value: number
unit: string
gas_thermal_conductivity: # optional
value: number
unit: string
oil_thermal_conductivity: # optional
value: number
unit: string
water_thermal_conductivity: # optional
value: number
unit: string
gas_oil_surface_tension: # optional
value: number
unit: string
gas_water_surface_tension: # optional
value: number
unit: string
oil_water_surface_tension: # optional
value: number
unit: string
gas_specific_enthalpy: # optional
value: number
unit: string
oil_specific_enthalpy: # optional
value: number
unit: string
has_water: boolean # optional
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
correlations: \ :class:`Dict <typing.Dict>`\[str, \ :class:`PvtModelCorrelationDescription <PvtModelCorrelationDescription>`\] = {}
compositional: \ :class:`Dict <typing.Dict>`\[str, \ :class:`PvtModelCompositionalDescription <PvtModelCompositionalDescription>`\] = {}
combined: \ :class:`Dict <typing.Dict>`\[str, \ :class:`PvtModelCombinedDescription <PvtModelCombinedDescription>`\] = {}
constant_properties: \ :class:`Dict <typing.Dict>`\[str, \ :class:`PvtModelConstantPropertiesDescription <PvtModelConstantPropertiesDescription>`\] = {}

.. tab:: Schema

Expand All @@ -24,3 +25,5 @@
string: \ :class:`pvt_model_compositional_description_schema <PvtModelCompositionalDescription>`
combined: # optional
string: \ :class:`pvt_model_combined_description_schema <PvtModelCombinedDescription>`
constant_properties: # optional
string: \ :class:`pvt_model_constant_properties_description_schema <PvtModelConstantPropertiesDescription>`
1 change: 1 addition & 0 deletions tests/alfacase/test_generate_case_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ def test_get_cases_class():
"PvtModelCombinedDescription",
"PvtModelCompositionalDescription",
"PvtModelCorrelationDescription",
"PvtModelConstantPropertiesDescription",
"PvtModelsDescription",
"ReferencedPressureContainerDescription",
"ReferencedTemperaturesContainerDescription",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,29 @@ profile_output_description_schema = Map(
}
)

pvt_model_constant_properties_description_schema = Map(
{
Optional("gas_density"): Map({"value": Float(), "unit": Str()}),
Optional("oil_density"): Map({"value": Float(), "unit": Str()}),
Optional("water_density"): Map({"value": Float(), "unit": Str()}),
Optional("gas_viscosity"): Map({"value": Float(), "unit": Str()}),
Optional("oil_viscosity"): Map({"value": Float(), "unit": Str()}),
Optional("water_viscosity"): Map({"value": Float(), "unit": Str()}),
Optional("gas_specific_heat"): Map({"value": Float(), "unit": Str()}),
Optional("oil_specific_heat"): Map({"value": Float(), "unit": Str()}),
Optional("water_specific_heat"): Map({"value": Float(), "unit": Str()}),
Optional("gas_thermal_conductivity"): Map({"value": Float(), "unit": Str()}),
Optional("oil_thermal_conductivity"): Map({"value": Float(), "unit": Str()}),
Optional("water_thermal_conductivity"): Map({"value": Float(), "unit": Str()}),
Optional("gas_oil_surface_tension"): Map({"value": Float(), "unit": Str()}),
Optional("gas_water_surface_tension"): Map({"value": Float(), "unit": Str()}),
Optional("oil_water_surface_tension"): Map({"value": Float(), "unit": Str()}),
Optional("gas_specific_enthalpy"): Map({"value": Float(), "unit": Str()}),
Optional("oil_specific_enthalpy"): Map({"value": Float(), "unit": Str()}),
Optional("has_water"): Bool(),
}
)

pvt_model_correlation_description_schema = Map(
{
Optional("oil_density_std"): Map({"value": Float(), "unit": Str()}),
Expand Down Expand Up @@ -1235,6 +1258,7 @@ pvt_models_description_schema = Map(
Optional("correlations"): MapPattern(Str(), pvt_model_correlation_description_schema),
Optional("compositional"): MapPattern(Str(), pvt_model_compositional_description_schema),
Optional("combined"): MapPattern(Str(), pvt_model_combined_description_schema),
Optional("constant_properties"): MapPattern(Str(), pvt_model_constant_properties_description_schema),
}
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. admonition:: Available units for category 'force per length'
:class: dropdown

:"dyne/cm": dynes/centimetre
:"kgf/cm": kilograms force/centimetre
:"kgf/m": kilogram force per meter
:"kN/m": kilonewtons/metre
:"lbf/100ft": pounds force per hundred foot
:"lbf/30m": pounds force per thirty meters
:"lbf/ft": pounds force per foot
:"lbf/in": pounds force/inch
:"mN/km": millinewtons/kilometre
:"mN/m": millinewtons/metre
:"N/30m": newton per thirty meters
:"N/m": newtons/metre
:"pdl/cm": poundals/centimetre
:"tonfUK/ft": UK tons force/foot
:"tonfUS/ft": US tons force/foot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. admonition:: Available units for category 'specific energy'
:class: dropdown

:"Btu/lbm": British thermal units/pound mass
:"cal/g": calories/gram
:"cal/kg": calories/kilogram
:"cal/lbm": calories/pound mass
:"erg/g": ergs/gram
:"erg/kg": ergs/kilogram
:"ft.lbf/lbm": foot pounds force/pound mass
:"hp.hr/lbm": horsepower hours/pound mass
:"J/g": joules/gram
:"J/kg": joules/kilogram
:"kcal/g": kilocalories/gram
:"kcal/kg": kilocalories/kilogram
:"kJ/kg": kilojoule/kilogram
:"kW.h/kg": kilowatt hours/kilogram
:"kW.h/t": kilowatt hours/tonne
:"kW.h/tonUK": kilowatt hours/U.S. ton
:"kW.h/tonUS": kilowatt hours/U.S. ton
:"lbf.ft/lbm": foot pounds force/pound mass
:"MJ/kg": megajoules/kilogram
:"MW.h/kg": megawatt hours/kilogram
:"therm/lbm": therms/pound mass

0 comments on commit eb832ef

Please sign in to comment.