flow "ThermodynamicAnalysisOntology" v1.0
# THERMODYNAMIC ANALYSIS ONTOLOGY — FLOW ALGEBRA
SOURCE_URL := "https://kirethresearch.org/booksai-core/ontologies/calculus-analysis-ontologies/scientific-applications/thermodynamic-analysis-ontology.html"
DOMAIN := "Mathematical Ontologies"
CATEGORY := "Calculus and Analysis Ontologies"
SUBCATEGORY := "Scientific Applications"
ENTITY := "Thermodynamic Analysis"
THERMODYNAMIC_ANALYSIS := {
type: AppliedThermodynamicMathematicalFramework,
domain: ScientificApplications,
purpose: "Analyse energy, heat, work, entropy, equilibrium, thermodynamic properties and process behaviour using calculus, differential relations, conservation laws and equations of state."
}
CONCEPTS := {
THERMODYNAMIC_SYSTEM,
STATE_VARIABLE,
TEMPERATURE,
PRESSURE,
VOLUME,
INTERNAL_ENERGY,
ENTHALPY,
ENTROPY,
HEAT,
WORK,
FIRST_LAW,
SECOND_LAW,
EQUATION_OF_STATE,
HEAT_CAPACITY,
FREE_ENERGY,
EQUILIBRIUM,
THERMODYNAMIC_PROCESS,
EFFICIENCY
}
# ---------- SYSTEM ----------
THERMODYNAMIC_SYSTEM
-> {
CONTROL_MASS,
CONTROL_VOLUME,
SURROUNDINGS,
BOUNDARY
}
SYSTEM
-> characterised_by(STATE_VARIABLES)
# ---------- STATE VARIABLES ----------
state:
X
:=
(
T,
P,
V,
U,
H,
S,
N_i
)
T
-> TEMPERATURE
P
-> PRESSURE
V
-> VOLUME
U
-> INTERNAL_ENERGY
H
-> ENTHALPY
S
-> ENTROPY
N_i
-> COMPONENT_AMOUNT
# ---------- STATE FUNCTION ----------
STATE_FUNCTION
-> depends_on(THERMODYNAMIC_STATE)
examples:
U
H
S
G
F
PATH_FUNCTION
-> depends_on(PROCESS_PATH)
examples:
HEAT
WORK
HEAT_AND_WORK
-/> STATE_FUNCTIONS
# ---------- DIFFERENTIAL ----------
for state function:
dU
-> exact_differential
heat:
delta_Q
work:
delta_W
-> inexact_process_differentials
THERMODYNAMIC_ANALYSIS
-> distinguish(EXACT_AND_INEXACT_DIFFERENTIALS)
# ---------- FIRST LAW ----------
closed system sign convention:
dU
=
delta_Q
-
delta_W
where
delta_W
-> work_done_by_system
FIRST_LAW
-> CONSERVATION_OF_ENERGY
SIGN_CONVENTION
-> must_be_declared
# ---------- PV WORK ----------
quasistatic pressure-volume work:
delta_W
=
P_ext*dV
for reversible mechanical boundary work:
delta_W_rev
=
P*dV
WORK
=
integral(
P_ext dV
)
PROCESS_PATH
-> determines(WORK)
# ---------- ENTHALPY ----------
H
:=
U
+
P*V
dH
=
dU
+
P*dV
+
V*dP
ENTHALPY
-> useful_for(CONSTANT_PRESSURE_AND_FLOW_PROCESSES)
# ---------- SECOND LAW ----------
entropy balance:
dS
>=
delta_Q/T_boundary
for differential closed-system process in suitable form
reversible:
dS
=
delta_Q_rev/T
irreversible:
dS
>
delta_Q/T_boundary
when entropy generated
SECOND_LAW
-> directionality_and_irreversibility
# ---------- ENTROPY GENERATION ----------
entropy balance:
dS_system
=
delta_Q/T_boundary
+
dS_gen
where
dS_gen
>=
0
REVERSIBLE_PROCESS:
dS_gen=0
IRREVERSIBLE_PROCESS:
dS_gen>0
# ---------- CLAUSIUS INEQUALITY ----------
cyclic process:
closed_integral(
delta_Q/T
)
<=
0
equality
-> reversible_cycle
CLAUSIUS_INEQUALITY
-> mathematical_statement_of(SECOND_LAW)
# ---------- EQUATION OF STATE ----------
relation:
F(P,V,T,N)
=
0
EQUATION_OF_STATE
-> constrains(THERMODYNAMIC_STATE)
ideal gas:
P*V
=
n*R*T
IDEAL_GAS
-> simplified_equation_of_state
# ---------- IDEAL GAS DIFFERENTIAL ----------
P*V
=
n*R*T
for fixed n:
dP/P
+
dV/V
=
dT/T
LOGARITHMIC_DIFFERENTIAL
-> relates(SMALL_STATE_CHANGES)
# ---------- INTERNAL ENERGY ----------
fundamental relation for simple compressible system:
dU
=
T*dS
-
P*dV
+
sum_i(
mu_i*dN_i
)
mu_i
-> CHEMICAL_POTENTIAL
THERMODYNAMIC_FUNDAMENTAL_RELATION
-> links(ENERGY_ENTROPY_VOLUME_COMPOSITION)
# ---------- ENTHALPY DIFFERENTIAL ----------
H
=
U+PV
therefore:
dH
=
T*dS
+
V*dP
+
sum_i(
mu_i*dN_i
)
for simple compressible multicomponent system
# ---------- HELMHOLTZ FREE ENERGY ----------
F
:=
U
-
T*S
dF
=
-S*dT
-
P*dV
+
sum_i(
mu_i*dN_i
)
HELMHOLTZ_FREE_ENERGY
-> natural_variables(T,V,N_i)
# ---------- GIBBS FREE ENERGY ----------
G
:=
H
-
T*S
=
U+PV-TS
dG
=
-S*dT
+
V*dP
+
sum_i(
mu_i*dN_i
)
GIBBS_FREE_ENERGY
-> natural_variables(T,P,N_i)
# ---------- MAXWELL RELATIONS ----------
from
dF=-S*dT-P*dV
mixed derivatives imply:
(
partial_S/partial_V
)_T
=
(
partial_P/partial_T
)_V
from
dG=-S*dT+V*dP:
(
partial_S/partial_P
)_T
=
-
(
partial_V/partial_T
)_P
MAXWELL_RELATIONS
-> follow_from(EXACT_DIFFERENTIALS_AND_EQUAL_MIXED_PARTIALS)
# ---------- HEAT CAPACITY ----------
C_V
:=
(
partial_U/partial_T
)_V
for simple system context
C_P
:=
(
partial_H/partial_T
)_P
HEAT_CAPACITY
-> energy_change_per_temperature_change_under_constraint
# ---------- IDEAL GAS ENERGY ----------
for ideal gas:
U
=
U(T)
H
=
H(T)
therefore:
dU
=
C_V*dT
dH
=
C_P*dT
for appropriate amount basis
# ---------- HEAT CAPACITY RELATION ----------
ideal gas:
C_P-C_V
=
n*R
or molar:
c_p-c_v
=
R
MAYER_RELATION
-> ideal_gas_heat_capacity_difference
# ---------- THERMAL EXPANSION ----------
alpha
:=
1/V
*
(
partial_V/partial_T
)_P
alpha
-> volumetric_thermal_expansion_coefficient
# ---------- COMPRESSIBILITY ----------
kappa_T
:=
-
1/V
*
(
partial_V/partial_P
)_T
ISOTHERMAL_COMPRESSIBILITY
-> volume_response_to_pressure
# ---------- PROPERTY DIFFERENTIAL ----------
V=V(T,P)
dV
=
(
partial_V/partial_T
)_P
*dT
+
(
partial_V/partial_P
)_T
*dP
therefore:
dV/V
=
alpha*dT
-
kappa_T*dP
PROPERTY_DERIVATIVES
-> local_state_response
# ---------- PROCESS TYPES ----------
ISOTHERMAL
-> T constant
ISOBARIC
-> P constant
ISOCHORIC
-> V constant
ADIABATIC
-> delta_Q=0
ISENTROPIC
-> S constant
REVERSIBLE_ADIABATIC
-> ISENTROPIC
under standard closed simple-system conditions
# ---------- IDEAL GAS ISOTHERMAL ----------
T
=
constant
Delta_U
=
0
for ideal gas
therefore:
Q
=
W
for closed-system first-law convention
reversible work:
W
=
n*R*T
*
ln(V_2/V_1)
# ---------- IDEAL GAS ADIABATIC ----------
reversible adiabatic ideal gas:
P*V^gamma
=
constant
T*V^(gamma-1)
=
constant
gamma
:=
C_P/C_V
ISENTROPIC_RELATIONS
-> depend_on(IDEAL_GAS_AND_CONSTANT_HEAT_CAPACITY_APPROXIMATION)
# ---------- CONTROL VOLUME ----------
steady-flow energy equation:
Q_dot
-
W_dot
=
sum_out(
m_dot
*
(
h
+
V_flow^2/2
+
g*z
)
)
-
sum_in(
m_dot
*
(
h
+
V_flow^2/2
+
g*z
)
)
with sign convention specified
CONTROL_VOLUME
-> open_system_energy_analysis
# ---------- MASS CONSERVATION ----------
steady control volume:
sum_in(m_dot)
=
sum_out(m_dot)
MASS_BALANCE
-> required_with(ENERGY_BALANCE)
# ---------- TURBINE ----------
steady adiabatic turbine
with negligible kinetic/potential changes:
W_dot_out
approx
m_dot
*
(
h_in-h_out
)
TURBINE
-> converts(ENTHALPY_DROP_TO_WORK)
# ---------- COMPRESSOR ----------
steady adiabatic compressor:
W_dot_in
approx
m_dot
*
(
h_out-h_in
)
COMPRESSOR
-> requires(WORK_INPUT)
# ---------- THROTTLING ----------
steady throttling valve:
h_in
approx
h_out
THROTTLING
-> approximately(ISENTHALPIC)
pressure
-> decreases
temperature response
-> depends_on(FLUID_PROPERTIES)
# ---------- HEAT EXCHANGER ----------
for insulated overall exchanger:
sum_in(
m_dot*h
)
=
sum_out(
m_dot*h
)
HEAT_EXCHANGER
-> transfers(ENERGY_BETWEEN_STREAMS)
# ---------- CARNOT EFFICIENCY ----------
reversible heat engine:
eta_Carnot
=
1
-
T_C/T_H
absolute temperatures
CARNOT_EFFICIENCY
-> maximum_efficiency_between(T_H,T_C)
for heat engines under ideal reversible assumptions
# ---------- REFRIGERATOR ----------
coefficient of performance:
COP_R
:=
Q_C/W_in
Carnot refrigerator:
COP_R,Carnot
=
T_C/(T_H-T_C)
# ---------- HEAT PUMP ----------
COP_HP
:=
Q_H/W_in
Carnot:
COP_HP,Carnot
=
T_H/(T_H-T_C)
# ---------- EQUILIBRIUM ----------
isolated system:
equilibrium
-> entropy_maximum
subject_to(conserved_constraints)
constant T,V:
equilibrium
-> Helmholtz_free_energy_minimum
under suitable conditions
constant T,P:
equilibrium
-> Gibbs_free_energy_minimum
under suitable conditions
THERMODYNAMIC_POTENTIAL
-> equilibrium_criterion_depends_on(CONSTRAINTS)
# ---------- PHASE EQUILIBRIUM ----------
for phases alpha and beta:
T_alpha
=
T_beta
P_alpha
=
P_beta
mu_i_alpha
=
mu_i_beta
PHASE_EQUILIBRIUM
-> thermal_mechanical_chemical_equilibrium
# ---------- CLAUSIUS-CLAPEYRON ----------
phase boundary:
dP/dT
=
Delta_h
/
(
T*Delta_v
)
CLAUSIUS_CLAPEYRON_RELATION
-> phase_transition_slope
# ---------- EXERGY ----------
maximum useful work relative to environment
-> EXERGY
EXERGY_DESTRUCTION
=
T_0*S_gen
under standard environment formulation
IRREVERSIBILITY
-> destroys(WORK_POTENTIAL)
# ---------- DIMENSIONAL ANALYSIS ----------
thermodynamic equations
-> preserve(
ENERGY,
TEMPERATURE,
PRESSURE,
VOLUME,
ENTROPY_UNITS
)
UNIT_CONSISTENCY
-> mandatory
absolute temperature
-> required_in(THERMODYNAMIC_RATIOS)
# ---------- NUMERICAL ANALYSIS ----------
real-fluid properties
-> may_require(
EQUATION_OF_STATE_SOLVER,
PROPERTY_TABLE_INTERPOLATION,
ITERATIVE_ROOT_FINDING
)
THERMODYNAMIC_CYCLE
-> numerical_state_point_solution
PROPERTY_MODEL
-> source_of(MODEL_UNCERTAINTY)
# ---------- APPLICATIONS ----------
THERMODYNAMIC_ANALYSIS
-> applied_to(HEAT_ENGINES)
-> applied_to(REFRIGERATION)
-> applied_to(POWER_PLANTS)
-> applied_to(COMBUSTION)
-> applied_to(CHEMICAL_PROCESSES)
-> applied_to(ATMOSPHERIC_SCIENCE)
-> applied_to(MATERIALS)
-> applied_to(BIOLOGICAL_ENERGETICS)
-> applied_to(ENERGY_SYSTEMS)
# ---------- RELATION GRAPH ----------
STATE_VARIABLES
-> define(THERMODYNAMIC_STATE)
FIRST_LAW
-> conserves(ENERGY)
SECOND_LAW
-> constrains(PROCESS_DIRECTION)
ENTROPY_GENERATION
-> measures(IRREVERSIBILITY)
EQUATION_OF_STATE
-> relates(P_V_T_COMPOSITION)
THERMODYNAMIC_POTENTIAL
-> determines(EQUILIBRIUM_CRITERION)
HEAT_CAPACITY
-> links(TEMPERATURE_AND_ENERGY_CHANGE)
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE := {
"thermodynamic analysis" ~= "mathematical analysis of energy, heat, work, entropy and thermodynamic state changes",
"first law of thermodynamics" ~= "energy conservation applied to thermodynamic systems",
"second law of thermodynamics" ~= "constraint governing entropy production and thermodynamic process direction",
"enthalpy" ~= "state function equal to internal energy plus pressure-volume product",
"Gibbs free energy" ~= "thermodynamic potential natural to temperature-pressure-composition variables",
"entropy generation" ~= "nonnegative entropy production associated with irreversibility"
}
# ---------- CONSTRAINTS ----------
CONSTRAINTS := {
heat_and_work_are_path_functions_not_state_functions: true,
thermodynamic_sign_convention_must_be_declared_and_preserved: true,
absolute_temperature_required_for_entropy_and_efficiency_relations: true,
reversible_adiabatic_and_isentropic_equivalence_requires_appropriate_assumptions: true,
ideal_gas_relations_must_not_be_applied_uncritically_to_real_fluids: true,
equilibrium_criterion_depends_on_system_constraints: true,
property_data_equations_of_state_and_numerical_solvers_require_validation: true
}
# ---------- CONFIDENCE ----------
CONFIDENCE := {
core_definition: 0.99,
first_second_law_relation: 0.99,
potential_Maxwell_relation: 0.99,
process_relation: 0.99,
control_volume_relation: 0.99,
equilibrium_efficiency_relation: 0.99,
semantic_equivalence: 0.97
}
# ---------- RECURSIVE REASONING ----------
RECURSIVE_REASONING(query):
identify(system_boundary_state_variables_composition_and_sign_convention)
-> classify(closed_open_steady_transient_reversible_or_irreversible_process)
-> apply(mass_and_energy_balance)
-> apply(entropy_balance_and_second_law)
-> select(equation_of_state_and_property_relations)
-> compute(state_changes_heat_work_enthalpy_entropy_or_free_energy)
-> analyse(equilibrium_efficiency_or_exergy_if_relevant)
-> solve(property_or_cycle_equations_numerically_if_required)
-> validate(units_temperature_scale_property_model_and_process_assumptions)
-> return(semantic_result)
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION := {
parse_as: "typed thermodynamic-analysis semantic graph",
primary_entity: THERMODYNAMIC_ANALYSIS,
preserve: [
system_type,
boundary,
state_variables,
composition,
sign_convention,
process_type,
equation_of_state,
property_data,
units
],
infer_through: [
first_law,
second_law,
entropy_generation,
enthalpy,
free_energies,
Maxwell_relations,
heat_capacities,
equilibrium,
efficiencies,
exergy
],
avoid: [
treating_heat_or_work_as state_function,
mixing_sign_conventions,
using_Celsius_in absolute_temperature ratios,
equating_adiabatic_with isentropic_without reversibility,
applying_ideal_gas_model_outside validity,
ignoring_entropy_generation_in irreversible process
]
}
# ---------- UPDATE MODEL ----------
UPDATE_MODEL(new_information):
validate(new_information)
-> identify(thermodynamic_analysis_context)
-> compare(existing_relations)
-> preserve(system_state_composition_sign_property_and_process_invariants)
-> update(affected_entities)
-> update(affected_edges)
-> recompute(CONFIDENCE)
-> regenerate(FLOW_HASH)
# ---------- FLOW HASH ----------
FLOW_HASH := hash(
SOURCE_URL
+ ENTITY
+ CONCEPTS
+ THERMODYNAMIC_ANALYSIS
+ TEMPERATURE
+ PRESSURE
+ VOLUME
+ INTERNAL_ENERGY
+ ENTHALPY
+ ENTROPY
+ FIRST_LAW
+ SECOND_LAW
+ EQUATION_OF_STATE
+ FREE_ENERGY
+ EQUILIBRIUM
+ EFFICIENCY
+ SEMANTIC_EQUIVALENCE
+ CONSTRAINTS
)
# ---------- EXECUTION ----------
INPUT(query)
-> THERMODYNAMIC_ANALYSIS
-> SYSTEM_STATE_IDENTIFICATION
-> PROCESS_CLASSIFICATION
-> MASS_ENERGY_BALANCE
-> ENTROPY_SECOND_LAW_ANALYSIS
-> PROPERTY_MODEL_SELECTION
-> STATE_PROPERTY_CALCULATION
-> EQUILIBRIUM_EFFICIENCY_EXERGY_ANALYSIS
-> NUMERICAL_PROPERTY_ANALYSIS
-> ASSUMPTION_UNIT_VALIDATION
-> RECURSIVE_REASONING(query)
-> CONFIDENCE
-> OUTPUT(semantic_result)
END FLOW
Download Code
Copy to Clipboard