Skip to content

use zero weights on undersaturated equations#6994

Draft
hnil wants to merge 1 commit into
OPM:masterfrom
hnil:fix_analytic_cpr
Draft

use zero weights on undersaturated equations#6994
hnil wants to merge 1 commit into
OPM:masterfrom
hnil:fix_analytic_cpr

Conversation

@hnil
Copy link
Copy Markdown
Member

@hnil hnil commented Apr 20, 2026

Use different weights on undersaturated equations.

@hnil hnil requested review from atgeirr and steink April 20, 2026 10:49
@hnil hnil marked this pull request as draft April 20, 2026 10:49
Copy link
Copy Markdown
Member

@atgeirr atgeirr left a comment

Choose a reason for hiding this comment

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

Thanks! I think this should go in with the modifications requested.

if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
const unsigned activeCompIdx = FluidSystem::canonicalToActiveCompIdx(
FluidSystem::solventComponentIndex(FluidSystem::oilPhaseIdx));
if(priVars.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Rv) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is already set above, so it can be deleted.


if (priVars.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Rv
|| priVars.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Rs) {
// If only two phases are active, reset the inactive component weight.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The comment is misleading, I think it would be better to say "If either gas or oil is undersaturated, we set the corresponding weight for that component to zero".

if (priVars.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Rv
|| priVars.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Rs) {
// If only two phases are active, reset the inactive component weight.
unsigned activeCompIdx = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be declared inside the if-statements as const unsigned activeCompIdx = ... as in lines 274, 296 etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants