Move reservoir coupling methods to a separate class#7066
Draft
hakonhagland wants to merge 3 commits into
Draft
Conversation
Store a reference to BlackoilModelParameters in the generic well model base class so that the base no longer needs to receive individual parameter fields as method arguments. Drop the now-redundant arguments from three call paths: - tol_nupcol from updateAndCommunicateGroupData (7 call sites) - max_number_of_group_switch from checkGroupHigherConstraints - handle_ms_well from initFromRestartFile and prepareDeserialize The base class reads the corresponding fields directly from the stored param_ reference. The reference is passed from the derived BlackoilWellModel constructor; its target (the derived class's const param_ member) is fully constructed by the time any base class method dereferences it.
Store a reference to the simulator's NewtonIterationContext in the generic well model base class, and expose it through a new iterationContext() accessor on the base. The address of the iteration context is stable for the lifetime of the simulator (it lives as a member of the problem object), and it is mutated in-place during NLDD local solves, so a stored reference correctly observes both global and local-solve state. Drop the now-redundant iterCtx parameter from three method signatures: - BlackoilWellModelGeneric::updateAndCommunicateGroupData - BlackoilWellModelNetworkGeneric::shouldBalance - BlackoilWellModelNetworkGeneric::willBalanceOnNextIteration The implementations read iter_ctx_ directly (or, for the network class, via well_model_.iterationContext()). On the caller side, several local `simulator_.problem().iterationContext()` lookups become unused after the parameter drops and are removed.
Extract the reservoir-coupling methods from BlackoilWellModel<TypeTag> into a new templated helper class BlackoilWellModelRescoup<TypeTag>, modelled as has-a on BlackoilWellModel. Moved methods: receiveGroupConstraintsFromMaster, receiveSlaveGroupData, rescoupSyncSummaryData, sendMasterGroupConstraintsToSlaves, sendSlaveGroupDataToMaster, plus setupRescoupScopedLogger (renamed to setupScopedLogger). The rescoup mode-query API (isReservoirCouplingMaster/Slave, reservoirCouplingMaster/Slave, setReservoirCouplingMaster/Slave) stays on BlackoilWellModel — read-only callers should not have to bounce through the wrapper. Also adds a public guideRateHandler() accessor so the wrapper can construct the underlying Rescoup* helpers without friend access. No behaviour change. BlackoilWellModel_impl.hpp had ~160 LOC of rescoup-specific code that upcoming rescoup-network work would roughly double; this gives those additions a clean target file.
Contributor
Author
|
jenkins build this please |
Contributor
Author
|
Putting this in draft mode until #7065 has been merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #7065
Extracts the reservoir-coupling flow methods from
BlackoilWellModel<TypeTag>into a new templated helper classBlackoilWellModelRescoup<TypeTag>, modelled as has-a onBlackoilWellModel. Motivation:BlackoilWellModel_impl.hpphad ~160 LOC of rescoup-specific code interleaved with the rest of the file, and upcoming rescoup-network work will roughly double that footprint, this gives those additions a clean target file. No behavior change.Moved to the wrapper
receiveGroupConstraintsFromMaster()receiveSlaveGroupData()rescoupSyncSummaryData()sendMasterGroupConstraintsToSlaves()sendSlaveGroupDataToMaster()setupRescoupScopedLogger(): renamed tosetupScopedLoggersince the class name already carries theRescoupprefix.Stayed on
BlackoilWellModelThe rescoup mode-query API stays on
BlackoilWellModel:isReservoirCouplingMaster/Slave,isReservoirCouplingMasterGroup,reservoirCouplingMaster/Slave,setReservoirCouplingMaster/Slave, and therescoup()proxy accessor. These are read-only mode queries used widely by call sites that should not have to bounce through the wrapper to ask "are we in master mode?".Other changes
guideRateHandler()accessor onBlackoilWellModelso the wrapper can constructRescoupConstraintsCalculatorandRescoupReceiveGroupConstraintswithoutfriendaccess.CMakeLists_files.cmake(PUBLIC_HEADER_FILES, alongside the existingBlackoilWellModelNetwork.hppentries).Files
opm/simulators/wells/BlackoilWellModelRescoup.hppopm/simulators/wells/BlackoilWellModelRescoup_impl.hppopm/simulators/wells/BlackoilWellModel.hppguideRateHandler()accessor,rescoupHelper_member; removed 6 flow-method declarations)opm/simulators/wells/BlackoilWellModel_impl.hpp#ifdefblocks andrescoupSyncSummaryDatacall to wrapper; deleted moved method bodies)CMakeLists_files.cmakeFollow-up
This refactor unblocks the planned reservoir-coupling network PR series: those additions can land directly into
BlackoilWellModelRescoupinstead of growingBlackoilWellModel_impl.hppfurther.