Skip to content
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

Add rsw #3246

Merged
merged 1 commit into from
Dec 21, 2022
Merged

Add rsw #3246

merged 1 commit into from
Dec 21, 2022

Conversation

totto82
Copy link
Member

@totto82 totto82 commented Dec 12, 2022

Ported from OPM/opm-material#543

@totto82
Copy link
Member Author

totto82 commented Dec 12, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

1 similar comment
@totto82
Copy link
Member Author

totto82 commented Dec 12, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

Copy link
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.

I think this is good, except where noted in the comments below.

@@ -422,6 +438,23 @@ class BlackOilFluidState
}
}

/*!
* \brief Return the gas dissulition factor of water [m^3/m^3].
Copy link
Member

Choose a reason for hiding this comment

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

Typo

@@ -769,9 +815,10 @@ class BlackOilFluidSystem : public BaseFluidSystem<Scalar, BlackOilFluidSystem<S
}

case waterPhaseIdx:
const LhsEval Rsw(0.0);
Copy link
Member

Choose a reason for hiding this comment

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

Should we not have a branch here for if (enableDissolvedGasInWater()) { similar to below?

Also: are we not missing a branch for the brine case both here and below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. This is a bug. It does not affect exisisting usage, since we compute density from invB when updateding the fluidstate in blackoilintensivequantities.hh.

What do you mean by the "brine case"?

Copy link
Member

Choose a reason for hiding this comment

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

By brine I mean with salt, but now I do not see why I thought something was missing, it is taken care of with saltConcentration as evaluated on line 756 it seems.

@@ -968,12 +1039,12 @@ class BlackOilFluidSystem : public BaseFluidSystem<Scalar, BlackOilFluidSystem<S

const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
const auto& saltConcentration = decay<LhsEval>(fluidState.saltConcentration());
const auto& saltConcentration = BlackOil::template getSaltConcentration_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain the reason for this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

The new code will allow for a fluidstate without a method called saltConcentration(). There are still some call left to fluidState.saltConcentration(), I only "fixed" the part of the code I was changing anyway. This also align more with how we do it for rs and rv etc.

@@ -968,12 +1039,12 @@ class BlackOilFluidSystem : public BaseFluidSystem<Scalar, BlackOilFluidSystem<S

Copy link
Member

Choose a reason for hiding this comment

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

The doxygen doc for this function is now misleading (line 1030), similarly in line 832.

@@ -1206,7 +1288,9 @@ class BlackOilFluidSystem : public BaseFluidSystem<Scalar, BlackOilFluidSystem<S

case waterPhaseIdx:
return
waterPvt_->internalEnergy(regionIdx, T, p, BlackOil::template getSaltConcentration_<ThisType, FluidState, LhsEval>(fluidState, regionIdx))
waterPvt_->internalEnergy(regionIdx, T, p,
BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
Copy link
Member

Choose a reason for hiding this comment

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

Weird indentation, easy to misread. Also on lines 1350, 1378 and 1428.

const Evaluation& pressure,
const Evaluation& /*saltConcentration*/) const
{
//TODO: The viscosity does not yet depend on the composition
Copy link
Member

Choose a reason for hiding this comment

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

This TODO is not applicable to saturatedViscosity() I think.

const Evaluation& /*saltConcentration*/) const
{
//TODO: The viscosity does not yet depend on the composition
return saturatedViscosity(regionIdx, temperature, pressure);
Copy link
Member

Choose a reason for hiding this comment

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

In this function on the other hand, the TODO applies. But do we want to include the effect of dissolved gas here? Based on some analytic function from some paper, if such a thing exists?

Copy link
Member Author

Choose a reason for hiding this comment

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

One candidate is to use the LBC model for co2rich mixture (that we already have in opm/material/viscocitymodels)

const Evaluation& Rs,
const Evaluation& /*saltConcentration*/) const
{
return inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rs);
Copy link
Member

Choose a reason for hiding this comment

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

I am in general a bit worried about adding new methods that are so similar to the existing ones, in terms of interface: forget one parameter, and you may be calling the completely wrong function (or rather, with parameters other than you think). This may apply to the other Pvt classes as well, but I noticed it here. Is this new?

Copy link
Member Author

Choose a reason for hiding this comment

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

No it is not introduced here. I think a good solution would be to stop using the pvt models for the phases directly (they should be internal to the FluidSystem) and instead call FluidSystem::density(fs, ...) etc. that would avoid the potential for misuse.

const Evaluation& saltconcentration) const
{ OPM_WATER_PVT_MULTIPLEXER_CALL(return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration));
{ OPM_WATER_PVT_MULTIPLEXER_CALL(return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration));
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick (here and the next 4 multiplexer calls): Please put the call on the line following the brace, and the return 0 on the line after that by itself, just as for saturatedViscosity().

@totto82
Copy link
Member Author

totto82 commented Dec 15, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

1 similar comment
@totto82
Copy link
Member Author

totto82 commented Dec 15, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

If DISGASW is in the input deck gas in allowed to dissolved into water
Currently only works in combination with CO2STORE
For general support assosiated input tables needs to be provided
@totto82
Copy link
Member Author

totto82 commented Dec 16, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

4 similar comments
@totto82
Copy link
Member Author

totto82 commented Dec 20, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

@totto82
Copy link
Member Author

totto82 commented Dec 21, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

@totto82
Copy link
Member Author

totto82 commented Dec 21, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

@totto82
Copy link
Member Author

totto82 commented Dec 21, 2022

jenkins build this opm-models=763 opm-simulators=4292 please

@totto82
Copy link
Member Author

totto82 commented Dec 21, 2022

All is green and all is approved. Will merge! Thanks @atgeirr for the review.

@totto82 totto82 merged commit ce3b37f into OPM:master Dec 21, 2022
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