From 6d37326ae12da2e5ee81e1bdaac02e880f470daa Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 6 Sep 2024 16:38:35 -0500 Subject: [PATCH 01/16] try this --- ...positionalMultiphaseFVMKernelUtilities.hpp | 40 ++++++++++++++++--- ...ermalCompositionalMultiphaseFVMKernels.cpp | 11 ++++- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp index 7284f48d985..25f5d15eeba 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp @@ -92,12 +92,19 @@ struct PotGrad real64 dProp_dC[numComp]{}; // calculate quantities on primary connected cells + integer denom = 0; for( integer i = 0; i < numFluxSupportPoints; ++i ) { localIndex const er = seri[i]; localIndex const esr = sesri[i]; localIndex const ei = sei[i]; + bool const phaseExists = (phaseVolFrac[er][esr][ei][ip] > 0); + if( !phaseExists ) + { + continue; + } + // density real64 const density = phaseMassDens[er][esr][ei][0][ip]; real64 const dDens_dP = dPhaseMassDens[er][esr][ei][0][ip][Deriv::dP]; @@ -109,12 +116,19 @@ struct PotGrad Deriv::dC ); // average density and derivatives - densMean += 0.5 * density; - dDensMean_dP[i] = 0.5 * dDens_dP; + densMean += density; + dDensMean_dP[i] = dDens_dP; for( integer jc = 0; jc < numComp; ++jc ) { - dDensMean_dC[i][jc] = 0.5 * dProp_dC[jc]; + dDensMean_dC[i][jc] = dProp_dC[jc]; } + denom++; + } + densMean /= denom; + dDensMean_dP[i] /= denom; + for( integer jc = 0; jc < numComp; ++jc ) + { + dDensMean_dC[i][jc] /= denom; } /// compute the TPFA potential difference @@ -1221,12 +1235,19 @@ struct computePotentialGravity } //inner loop to get average density + integer denom = 0; for( localIndex i = 0; i < numFluxSupportPoints; ++i ) { localIndex const er = seri[i]; localIndex const esr = sesri[i]; localIndex const ei = sei[i]; + bool const phaseExists = (phaseVolFrac[er][esr][ei][ip] > 0); + if( !phaseExists ) + { + continue; + } + // density real64 const density = phaseMassDens[er][esr][ei][0][ip]; real64 const dDens_dPres = dPhaseMassDens[er][esr][ei][0][ip][Deriv::dP]; @@ -1238,12 +1259,19 @@ struct computePotentialGravity Deriv::dC ); // average density and derivatives - densMean += 0.5 * density; - dDensMean_dPres[i] = 0.5 * dDens_dPres; + densMean += density; + dDensMean_dPres[i] = dDens_dPres; for( localIndex jc = 0; jc < numComp; ++jc ) { - dDensMean_dComp[i][jc] = 0.5 * dProp_dComp[jc]; + dDensMean_dComp[i][jc] = dProp_dComp[jc]; } + denom++; + } + densMean /= denom; + dDensMean_dP[i] /= denom; + for( integer jc = 0; jc < numComp; ++jc ) + { + dDensMean_dC[i][jc] /= denom; } // compute potential difference MPFA-style diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp index 6670a649a03..a3d8352dbe9 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp @@ -97,15 +97,24 @@ CFLFluxKernel:: real64 gravHead{}; // calculate quantities on primary connected cells + integer denom = 0; for( localIndex i = 0; i < NUM_ELEMS; ++i ) { localIndex const er = seri[i]; localIndex const esr = sesri[i]; localIndex const ei = sei[i]; + bool const phaseExists = (phaseVolFrac[er][esr][ei][ip] > 0); + if( !phaseExists ) + { + continue; + } + // average density across the face - densMean += 0.5 * phaseMassDens[er][esr][ei][0][ip]; + densMean += phaseMassDens[er][esr][ei][0][ip]; + denom++; } + densMean /= denom; //***** calculation of phase volumetric flux ***** From 1ca2272ed06edb9b6948040762b4e3a172378780 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 6 Sep 2024 18:40:38 -0500 Subject: [PATCH 02/16] build fix --- ...positionalMultiphaseFVMKernelUtilities.hpp | 43 +++++++++++++++---- ...ermalCompositionalMultiphaseFVMKernels.cpp | 3 +- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp index 25f5d15eeba..d01f1c5149f 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp @@ -56,6 +56,7 @@ struct PotGrad real64 const ( &dTrans_dPres )[numFluxSupportPoints], ElementViewConst< arrayView1d< real64 const > > const & pres, ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, @@ -125,10 +126,13 @@ struct PotGrad denom++; } densMean /= denom; - dDensMean_dP[i] /= denom; - for( integer jc = 0; jc < numComp; ++jc ) + for( integer i = 0; i < numFluxSupportPoints; ++i ) { - dDensMean_dC[i][jc] /= denom; + dDensMean_dP[i] /= denom; + for( integer jc = 0; jc < numComp; ++jc ) + { + dDensMean_dC[i][jc] /= denom; + } } /// compute the TPFA potential difference @@ -330,6 +334,7 @@ struct PPUPhaseFlux ElementViewConst< arrayView1d< real64 const > > const & gravCoef, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const & phaseCompFrac, ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const & dPhaseCompFrac, @@ -352,7 +357,7 @@ struct PPUPhaseFlux real64 dGravHead_dP[numFluxSupportPoints]{}; real64 dGravHead_dC[numFluxSupportPoints][numComp]{}; PotGrad::compute< numComp, numFluxSupportPoints >( numPhase, ip, hasCapPressure, seri, sesri, sei, trans, dTrans_dPres, pres, - gravCoef, dPhaseVolFrac, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, + gravCoef, phaseVolFrac, dPhaseVolFrac, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, potGrad, dPresGrad_dP, dPresGrad_dC, dGravHead_dP, dGravHead_dC ); @@ -444,6 +449,7 @@ struct C1PPUPhaseFlux ElementViewConst< arrayView1d< real64 const > > const & gravCoef, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const & phaseCompFrac, ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const & dPhaseCompFrac, @@ -466,7 +472,7 @@ struct C1PPUPhaseFlux real64 dGravHead_dP[numFluxSupportPoints]{}; real64 dGravHead_dC[numFluxSupportPoints][numComp]{}; PotGrad::compute< numComp, numFluxSupportPoints >( numPhase, ip, hasCapPressure, seri, sesri, sei, trans, dTrans_dPres, pres, - gravCoef, dPhaseVolFrac, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, + gravCoef, phaseVolFrac, dPhaseVolFrac, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, potGrad, dPresGrad_dP, dPresGrad_dC, dGravHead_dP, dGravHead_dC ); @@ -674,6 +680,7 @@ upwindMobilityGravity( localIndex const numPhase, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, @@ -708,6 +715,7 @@ upwindMobilityGravity( localIndex const numPhase, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -938,6 +946,7 @@ computeFractionalFlowGravity( localIndex const numPhase, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, @@ -987,6 +996,7 @@ computeFractionalFlowGravity( localIndex const numPhase, dPhaseMassDens, phaseMob, dPhaseMob, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -1206,6 +1216,7 @@ struct computePotentialGravity ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & GEOS_UNUSED_PARAM( dPhaseVolFrac ), ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & @@ -1268,10 +1279,13 @@ struct computePotentialGravity denom++; } densMean /= denom; - dDensMean_dP[i] /= denom; - for( integer jc = 0; jc < numComp; ++jc ) + for( localIndex i = 0; i < numFluxSupportPoints; ++i ) { - dDensMean_dC[i][jc] /= denom; + dDensMean_dPres[i] /= denom; + for( integer jc = 0; jc < numComp; ++jc ) + { + dDensMean_dComp[i][jc] /= denom; + } } // compute potential difference MPFA-style @@ -1384,6 +1398,7 @@ static void computePotentialFluxesGravity( localIndex const numPhase, ElementViewConst< arrayView1d< real64 const > > const & gravCoef, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, @@ -1420,6 +1435,7 @@ static void computePotentialFluxesGravity( localIndex const numPhase, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -1449,6 +1465,7 @@ static void computePotentialFluxesGravity( localIndex const numPhase, dPhaseMassDens, phaseMob, dPhaseMob, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -1482,6 +1499,7 @@ static void computePotentialFluxesGravity( localIndex const numPhase, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -1513,6 +1531,7 @@ static void computePotentialFluxesGravity( localIndex const numPhase, dPhaseMassDens, phaseMob, dPhaseMob, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -1842,6 +1861,7 @@ class UpwindScheme ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, @@ -1867,6 +1887,7 @@ class UpwindScheme dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -2064,6 +2085,7 @@ class HybridUpwind : public UpwindScheme ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, @@ -2097,6 +2119,7 @@ class HybridUpwind : public UpwindScheme dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, + phaseVolFrac, dPhaseVolFrac, phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, @@ -2222,6 +2245,7 @@ struct IHUPhaseFlux ElementViewConst< arrayView1d< real64 const > > const & gravCoef, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const & phaseCompFrac, ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const & dPhaseCompFrac, @@ -2264,7 +2288,7 @@ struct IHUPhaseFlux trans, dTrans_dPres, pres, gravCoef, phaseMob, dPhaseMob, - dPhaseVolFrac, + phaseVolFrac, dPhaseVolFrac, phaseCompFrac, dPhaseCompFrac, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens, @@ -2407,6 +2431,7 @@ struct IHUPhaseFlux gravCoef, phaseMob, dPhaseMob, + phaseVolFrac, dPhaseVolFrac, dCompFrac_dCompDens, phaseMassDens, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp index a3d8352dbe9..4dcbfacd452 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp @@ -51,8 +51,9 @@ FaceBasedAssemblyKernelBase::FaceBasedAssemblyKernelBase( integer const numPhase m_ghostRank( compFlowAccessors.get( fields::ghostRank {} ) ), m_gravCoef( compFlowAccessors.get( fields::flow::gravityCoefficient {} ) ), m_pres( compFlowAccessors.get( fields::flow::pressure {} ) ), - m_dCompFrac_dCompDens( compFlowAccessors.get( fields::flow::dGlobalCompFraction_dGlobalCompDensity {} ) ), + m_phaseVolFrac( compFlowAccessors.get( fields::flow::phaseVolumeFraction {} ) ), m_dPhaseVolFrac( compFlowAccessors.get( fields::flow::dPhaseVolumeFraction {} ) ), + m_dCompFrac_dCompDens( compFlowAccessors.get( fields::flow::dGlobalCompFraction_dGlobalCompDensity {} ) ), m_phaseCompFrac( multiFluidAccessors.get( fields::multifluid::phaseCompFraction {} ) ), m_dPhaseCompFrac( multiFluidAccessors.get( fields::multifluid::dPhaseCompFraction {} ) ), m_localMatrix( localMatrix ), From d9e17972701c750e528137399754080526b94714 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 6 Sep 2024 18:44:33 -0500 Subject: [PATCH 03/16] code style --- .../IsothermalCompositionalMultiphaseFVMKernels.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp index 08359bc0d6a..4c6bd9729a4 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp @@ -373,10 +373,13 @@ class FaceBasedAssemblyKernelBase /// Views on pressure ElementViewConst< arrayView1d< real64 const > > const m_pres; - /// Views on derivatives of phase volume fractions and comp fractions - ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const m_dCompFrac_dCompDens; + /// Views on phase volume fractions + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const m_phaseVolFrac; ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const m_dPhaseVolFrac; + /// Views on derivatives of comp fractions + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const m_dCompFrac_dCompDens; + /// Views on phase component fractions ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const m_phaseCompFrac; ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const m_dPhaseCompFrac; @@ -632,7 +635,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase m_pres, m_gravCoef, m_phaseMob, m_dPhaseMob, - m_dPhaseVolFrac, + m_phaseVolFrac, m_dPhaseVolFrac, m_phaseCompFrac, m_dPhaseCompFrac, m_dCompFrac_dCompDens, m_phaseMassDens, m_dPhaseMassDens, @@ -658,7 +661,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase m_pres, m_gravCoef, m_phaseMob, m_dPhaseMob, - m_dPhaseVolFrac, + m_phaseVolFrac, m_dPhaseVolFrac, m_phaseCompFrac, m_dPhaseCompFrac, m_dCompFrac_dCompDens, m_phaseMassDens, m_dPhaseMassDens, @@ -684,7 +687,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase m_pres, m_gravCoef, m_phaseMob, m_dPhaseMob, - m_dPhaseVolFrac, + m_phaseVolFrac, m_dPhaseVolFrac, m_phaseCompFrac, m_dPhaseCompFrac, m_dCompFrac_dCompDens, m_phaseMassDens, m_dPhaseMassDens, From a65518d7d4373c4f3090ec4dd4487d076e1d1261 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 6 Sep 2024 20:24:26 -0500 Subject: [PATCH 04/16] crash fix --- ...positionalMultiphaseFVMKernelUtilities.hpp | 26 ++++++++++++------- ...ermalCompositionalMultiphaseFVMKernels.cpp | 5 +++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp index d01f1c5149f..74fbcc116c5 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp @@ -125,13 +125,16 @@ struct PotGrad } denom++; } - densMean /= denom; - for( integer i = 0; i < numFluxSupportPoints; ++i ) + if(denom > 0) { - dDensMean_dP[i] /= denom; - for( integer jc = 0; jc < numComp; ++jc ) + densMean /= denom; + for( integer i = 0; i < numFluxSupportPoints; ++i ) { - dDensMean_dC[i][jc] /= denom; + dDensMean_dP[i] /= denom; + for( integer jc = 0; jc < numComp; ++jc ) + { + dDensMean_dC[i][jc] /= denom; + } } } @@ -1278,13 +1281,16 @@ struct computePotentialGravity } denom++; } - densMean /= denom; - for( localIndex i = 0; i < numFluxSupportPoints; ++i ) + if(denom > 0) { - dDensMean_dPres[i] /= denom; - for( integer jc = 0; jc < numComp; ++jc ) + densMean /= denom; + for( localIndex i = 0; i < numFluxSupportPoints; ++i ) { - dDensMean_dComp[i][jc] /= denom; + dDensMean_dPres[i] /= denom; + for( integer jc = 0; jc < numComp; ++jc ) + { + dDensMean_dComp[i][jc] /= denom; + } } } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp index 4dcbfacd452..2ff8e43540f 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp @@ -115,7 +115,10 @@ CFLFluxKernel:: densMean += phaseMassDens[er][esr][ei][0][ip]; denom++; } - densMean /= denom; + if(denom > 0) + { + densMean /= denom; + } //***** calculation of phase volumetric flux ***** From 1586b23f654a5206f09e0b55b17afed64921dbb7 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 6 Sep 2024 20:31:08 -0500 Subject: [PATCH 05/16] code style --- .../IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp | 4 ++-- .../fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp index 74fbcc116c5..232f07915b8 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp @@ -125,7 +125,7 @@ struct PotGrad } denom++; } - if(denom > 0) + if( denom > 0 ) { densMean /= denom; for( integer i = 0; i < numFluxSupportPoints; ++i ) @@ -1281,7 +1281,7 @@ struct computePotentialGravity } denom++; } - if(denom > 0) + if( denom > 0 ) { densMean /= denom; for( localIndex i = 0; i < numFluxSupportPoints; ++i ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp index 2ff8e43540f..c52e543ea21 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp @@ -115,7 +115,7 @@ CFLFluxKernel:: densMean += phaseMassDens[er][esr][ei][0][ip]; denom++; } - if(denom > 0) + if( denom > 0 ) { densMean /= denom; } From 84eedc356f4e899c26e6d7e0da721034682f5c2b Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 9 Sep 2024 12:22:12 -0500 Subject: [PATCH 06/16] Update build_and_test.yml --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 11d2761b90f..6de506355e4 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -8,7 +8,7 @@ on: BUILD_SHARED_LIBS: required: false type: string - default: 'ON' + default: 'OFF' BUILD_TYPE: required: false type: string From 2015ab5486c2e0b7ca32716484f079e081be36d1 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 9 Sep 2024 12:22:44 -0500 Subject: [PATCH 07/16] Update ci_tests.yml --- .github/workflows/ci_tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 54b0c791efa..dcb5f73eb20 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -149,17 +149,17 @@ jobs: - name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 - BUILD_SHARED_LIBS: ON + BUILD_SHARED_LIBS: OFF - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces CMAKE_BUILD_TYPE: Debug DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - BUILD_SHARED_LIBS: ON + BUILD_SHARED_LIBS: OFF - name: Ubuntu (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - BUILD_SHARED_LIBS: ON + BUILD_SHARED_LIBS: OFF - name: Ubuntu (22.04, gcc 11.4.0, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release @@ -167,21 +167,21 @@ jobs: ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF GCP_BUCKET: geosx/ubuntu22.04-gcc11 - BUILD_SHARED_LIBS: ON + BUILD_SHARED_LIBS: OFF - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12 ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF - BUILD_SHARED_LIBS: ON + BUILD_SHARED_LIBS: OFF - name: Ubuntu (22.04, clang 15.0.7, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu22.04-clang15 ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF - BUILD_SHARED_LIBS: ON + BUILD_SHARED_LIBS: OFF uses: ./.github/workflows/build_and_test.yml with: From fd5eb3f981f40d86586c986788ca8c8cb03ca3dc Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 9 Sep 2024 16:39:32 -0500 Subject: [PATCH 08/16] Update build_and_test.yml --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6de506355e4..11d2761b90f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -8,7 +8,7 @@ on: BUILD_SHARED_LIBS: required: false type: string - default: 'OFF' + default: 'ON' BUILD_TYPE: required: false type: string From e20f3984ac82163b905cbeaf501fe257d0c08cb6 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 9 Sep 2024 16:40:04 -0500 Subject: [PATCH 09/16] Update ci_tests.yml --- .github/workflows/ci_tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index dcb5f73eb20..54b0c791efa 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -149,17 +149,17 @@ jobs: - name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 - BUILD_SHARED_LIBS: OFF + BUILD_SHARED_LIBS: ON - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces CMAKE_BUILD_TYPE: Debug DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - BUILD_SHARED_LIBS: OFF + BUILD_SHARED_LIBS: ON - name: Ubuntu (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - BUILD_SHARED_LIBS: OFF + BUILD_SHARED_LIBS: ON - name: Ubuntu (22.04, gcc 11.4.0, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release @@ -167,21 +167,21 @@ jobs: ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF GCP_BUCKET: geosx/ubuntu22.04-gcc11 - BUILD_SHARED_LIBS: OFF + BUILD_SHARED_LIBS: ON - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12 ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF - BUILD_SHARED_LIBS: OFF + BUILD_SHARED_LIBS: ON - name: Ubuntu (22.04, clang 15.0.7, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu22.04-clang15 ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF - BUILD_SHARED_LIBS: OFF + BUILD_SHARED_LIBS: ON uses: ./.github/workflows/build_and_test.yml with: From 07fd4d9947d7061234ccb3dc695575cf3c84da88 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 9 Sep 2024 16:53:17 -0500 Subject: [PATCH 10/16] Update IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp --- .../IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp index 232f07915b8..323f3e362d0 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp @@ -125,7 +125,7 @@ struct PotGrad } denom++; } - if( denom > 0 ) + if( denom > 1 ) { densMean /= denom; for( integer i = 0; i < numFluxSupportPoints; ++i ) @@ -1281,7 +1281,7 @@ struct computePotentialGravity } denom++; } - if( denom > 0 ) + if( denom > 1 ) { densMean /= denom; for( localIndex i = 0; i < numFluxSupportPoints; ++i ) From 52f85424e1b03dcc748145d3e1938ed74cde0da0 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 9 Sep 2024 16:54:00 -0500 Subject: [PATCH 11/16] Update IsothermalCompositionalMultiphaseFVMKernels.cpp --- .../fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp index c52e543ea21..5f584228a46 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.cpp @@ -115,7 +115,7 @@ CFLFluxKernel:: densMean += phaseMassDens[er][esr][ei][0][ip]; denom++; } - if( denom > 0 ) + if( denom > 1 ) { densMean /= denom; } From e02a10a5c98d22db94fa0fd94cc79f2a1fe9ebd7 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 18:45:15 -0500 Subject: [PATCH 12/16] Update .integrated_tests.yaml --- .integrated_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.integrated_tests.yaml b/.integrated_tests.yaml index b2984372dd6..7dfb476e515 100644 --- a/.integrated_tests.yaml +++ b/.integrated_tests.yaml @@ -1,6 +1,6 @@ baselines: bucket: geosx - baseline: integratedTests/baseline_integratedTests-pr3364-7912-d967424 + baseline: integratedTests/baseline_integratedTests-pr3337-8037-b4d909a allow_fail: all: '' From 7e3dd713c21da127a53e9df56c425426360862b0 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 18:46:07 -0500 Subject: [PATCH 13/16] Update BASELINE_NOTES.md --- BASELINE_NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BASELINE_NOTES.md b/BASELINE_NOTES.md index 426b3bc7980..7884cb6fc47 100644 --- a/BASELINE_NOTES.md +++ b/BASELINE_NOTES.md @@ -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 #3337( 2024-10-04) +===================== +Another density treatment for gravity in flow solvers. + PR #3364( 2024-10-01) ===================== Separate mass and volume residuals for output in compositional flow solver. Baseline update because of minor numerical diffs. From 1a212536b1079bfde8c0e354ae7ac4bde37c9012 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 1 Nov 2024 13:59:17 -0500 Subject: [PATCH 14/16] add thermal --- ...ermalCompositionalMultiphaseFVMKernels.hpp | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp index 98d4be4d813..2f5deea41d6 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp @@ -47,7 +47,6 @@ class PhaseMobilityKernel : public isothermalCompositionalMultiphaseFVMKernels:: using Base = isothermalCompositionalMultiphaseFVMKernels::PhaseMobilityKernel< NUM_COMP, NUM_PHASE >; using Base::numPhase; using Base::m_dPhaseVolFrac; - using Base::m_dPhaseMob; using Base::m_phaseDens; using Base::m_dPhaseDens; using Base::m_phaseVisc; @@ -182,9 +181,8 @@ class FaceBasedAssemblyKernel : public isothermalCompositionalMultiphaseFVMKerne using AbstractBase::m_dt; using AbstractBase::m_numPhases; - using AbstractBase::m_rankOffset; - using AbstractBase::m_dofNumber; using AbstractBase::m_gravCoef; + using AbstractBase::m_phaseVolFrac; using AbstractBase::m_dPhaseVolFrac; using AbstractBase::m_phaseCompFrac; using AbstractBase::m_dPhaseCompFrac; @@ -194,9 +192,7 @@ class FaceBasedAssemblyKernel : public isothermalCompositionalMultiphaseFVMKerne using Base::numComp; using Base::numDof; using Base::numEqn; - using Base::maxNumElems; using Base::maxNumConns; - using Base::maxStencilSize; using Base::numFluxSupportPoints; using Base::m_phaseMob; using Base::m_dPhaseMob; @@ -343,14 +339,28 @@ class FaceBasedAssemblyKernel : public isothermalCompositionalMultiphaseFVMKerne real64 dConvectiveEnergyFlux_dC[numFluxSupportPoints][numComp]{}; real64 dCompFlux_dT[numFluxSupportPoints][numComp]{}; + integer denom = 0; for( integer i = 0; i < numFluxSupportPoints; ++i ) { localIndex const er = seri[i]; localIndex const esr = sesri[i]; localIndex const ei = sei[i]; - real64 const dDens_dT = m_dPhaseMassDens[er][esr][ei][0][ip][Deriv::dT]; - dDensMean_dT[i] = 0.5 * dDens_dT; + bool const phaseExists = (m_phaseVolFrac[er_up][esr_up][ei_up][ip] > 0); + if( !phaseExists ) + { + continue; + } + + dDensMean_dT[i] = 0.5 * m_dPhaseMassDens[er][esr][ei][0][ip][Deriv::dT]; + denom++; + } + if( denom > 1 ) + { + for( integer i = 0; i < numFluxSupportPoints; ++i ) + { + dDensMean_dT[i] /= denom; + } } // Step 2: compute the derivatives of the phase potential difference wrt temperature @@ -1016,9 +1026,6 @@ class DirichletFaceBasedAssemblyKernel : public isothermalCompositionalMultiphas using PermeabilityAccessors = AbstractBase::PermeabilityAccessors; using AbstractBase::m_dt; - using AbstractBase::m_numPhases; - using AbstractBase::m_rankOffset; - using AbstractBase::m_dofNumber; using AbstractBase::m_gravCoef; using AbstractBase::m_phaseCompFrac; using AbstractBase::m_dPhaseCompFrac; @@ -1031,7 +1038,6 @@ class DirichletFaceBasedAssemblyKernel : public isothermalCompositionalMultiphas using Base::m_phaseMob; using Base::m_dPhaseMob; using Base::m_dPhaseMassDens; - using Base::m_dPhaseCapPressure_dPhaseVolFrac; using Base::m_stencilWrapper; using Base::m_seri; using Base::m_sesri; From e3d33f889915ef3b181ea5a45a62dd6638fc5f11 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Wed, 6 Nov 2024 18:02:15 -0600 Subject: [PATCH 15/16] Update .integrated_tests.yaml --- .integrated_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.integrated_tests.yaml b/.integrated_tests.yaml index 10e550a6c13..85dd1523a2b 100644 --- a/.integrated_tests.yaml +++ b/.integrated_tests.yaml @@ -1,6 +1,6 @@ baselines: bucket: geosx - baseline: integratedTests/baseline_integratedTests-pr3408-8504-5db9ba0 + baseline: integratedTests/baseline_integratedTests-pr3337-8529-a3e5cb6 allow_fail: all: '' From 48f2ef87d0e40de5f39238ef63d140457cbbf7dc Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Wed, 6 Nov 2024 18:03:08 -0600 Subject: [PATCH 16/16] Update BASELINE_NOTES.md --- BASELINE_NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BASELINE_NOTES.md b/BASELINE_NOTES.md index cc7aecdfb34..89f53d9f0c0 100644 --- a/BASELINE_NOTES.md +++ b/BASELINE_NOTES.md @@ -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 #3337 (2024-11-06) +==================== +Change density treatment for gravity in multiphase flow solver. + PR #3408 (2024-11-06) ==================== EFEM bugfixes: effective traction + oldStress.