Skip to content

Commit 9099e16

Browse files
author
Francois Hamon
authored
Added global damping based on density change in CompositionalFlow/WellSolvers (#1065)
* implemented global damping based on compDens relative change * changed a well integrated test to use CO2; fixed PVT bug * fixed bug and division by zero in properties * consolidated the constants
1 parent 5dcb66c commit 9099e16

23 files changed

Lines changed: 580 additions & 169 deletions

integratedTests

src/coreComponents/constitutive/fluid/PVTFunctions/CO2SolubilityFunction.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,13 @@ using namespace stringutilities;
2828
namespace PVTProps
2929
{
3030

31+
constexpr real64 minForDivision = 1e-10;
32+
3133
constexpr real64 T_K_f = 273.15;
3234
constexpr real64 P_Pa_f = 1e+5;
33-
3435
constexpr real64 P_c = 73.773 * P_Pa_f;
3536
constexpr real64 T_c = 304.1282;
36-
//constexpr real64 rho_c = 467.6;
37-
38-
//constexpr real64 R = 188.9241;
39-
4037
constexpr real64 Rgas = 8.314467;
41-
4238
constexpr real64 V_c = Rgas*T_c/P_c;
4339

4440
constexpr real64 acoef[] =
@@ -335,7 +331,6 @@ void CO2SolubilityFunction::Partition( EvalVarArgs const & pressure, EvalVarArgs
335331
solubility = m_CO2SolubilityTable->Value( P, T );
336332

337333
real64 const waterMW = m_componentMolarWeight[m_waterIndex];
338-
// real64 CO2MW = m_componentMolarWeight[m_CO2Index];
339334

340335
solubility *= waterMW;
341336

@@ -346,7 +341,14 @@ void CO2SolubilityFunction::Partition( EvalVarArgs const & pressure, EvalVarArgs
346341

347342
//Y = C/W = z/(1-z)
348343

349-
Y = compFraction[m_CO2Index] / (1.0 - compFraction[m_CO2Index]);
344+
if( compFraction[m_CO2Index].m_var > 1.0 - minForDivision )
345+
{
346+
Y = compFraction[m_CO2Index] / minForDivision;
347+
}
348+
else
349+
{
350+
Y = compFraction[m_CO2Index] / (1.0 - compFraction[m_CO2Index]);
351+
}
350352

351353
if( Y < X )
352354
{
@@ -356,7 +358,9 @@ void CO2SolubilityFunction::Partition( EvalVarArgs const & pressure, EvalVarArgs
356358
phaseFraction[m_phaseGasIndex] = 0.0;
357359

358360
for( localIndex c = 0; c < m_componentNames.size(); ++c )
361+
{
359362
phaseCompFraction[m_phaseLiquidIndex][c] = compFraction[c];
363+
}
360364

361365
}
362366
else

src/coreComponents/constitutive/relativePermeability/BrooksCoreyRelativePermeability.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ BrooksCoreyRelativePermeabilityUpdate::
173173
}
174174
else
175175
{
176-
phaseRelPerm[ip] = (satScaled < 0.0) ? 0.0 : scale;
176+
phaseRelPerm[ip] = (satScaled <= 0.0) ? 0.0 : scale;
177177
}
178178
}
179179
}
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11

22

3-
========================= ============ ======== ======================================================================================================================================================================================================================================================================================================================
4-
Name Type Default Description
5-
========================= ============ ======== ======================================================================================================================================================================================================================================================================================================================
6-
capPressureNames string_array {} Name of the capillary pressure constitutive model to use
7-
cflFactor real64 0.5 Factor to apply to the `CFL condition <http://en.wikipedia.org/wiki/Courant-Friedrichs-Lewy_condition>`_ when calculating the maximum allowable time step. Values should be in the interval (0,1]
8-
discretization string required Name of discretization object to use for this solver.
9-
fluidNames string_array required Names of fluid constitutive models for each region.
10-
initialDt real64 1e+99 Initial time-step value required by the solver to the event manager.
11-
inputFluxEstimate real64 1 Initial estimate of the input flux used only for residual scaling. This should be essentially equivalent to the input flux * dt.
12-
logLevel integer 0 Log level
13-
meanPermCoeff real64 1 Coefficient to move between harmonic mean (1.0) and arithmetic mean (0.0) for the calculation of permeability between elements.
14-
name string required A name is required for any non-unique nodes
15-
relPermNames string_array required Name of the relative permeability constitutive model to use
16-
solidNames string_array required Names of solid constitutive models for each region.
17-
targetRegions string_array required Allowable regions that the solver may be applied to. Note that this does not indicate that the solver will be applied to these regions, only that allocation will occur such that the solver may be applied to these regions. The decision about what regions this solver will beapplied to rests in the EventManager.
18-
temperature real64 required Temperature
19-
useMass integer 0 Use mass formulation instead of molar
20-
LinearSolverParameters node unique :ref:`XML_LinearSolverParameters`
21-
NonlinearSolverParameters node unique :ref:`XML_NonlinearSolverParameters`
22-
========================= ============ ======== ======================================================================================================================================================================================================================================================================================================================
3+
============================= ============ ======== ======================================================================================================================================================================================================================================================================================================================
4+
Name Type Default Description
5+
============================= ============ ======== ======================================================================================================================================================================================================================================================================================================================
6+
allowLocalCompDensityChopping integer 1 Flag indicating whether local (cell-wise) chopping of negative compositions is allowed
7+
capPressureNames string_array {} Name of the capillary pressure constitutive model to use
8+
cflFactor real64 0.5 Factor to apply to the `CFL condition <http://en.wikipedia.org/wiki/Courant-Friedrichs-Lewy_condition>`_ when calculating the maximum allowable time step. Values should be in the interval (0,1]
9+
discretization string required Name of discretization object to use for this solver.
10+
fluidNames string_array required Names of fluid constitutive models for each region.
11+
initialDt real64 1e+99 Initial time-step value required by the solver to the event manager.
12+
inputFluxEstimate real64 1 Initial estimate of the input flux used only for residual scaling. This should be essentially equivalent to the input flux * dt.
13+
logLevel integer 0 Log level
14+
maxCompFractionChange real64 1 Maximum (absolute) change in a component fraction between two Newton iterations
15+
meanPermCoeff real64 1 Coefficient to move between harmonic mean (1.0) and arithmetic mean (0.0) for the calculation of permeability between elements.
16+
name string required A name is required for any non-unique nodes
17+
relPermNames string_array required Name of the relative permeability constitutive model to use
18+
solidNames string_array required Names of solid constitutive models for each region.
19+
targetRegions string_array required Allowable regions that the solver may be applied to. Note that this does not indicate that the solver will be applied to these regions, only that allocation will occur such that the solver may be applied to these regions. The decision about what regions this solver will beapplied to rests in the EventManager.
20+
temperature real64 required Temperature
21+
useMass integer 0 Use mass formulation instead of molar
22+
LinearSolverParameters node unique :ref:`XML_LinearSolverParameters`
23+
NonlinearSolverParameters node unique :ref:`XML_NonlinearSolverParameters`
24+
============================= ============ ======== ======================================================================================================================================================================================================================================================================================================================
2325

2426

0 commit comments

Comments
 (0)