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

refactor: Add component selector for fluid models #3213

Merged
merged 18 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .integrated_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
baselines:
bucket: geosx
baseline: integratedTests/baseline_integratedTests-pr3006-5860-947a907
baseline: integratedTests/baseline_integratedTests-pr3213-6002-8736c9d

allow_fail:
all: ''
Expand Down
4 changes: 4 additions & 0 deletions BASELINE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This file is designed to track changes to the integrated test baselines.
Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining.
These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD).

PR #3213 (2024-07-06)
======================
Added baselines for new tests on Dirichlet boundary conditions for multiphase flow.

PR #3006 (2024-07-01)
======================
Added baselines for new tests. Relaxing tolerances for singlePhasePoromechanics_FaultModel_smoke.
Expand Down
227 changes: 227 additions & 0 deletions inputFiles/compositionalMultiphaseFlow/co2_flux_dirichlet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
<?xml version="1.0" ?>

<Problem>
<Solvers>
<CompositionalMultiphaseFVM
name="compflow"
logLevel="1"
discretization="fluidTPFA"
temperature="368.15"
useMass="1"
targetRegions="{ region }">
<NonlinearSolverParameters
newtonTol="1.0e-4"
newtonMaxIter="100"
maxTimeStepCuts="5"
lineSearchAction="None"/>
<LinearSolverParameters
solverType="fgmres"
preconditionerType="mgr"
krylovTol="1.0e-5"/>
</CompositionalMultiphaseFVM>
</Solvers>

<Mesh>
<InternalMesh
name="mesh"
elementTypes="{ C3D8 }"
xCoords="{ 0, 50.0 }"
yCoords="{ -0.5, 0.5 }"
zCoords="{ 0, 15.0 }"
nx="{ 50 }"
ny="{ 1 }"
nz="{ 15 }"
cellBlockNames="{ cellBlock }"/>
</Mesh>

<Geometry>
<Box
name="source"
xMin="{ -0.01, -0.51, 6.99 }"
xMax="{ 1.01, 0.51, 8.01 }"/>

<Box
name="rightEnd"
xMin="{ 49.99, -0.51, -0.01 }"
xMax="{ 50.01, 0.51, 15.01 }"/>
</Geometry>

<Events
maxTime="1e6">
<PeriodicEvent
name="solverApplications"
maxEventDt="5e4"
target="/Solvers/compflow" />

<PeriodicEvent
name="statistics"
timeFrequency="1e5"
targetExactTimestep="1"
target="/Tasks/compflowStatistics" />

<PeriodicEvent
name="outputs"
timeFrequency="1e5"
targetExactTimestep="1"
target="/Outputs/vtkOutput" />

<PeriodicEvent
name="restarts"
timeFrequency="5e5"
targetExactTimestep="0"
target="/Outputs/sidreRestart"/>
</Events>

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

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

<Constitutive>
<CO2BrinePhillipsFluid
name="fluid"
logLevel="1"
phaseNames="{ gas, water }"
componentNames="{ co2, water }"
componentMolarWeight="{ 44e-3, 18e-3 }"
phasePVTParaFiles="{ pvtgas.txt, pvtliquid.txt }"
flashModelParaFile="co2flash.txt"/>

<CompressibleSolidConstantPermeability
name="rock"
solidModelName="nullSolid"
porosityModelName="rockPorosity"
permeabilityModelName="rockPerm"/>
<NullModel
name="nullSolid"/>
<PressurePorosity
name="rockPorosity"
defaultReferencePorosity="0.2"
referencePressure="1.1e7"
compressibility="1.0e-9" />
<ConstantPermeability
name="rockPerm"
permeabilityComponents="{ 1.0e-13, 1.0e-13, 1.0e-14 }"/>

<TableRelativePermeability
name="relperm"
phaseNames="{ gas, water }"
wettingNonWettingRelPermTableNames="{ waterRelativePermeabilityTable,
gasRelativePermeabilityTable }"/>
</Constitutive>

<FieldSpecifications>
<!-- Initial conditions -->
<FieldSpecification
name="initial_pressure"
setNames="{ all }"
objectPath="ElementRegions/region"
fieldName="pressure"
initialCondition="1"
logLevel="2"
scale="1.1e6" />
<FieldSpecification
name="initial_temperature"
setNames="{ all }"
objectPath="ElementRegions/region"
fieldName="temperature"
initialCondition="1"
scale="368.15" />
<FieldSpecification
name="initial_co2"
setNames="{ all }"
objectPath="ElementRegions/region"
fieldName="globalCompFraction"
initialCondition="1"
component="0"
scale="0.0" />
<FieldSpecification
name="initial_h2o"
setNames="{ all }"
objectPath="ElementRegions/region"
fieldName="globalCompFraction"
initialCondition="1"
component="1"
scale="1.0" />

<!-- Injection rate: 0.002 kg/s -->
<SourceFlux
name="sourceTerm"
objectPath="ElementRegions/region/cellBlock"
component="0"
scale="-0.002"
setNames="{ source }"/>

<!-- Boundary conditions at right end -->
<FieldSpecification
name="sinkTerm_pressure"
setNames="{ rightEnd }"
objectPath="faceManager"
fieldName="pressure"
scale="1.1e6" />
<FieldSpecification
name="sinkTerm_temperature"
setNames="{ rightEnd }"
objectPath="faceManager"
fieldName="temperature"
scale="368.15" />
<FieldSpecification
name="sinkTerm_co2"
setNames="{ rightEnd }"
objectPath="faceManager"
fieldName="globalCompFraction"
component="0"
scale="0.0" />
<FieldSpecification
name="sinkTerm_h2o"
setNames="{ rightEnd }"
objectPath="faceManager"
fieldName="globalCompFraction"
component="1"
scale="1.0" />

</FieldSpecifications>

<Tasks>

<CompositionalMultiphaseStatistics
name="compflowStatistics"
flowSolverName="compflow"
logLevel="1"
writeCSV="1"
computeCFLNumbers="1"
computeRegionStatistics="1"/>

</Tasks>

<Functions>
<TableFunction
name="waterRelativePermeabilityTable"
coordinateFiles="{ phaseVolFraction_water.txt }"
voxelFile="relPerm_water.txt"/>

<TableFunction
name="gasRelativePermeabilityTable"
coordinateFiles="{ phaseVolFraction_gas.txt }"
voxelFile="relPerm_gas.txt"/>
</Functions>

<Outputs>
<VTK
name="vtkOutput"
plotFileRoot="co2_flux_dirichlet"/>

<Restart
name="sidreRestart"/>
</Outputs>

</Problem>
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ decks = [
restart_step=10,
check_step=20,
restartcheck_params=RestartcheckParameters(**restartcheck_params)),
TestDeck(
name="co2_flux_dirichlet",
description=
"Compositional co2-brine flow test (2D co2 injection, 2-phase co2-brine, Table 2-phase relperm curves, Dirichlet boundary)",
partitions=((1, 1, 1), (2, 1, 3)),
restart_step=23,
check_step=46,
restartcheck_params=RestartcheckParameters(**restartcheck_params)),
TestDeck(
name="deadoil_3ph_staircase_obl_3d",
description=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ CO2BrineFluid( string const & name, Group * const parent ):
}
}

template< typename PHASE1, typename PHASE2, typename FLASH >
bool CO2BrineFluid< PHASE1, PHASE2, FLASH >::isThermal() const
{
return ( PHASE1::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() &&
PHASE2::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() );
}


template< typename PHASE1, typename PHASE2, typename FLASH >
std::unique_ptr< ConstitutiveBase >
CO2BrineFluid< PHASE1, PHASE2, FLASH >::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ class CO2BrineFluid : public MultiFluidBase

virtual string getCatalogName() const override { return catalogName(); }

virtual bool isThermal() const override;
static constexpr bool thermal()
{
return !( std::is_same_v< typename PHASE1::Enthalpy, PVTProps::NoOpPVTFunction > ||
std::is_same_v< typename PHASE2::Enthalpy, PVTProps::NoOpPVTFunction > );
}

virtual bool isThermal() const override
{
return thermal();
}

/**
* @brief Kernel wrapper class for CO2BrineFluid.
Expand Down
Loading