GEOS icon indicating copy to clipboard operation
GEOS copied to clipboard

Making relative permeabilities tensorial

Open jafranc opened this issue 11 months ago • 1 comments

Aim

This PR aims at making relative permeabilities (aka relperm) a diagonal tensor, so one can vary their characteristics (exponents, max values for Brooks and Corey(BC) or Van Genuchten(VG)) or tables.

Its assumed that x,y,z direction are the same as for the faces normals.

Implementation

The implementation is widespread across the codebase. It involves adding dimension to relpPerm array and its derivatives, and so to mobility related arrays.

It also requires to rely on tensorial operator to derive phaseFlux.

Test

A simple box with gas injector and deadoil model as describle here

<?xml version="1.0" ?>

<Problem>
  <Solvers>
    <CompositionalMultiphaseFVM
      name="compflow"
      logLevel="1"
      discretization="fluidTPFA"
      targetRelativePressureChangeInTimeStep="1"
      targetPhaseVolFractionChangeInTimeStep="1"      
      targetRegions="{ Channel }"
      temperature="300">
      <NonlinearSolverParameters
        newtonTol="1.0e-6"
        newtonMaxIter="40"/>
      <LinearSolverParameters
        directParallel="0"/>
    </CompositionalMultiphaseFVM>
  </Solvers>

  <Mesh>
    <InternalMesh
      name="mesh"
      elementTypes="{ C3D8 }"
      xCoords="{ 0, 10 }"
      yCoords="{ 0, 10 }"
      zCoords="{ 0, 10 }"
      nx="{ 10 }"
      ny="{ 10 }"
      nz="{ 10 }"
      cellBlockNames="{ b00}"/>
  </Mesh>

  <Geometry>
    <Box
      name="source"
      xMin="{ 4.99, 4.99, 4.99 }"
      xMax="{ 6.01, 6.01, 6.01 }"/>
  </Geometry>

  <Events
    maxTime="2e8">
    <PeriodicEvent
      name="vtkOutputs"
      timeFrequency="1e7"
      target="/Outputs/vtkOutput"/>
    <PeriodicEvent
      name="solverApplications1"
      forceDt="1e5"
      endTime="1e6"
      target="/Solvers/compflow"/>
    <PeriodicEvent
      name="solverApplications2"
      forceDt="1e6"
      beginTime="1e6"
      endTime="1e7"
      target="/Solvers/compflow"/>
    <PeriodicEvent
      name="solverApplications3"
      forceDt="1e7"
      beginTime="1e7"
      target="/Solvers/compflow"/>
  </Events>

  <ElementRegions>
    <CellElementRegion
      name="Channel"
      cellBlocks="{ b00}"
      materialList="{ fluid, rock, relperm }"/>
  </ElementRegions>

  <NumericalMethods>
    <FiniteVolume>
      <TwoPointFluxApproximation
        name="fluidTPFA"/>
    </FiniteVolume>
  </NumericalMethods>

  <Constitutive>
    <DeadOilFluid
      name="fluid"
      phaseNames="{ gas, water, oil }"
      surfaceDensities="{ 0.9907, 1022.0, 800.0 }"
      componentMolarWeight="{ 16e-3, 18e-3, 114e-3 }"
      hydrocarbonFormationVolFactorTableNames="{ B_g_table, B_o_table }"
      hydrocarbonViscosityTableNames="{ visc_g_table, visc_o_table }"
      waterReferencePressure="1e5"
      waterFormationVolumeFactor="1.03"
      waterCompressibility="0.00000000041"
      waterViscosity="0.0003"/>

    <CompressibleSolidConstantPermeability
      name="rock"
      solidModelName="nullSolid"
      porosityModelName="rockPorosity"
      permeabilityModelName="rockPerm"/>

    <NullModel
      name="nullSolid"/>

    <PressurePorosity
      name="rockPorosity"
      defaultReferencePorosity="0.2"
      referencePressure="0.0"
      compressibility="1.0e-5"/>

    <BrooksCoreyBakerRelativePermeability
      name="relperm"
      phaseNames="{ gas, water, oil }"
      phaseMinVolumeFraction="{ 0.05, 0.05, 0.05 }"
      waterOilRelPermExponent="{ 2.5, 1.5 }"
      waterOilRelPermMaxValue="{ 0.8, 0.9 }"
      gasOilRelPermExponent="{ 3, 3 }"
      gasOilRelPermMaxValue="{ 0.4, 0.9 }"/>

    <ConstantPermeability
      name="rockPerm"
      permeabilityComponents="{ 1.0e-16, 1.0e-16, 1.0e-16 }"/>
  </Constitutive>

  <FieldSpecifications>
    <FieldSpecification
      name="initialPressure"
      initialCondition="1"
      setNames="{ all }"
      objectPath="ElementRegions/Channel"
      fieldName="pressure"
      scale="1e5"/>
    <FieldSpecification
      name="initialComposition_oil"
      initialCondition="1"
      setNames="{ all }"
      objectPath="ElementRegions/Channel"
      fieldName="globalCompFraction"
      component="0"
      scale="0.001"/>
    <FieldSpecification
      name="initialComposition_gas"
      initialCondition="1"
      setNames="{ all }"
      objectPath="ElementRegions/Channel"
      fieldName="globalCompFraction"
      component="1"
      scale="0.001"/>
    <FieldSpecification
      name="initialComposition_water"
      initialCondition="1"
      setNames="{ all }"
      objectPath="ElementRegions/Channel"
      fieldName="globalCompFraction"
      component="2"
      scale="0.998"/>
    <FieldSpecification
      name="sourceTermPressure"
      logLevel="1"
      objectPath="ElementRegions/Channel"
      fieldName="pressure"
      scale="1.5e5"
      setNames="{ source }"/>
    <!-- Injection temperature -->
    <FieldSpecification
      name="sourceTermTemperature"
      objectPath="ElementRegions/Channel"
      fieldName="temperature"
      scale="293"
      setNames="{ source }"/>
    <!-- Injection stream: mostly water -->
    <FieldSpecification
      name="sourceTermComposition_oil"
      setNames="{ source }"
      objectPath="ElementRegions/Channel"
      fieldName="globalCompFraction"
      component="0"
      scale="0.1"/>
    <FieldSpecification
      name="sourceTermComposition_gas"
      setNames="{ source }"
      objectPath="ElementRegions/Channel"
      fieldName="globalCompFraction"
      component="1"
      scale="0.8"/>
    <FieldSpecification
      name="sourceTermComposition_water"
      setNames="{ source }"
      objectPath="ElementRegions/Channel"
      fieldName="globalCompFraction"
      component="2"
      scale="0.1"/>
  </FieldSpecifications>

  <Functions>
    <TableFunction
      name="B_o_table"
      coordinates="{ 2068000, 5516000, 55160000 }"
      values="{ 1.05, 1.02, 1.01 }"/>
    <TableFunction
      name="visc_o_table"
      coordinates="{ 2068000, 5516000, 55160000 }"
      values="{ 0.00285, 0.00299, 0.003 }"/>
    <TableFunction
      name="B_g_table"
      coordinateFiles="{ pres_pvdg.txt }"
      voxelFile="B_g_pvdg.txt"/>
    <TableFunction
      name="visc_g_table"
      coordinateFiles="{ pres_pvdg.txt }"
      voxelFile="visc_pvdg.txt"/>
  </Functions>

  <Outputs>
    <VTK
      name="vtkOutput"/>
  </Outputs>
</Problem>

in which Constitutives block BrooksCoreyBakerRelativePermeability is substitute with:

    <BrooksCoreyBakerRelativePermeability
      name="relperm"
      phaseNames="{ gas, water, oil }"
      phaseMinVolumeFraction="{ 0.05, 0.05, 0.05 }"
      waterOilRelPermExponent="{ { 2.5, 1.5 }, {2.5,1.5}, {2.5,1.5}}"
      waterOilRelPermMaxValue="{ {0.8, 0.9},{0.8,0.9},{0.8,0.9} }"
      gasOilRelPermExponent="{ {3,3}, {3,3}, {3.,3.} }"
      gasOilRelPermMaxValue="{ {0.4, 0.9},{0.4,0.9},{0.4,0.9} }"/>

to check consistency and:

    <BrooksCoreyBakerRelativePermeability
      name="relperm"
      phaseNames="{ gas, water, oil }"
      phaseMinVolumeFraction="{ 0.05, 0.05, 0.05 }"
      waterOilRelPermExponent="{ { 2.5, 1.5 }, {2.5,1.5}, {3,4.5}}"
      waterOilRelPermMaxValue="{ {0.8, 0.9},{0.8,0.9},{0.4,0.5} }"
      gasOilRelPermExponent="{ {3,3}, {3,3}, {5.,5.} }"
      gasOilRelPermMaxValue="{ {0.4, 0.9},{0.4,0.9},{0.2,0.3} }"/>

to minor spread in z-direction as the exponent is steeper.

satg

To do

  • [x] Enable it for BC and VG
  • [x] Enable it for BC and VG with Baker 3-phases interpolator
  • [x] Enable it for BC and VG with Stone2 3-phases interpolator
  • [x] Enable it for Tables
  • [ ] Enable it for face-boundary condition
  • [ ] Check working for wells
  • [x] Check it is working for sources
  • [ ] Measure trade-off in efficiency

jafranc avatar Mar 07 '24 15:03 jafranc

Adding the tables now, requires few changes to xml input to read tensor of tables names (that may be dropped in the end).

satg

and new block:

    <TableRelativePermeability
      name="relperm"
      phaseNames="{ gas, water, oil }"
      wettingIntermediateRelPermTableNames="{ {waterRelativePermeabilityTable_x, waterOilRelativePermeabilityTable_x}, 
                                                                             {waterRelativePermeabilityTable_y, waterOilRelativePermeabilityTable_y},
                                                                             {waterRelativePermeabilityTable_z, waterOilRelativePermeabilityTable_z} }"
      nonWettingIntermediateRelPermTableNames="{ {gasOilRelativePermeabilityTable_x, gasRelativePermeabilityTable_x}, 
                                                                                   {gasOilRelativePermeabilityTable_y, gasRelativePermeabilityTable_y}, 
                                                                                   {gasOilRelativePermeabilityTable_z, gasRelativePermeabilityTable_z} }"/>

jafranc avatar Mar 08 '24 14:03 jafranc