feat: Add compositional enthalpy model#3705
Open
dkachuma wants to merge 44 commits into
Open
Conversation
…GEOS-DEV/GEOS into dkachuma/compositional-enthalpy
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a compositional enthalpy capability for the multiphase compositional fluid models, combining an ideal-mixture enthalpy (via Poling heat-capacity polynomials) with an EOS-based departure enthalpy and extending EOS derivative support needed for temperature sensitivity.
Changes:
- Added a new
CompositionalEnthalpymodel and unit tests validating enthalpy values and derivatives. - Added
HeatCapacityCoefficientsmodel-parameter support (reference temperature, reference enthalpy, Cp polynomial coefficients) with input validation. - Extended cubic EOS stack variables and unit tests to cover second-order temperature-related derivative paths (
ddaMixture) and EOS departure enthalpy derivatives.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreComponents/constitutive/unitTests/testSoreideWhitsonEOSPhaseModel.cpp | Adds numerical-derivative tests for ddaMixture and EOS enthalpy in the Soreide-Whitson phase model tests. |
| src/coreComponents/constitutive/unitTests/testHeatCapacityCoefficients.cpp | New tests for HeatCapacityCoefficients input validation and positivity checks. |
| src/coreComponents/constitutive/unitTests/testCubicEOS.cpp | Adds numerical-derivative tests for ddaMixture and EOS enthalpy for cubic EOS models. |
| src/coreComponents/constitutive/unitTests/testCompositionalEnthalpy.cpp | New tests for compositional enthalpy values and derivatives. |
| src/coreComponents/constitutive/unitTests/CMakeLists.txt | Registers the two new unit test sources. |
| src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/HeatCapacityCoefficients.hpp | New parameter class interface and view keys for Cp/enthalpy reference inputs. |
| src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/HeatCapacityCoefficients.cpp | Implements registration + post-init validation (sizes, ordering, Cp positivity). |
| src/coreComponents/constitutive/fluid/multifluid/compositional/models/CompositionalEnthalpy.hpp | New enthalpy function/model implementation (ideal + departure enthalpy). |
| src/coreComponents/constitutive/fluid/multifluid/compositional/models/CompositionalEnthalpy.cpp | Wires CompositionalEnthalpy to parameters and EOS selection. |
| src/coreComponents/constitutive/fluid/multifluid/compositional/functions/EOSStackVariables.hpp | Adds storage for ddaMixture derivatives. |
| src/coreComponents/constitutive/fluid/multifluid/compositional/functions/CubicEOSPhaseModel.hpp | Declares EOS departure enthalpy computation API. |
| src/coreComponents/constitutive/fluid/multifluid/compositional/functions/CubicEOSPhaseModel_impl.hpp | Implements EOS departure enthalpy and ddaMixture population. |
| src/coreComponents/constitutive/CMakeLists.txt | Adds new sources/headers to the constitutive target. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements a compositional enthalpy model for a multiphase fluid system. The total enthalpy of the phase is computed as the sum of an ideal (polynomial) enthalpy and a real fluid correction (or departure enthalpy), which is derived from the equation of state.
The total enthalpy of a fluid phase is defined as:
The ideal enthalpy represents the enthalpy of the mixture assuming it behaves as an ideal gas, relying on the heat capacity of the individual components. The specific heat capacity$C_{p,i}$ for each component $i$ is modeled as a 4th-order Poling polynomial based on the temperature difference from a reference state, $\Delta T = T - T_{ref}$ :
To find the ideal enthalpy for a component, this heat capacity is integrated with respect to temperature from the reference temperature to the current temperature, and then added to a baseline reference enthalpy$H_{ref,i}$ :
The total ideal enthalpy for the phase is simply the mole-fraction weighted sum of the individual component ideal enthalpies:
The dimensionless enthalpy departure is given by:
where$Z$ is the compressibility factor of the mixture.
3 new user parameters parameters in
HeatCapacityCoefficients.cpp:enthalpyReferenceTemperature: (Optional) A scalar defining the reference temperaturereferenceEnthalpy: (Optional) A 2D array mapping the reference enthalpy for each component within each phase at the reference temperature. The dimensions must match[number of phases, number of components]. Defaults to zero.componentHeatCapacityCoefficients: (Required) A 2D array containing the 5 polynomial coefficients ([number of components, 5].Unit tests:
testCompositionalEnthalpy.cpp:testHeatCapacityCoefficients.cpp:testCubicEOS.cpp,testSoreideWhitsonEOSPhaseModel.cpp: Extended existing EOS tests to specifically cover the new second-order temperature derivatives of theddaMixture) and the isolated EOS departure enthalpy values/derivatives.Requires a rebaseline because the ordering of the computations has landed into a state with small values which lead to small differences as below.