Skip to content

Fix for black oil #2937

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

Merged
merged 12 commits into from
Jan 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ BlackOilFluid::KernelWrapper::
real64 phaseMolecularWeight[NP_BO]{};
real64 dPhaseMolecularWeight[NP_BO][NC_BO+2]{};

// 1. Convert to mass if necessary
// 1. Convert to moles if necessary

if( m_useMass )
{
Expand Down Expand Up @@ -529,8 +529,8 @@ BlackOilFluid::KernelWrapper::
phaseFraction.value[ipWater] = zw;

// oil
phaseCompFraction.value[ipOil][icOil] = zo;
phaseCompFraction.value[ipOil][icGas] = zg;
phaseCompFraction.value[ipOil][icOil] = zo / ( zo + zg );
phaseCompFraction.value[ipOil][icGas] = zg / ( zo + zg );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have written this as for example zo / (1 - zw) which should have no impact here but would have an impact on the derivatives. Have you looked at the Jacobian in this alternative formulation. I find these composition derivatives a bit confusing when honouring that they sum to 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just checked - Jacobian is the same, number of linear iterations is the same, I will update with your version

phaseCompFraction.value[ipOil][icWater] = 0.0;

// gas
Expand All @@ -542,8 +542,10 @@ BlackOilFluid::KernelWrapper::
{
phaseFraction.derivs[ipOil][Deriv::dC+icWater] = -1.0;
phaseFraction.derivs[ipWater][Deriv::dC+icWater] = 1.0;
phaseCompFraction.derivs[ipOil][icOil][Deriv::dC+icOil] = 1.0;
phaseCompFraction.derivs[ipOil][icGas][Deriv::dC+icGas] = 1.0;
phaseCompFraction.derivs[ipOil][icOil][Deriv::dC+icOil] = zg / (( zo + zg )*( zo + zg ));
phaseCompFraction.derivs[ipOil][icOil][Deriv::dC+icGas] = -zo / (( zo + zg )*( zo + zg ));
phaseCompFraction.derivs[ipOil][icGas][Deriv::dC+icOil] = -zg / (( zo + zg )*( zo + zg ));
phaseCompFraction.derivs[ipOil][icGas][Deriv::dC+icGas] = zo / (( zo + zg )*( zo + zg ));
}
}
}
Expand Down