Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add constant k-value flash #3299

Draft
wants to merge 100 commits into
base: develop
Choose a base branch
from

Conversation

dkachuma
Copy link
Contributor

@dkachuma dkachuma commented Aug 22, 2024

Implements a constant k-value compositional fluid model using a compositional density and LBC viscosity. With this model, k-values are dependent only on pressure and temperature but not composition. The user provides a 2D table of k-values for each component as in the example below

<Constitutive>
    <CompositionalKValueFluidLohrenzBrayClark
      name="kValue2Phase"
      phaseNames="{ oil, gas }"
      componentNames="{ CO2, N2, C1, C2, C3, C4, C5, C6, C7+ }"
      kValueTables="{ KV1, KV2, KV3, KV4, KV5, KV6, KV7, KV8, KV9 }" />
  </Constitutive>
<Functions>
    <TableFunction
      name="KV9"
      voxelFile="testPVT_data/testPVT_KValue_kvalue9.csv"
      coordinateFiles="{ testPVT_data/testPVT_KValue_pressure.csv, testPVT_data/testPVT_KValue_temperature.csv  }"
      interpolation="linear"
      inputVarNames="{ pressure, temperature }" />

    <SymbolicFunction
      name="KV1"
      expression="(3.0620e+00+8.9414e+02/p+1.1912e-02*p)*exp(-5.3659e+02/(t-1.1951e+02))"
      variableNames="{ p, t }" 
      inputVarNames="{ pressure, temperature }" />
</Functions>

The calculation then looks up the values from this table and does a single Rachford-Rice solve to determine the phase split.

The user provided tables are used to create a 4D hypercube at sample values of p and t. This hypercube is then used to do the actual computation of the k-values. The user can select the points at which this sampling is done.

@dkachuma dkachuma marked this pull request as ready for review December 10, 2024 03:09
@dkachuma dkachuma changed the title feature: Add constant k-value flash feat: Add constant k-value flash Dec 10, 2024
@dkachuma dkachuma added ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI ci: run code coverage enables running of the code coverage CI jobs labels Dec 10, 2024
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 90.17857% with 55 lines in your changes missing coverage. Please review.

Project coverage is 57.10%. Comparing base (7e2c33b) to head (45865ff).

Files with missing lines Patch % Lines
...uid/compositional/models/KValueFlashParameters.cpp 76.23% 48 Missing ⚠️
...nstitutiveTests/testMultiFluidKValueFlashModel.cpp 97.89% 5 Missing ⚠️
...ltifluid/compositional/models/KValueFlashModel.hpp 97.53% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3299      +/-   ##
===========================================
+ Coverage    56.89%   57.10%   +0.21%     
===========================================
  Files         1154     1159       +5     
  Lines        99885   100443     +558     
===========================================
+ Hits         56825    57362     +537     
- Misses       43060    43081      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}
else
{
GEOS_ERROR( GEOS_FMT( "Rachford-Rice solve for {} phases not implemented.", NUM_PHASE ));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no 3 phase yet, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. Need to write the 3-phase RR solver.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i see, maybe let's disable 3 phase completely for now?

template<>
struct KValueFlashName< 3 >
{
static constexpr char const * name = "ThreePhaseKValue";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe no big need for these two, can be done directly with catalogName

{
string pressureTableName;
string temperatureTableName;
m_parameters->createTables( functionName(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it going to create those tables every time?

integer const numDofs = 2 + m_numComponents;

// Calculate k-values at p,t
real64 pa = 0.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these manipulations would be easier to understand with some comments

if( numPressurePoints == 1 )
{
numPressurePoints = 2;
maxPressure = minPressure + 1.0e7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to say something about the ranges here

}

template< integer NUM_PHASE >
bool KValueFlashParameters< NUM_PHASE >::isIncreasing( arraySlice1d< real64 const > const & array )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go into some utils place

Copy link
Contributor

@paveltomin paveltomin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also add an xml into inputFiles

@dkachuma dkachuma marked this pull request as draft December 13, 2024 13:02
@dkachuma
Copy link
Contributor Author

Setting this back to draft. Need to work on 3-phase RR solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: run code coverage enables running of the code coverage CI jobs ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants