-
Notifications
You must be signed in to change notification settings - Fork 89
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 immiscible multiphase flow package #3251
base: develop
Are you sure you want to change the base?
Conversation
src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlowFields.hpp
Outdated
Show resolved
Hide resolved
src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlowFields.hpp
Outdated
Show resolved
Hide resolved
.vscode-codespaces/launch.json
Outdated
"program": "${userHome}/two-phase/GEOS/install-ubuntu22-debug/bin/geosx", | ||
"args": ["-i", "/home/rpiazza/two-phase/GEOS/inputFiles/immiscibleMultiphaseFlow/immiscible_2phaseFlow_1d.xml", "-o", "${userHome}/geos-output"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these changes.
|
||
real64 ImmiscibleMultiphaseFlow::setNextDt( const geos::real64 & currentDt, geos::DomainPartition & domain ) | ||
{ | ||
return PhysicsSolverBase::setNextDt( currentDt, domain ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO pressure and saturation change time step selector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented new function:
real64 ImmiscibleMultiphaseFlow::setNextDtBasedOnStateChange(real64 const & currentDt, DomainPartition & domain)
real64 const dDens_dP = m_dDens_dPres[seri[ke]][sesri[ke]][sei[ke]][0][ip][Deriv::dP]; // dr/dP = dr1/dP1 || dr2/dP | ||
|
||
// average density and derivatives | ||
densMean[ip] += 0.5 * density; // rho = (rho1 + rho2) / 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this treatment was recently modified, see #3337
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New treatment implemented in kernel:
void computeFlux( localIndex const iconn, StackVariables & stack, FUNC && kernelOp = NoOpFunc{} ) const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry we had to revert that new treatment and make it an option, see #3467
somehow old treatment works much better for spe11 and it is not a good time to spoil it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We adapted the code to make it optional in the immiscible solver as well, using the parameter m_checkPhasePresenceInGravity
real64 dPresGrad_dTrans = 0.0; | ||
real64 dGravHead_dTrans = 0.0; | ||
real64 dCapGrad_dTrans = 0.0; | ||
int signPotDiff[2] = {1, -1}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think you need this sign thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it for now. We can think of a more elegant implementation in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it is just wrong, why no just this:
presGrad[ip] += trans[ke] * pressure;
...
dPresGrad_dP[ip][ke] += dTrans_dP[ke] * pressure;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we understand correctly, it's because we need a pressure difference instead of a single pressure value:
Here presGrad = T * (P1-P2)
When we take the derivative with respect to the two pressures we will need: dPresGrad_dP = {dT/dP1 * (P1-P2) + T, dT/dP1 * (P1-P2) - T}. At the last line of code shown dPresGrad_dP = {T, -T} already.
So the second term on the right-hand side needs to be a (P1-P2), instead of just a single pressure. We used the signPotDiff variable to assist taking the difference of the 2 pressures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone else can check our understanding, but it's because in
presGrad[ip] += trans[ke] * pressure; // DPv = T (P1 - P2)
we are using the transmissibilities that come from the computeWeights (CellElementStencilTPFA.hpp)
function like this:
weight[0][ke] = m_transMultiplier[iconn] * value * (ke == 0 ? 1 : -1);
So T2 = -T1
potGrad += capGrad[ip]; // DPhi = T (P1 - P2) - T rho g (z1 - z2) + T (-Pc1 + Pc2) | ||
} | ||
|
||
// compute upwinding tolerance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compositional is not doing that trick but ok to keep it here as long as it works fine
...onents/physicsSolvers/fluidFlow/kernels/immiscibleMultiphase/ImmiscibleMultiphaseKernels.hpp
Outdated
Show resolved
Hide resolved
...onents/physicsSolvers/fluidFlow/kernels/immiscibleMultiphase/ImmiscibleMultiphaseKernels.hpp
Outdated
Show resolved
Hide resolved
...onents/physicsSolvers/fluidFlow/kernels/immiscibleMultiphase/ImmiscibleMultiphaseKernels.hpp
Outdated
Show resolved
Hide resolved
Overall looks pretty good, just some minor things here and there, cleanup and remove commented code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked at MGR changes, looks good!
explicit ImmiscibleMultiphaseFVM( arrayView1d< int const > const & numComponentsPerField ) | ||
: MGRStrategyBase( LvArray::integerConversion< HYPRE_Int >( numComponentsPerField[0] ) ) | ||
{ | ||
// Level 0: eliminate last density which corresponds to the volume constraint equation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments can be removed
I'd remove the file |
Implementation of a multiphase immiscible solver for compressible fluids with viscous, gravity and capillary forces:
ImmiscibleMultiphaseFlow
solver and associated kernels (currently limited to two phases)TwoPhaseFluid
model for tabular data input