Commit Graph
24384 Commits
Author SHA1 Message Date
Tobias Meyer Andersen 3071269b64 remove unused AMG macros 2026-05-07 10:26:23 +02:00
Atgeirr Flø Rasmussen a0dc8b1ff3 Merge pull request #7036 from atgeirr/unify-gitignore
Unify .gitignore files.
2026-05-06 15:13:39 +02:00
Bård Skaflestad fb979cb5c3 Merge pull request #7035 from atgeirr/add-more-tracy-hooks
Add more tracy hooks
2026-05-05 17:17:55 +02:00
Bård Skaflestad be161f7d74 Merge pull request #7032 from GitPaean/scalar_getFirstPerforationFluidStateInfo
not using Evaluation for saltConcentration for getFirstPerforationFluidStateInfo()
2026-05-05 17:11:49 +02:00
Atgeirr Flø Rasmussen 8a3c342c8a Unify .gitignore files. 2026-05-05 15:24:05 +02:00
Atgeirr Flø Rasmussen 3252e487e4 Add some extra profiling blocks 2026-05-05 14:29:10 +02:00
Atgeirr Flø Rasmussen 26bd980e3d Speedup communication by doing single sum(). 2026-05-05 14:29:10 +02:00
Atgeirr Flø Rasmussen 390e807aa3 Add some more high-level tracy hooks.
Mostly for looking at TemperatureModel performance.
No hooks in inner loops (cell or connection loops), so runtime with tracy
active should be very close to without.
2026-05-05 11:51:00 +02:00
Bård Skaflestad 19d3256a24 Merge pull request #7034 from akva2/no_warning_parmetis_serial
fixed: do not print warning about missing ParMETIS in serial builds
2026-05-05 09:32:41 +02:00
Tobias Meyer Andersen c9cd630a25 Merge pull request #7027 from kjetilly/intensive_quantities_2
GPU portability: OPM_HOST_DEVICE/OPM_THROW additions and fluidSystem() use
2026-05-05 09:27:44 +02:00
Arne Morten Kvarving bae64e9121 fixed: do not print warning about missing ParMETIS in serial builds 2026-05-05 08:52:30 +02:00
Kjetil Olsen Lye b2ca7e8769 GPU portability: OPM_HOST_DEVICE/OPM_THROW additions and fluidSystem() use
Decorates inline helpers in blackoil*modules.hh, blackoilprimaryvariables.hh,
directionalmobility.hh, tpfalinearizer.hh, NewTranFluxModule.hpp,
TemperatureModel.hpp and BlackOilEnergyIntensiveQuantitiesGlobalIndex.hpp
with OPM_HOST_DEVICE, replaces a few raw `throw`s with OPM_THROW, and
switches static `FluidSystem::` accesses to instance-based
`fluidState.fluidSystem()` / `getFluidSystem()` so the same code works
when the fluid system lives on the device.  Test
test_gpu_linear_two_phase_material.cu picks up the matching template
adjustments.
2026-05-05 07:55:21 +02:00
Tobias Meyer Andersen b5d83be5d8 Merge pull request #7026 from kjetilly/intensive_quantities_1
gpu_smart_pointer: extend GPU smart-pointer utilities
2026-05-04 16:22:22 +02:00
Kai Bao a2e584a0ed not using Evaluation for saltConcentration for getFirstPerforationFluidStateInfo
its derivative should not be used anyway.
2026-05-04 15:32:02 +02:00
Tobias Meyer Andersen 8096d5ba32 Remove unneeded preprocessor guard 2026-05-04 14:55:40 +02:00
Tor Harald Sandve 42990edc31 Merge pull request #7025 from hakonhagland/fix_mg_gr_dist2
Reservoir coupling: Cap master-group targets at slave potential
2026-05-04 10:36:05 +02:00
Håkon Hægland f61b1c1163 Cap RC master-group targets at slave potential
When a reservoir-coupling master group's guide-rate-distributed
production target exceeds the slave's reported potential, the slave
cannot deliver the requested rate and the shortfall is lost from the
parent group's total.  Cap each capacity-limited group's target at
the slave's potential and redistribute the surplus to sibling master
groups via the standard FractionCalculator / localReduction
machinery, so the parent (typically FIELD) can still meet its
overall target.

The redistribution is implemented in
RescoupConstraintsCalculator::calculateMasterGroupConstraintsAndSendToSlaves
and is structured as four phases:

  Pre-phase: restore master-group control modes from the Schedule
    (restoreMasterGroupControlsFromSchedule_); switch master groups
    of inactive slaves to individual control so they do not consume
    a share of the parent's target
    (excludeInactiveSlaveMasterGroupsFromDistribution_); recompute
    GCW and FIELD target reduction (updateGCWAndTargetReductions_).

  Phase 1: compute initial guide-rate-distributed targets per
    master group via GroupConstraintCalculator.

  Phase 2: cap-and-redistribute.  Groups whose target exceeds the
    slave-reported potential are capped, switched to individual
    control, and the FIELD reduction is recomputed.  Uncapped
    groups are then re-evaluated and absorb the surplus.  Finally
    all master groups are switched to individual control with their
    final allocated targets.

  Phase 3: send the (target, cmode, per-rate-type limits) triples
    to each activated slave.

The driver runs on every rank of the master communicator: its
helpers call collective MPI operations
(updateGroupControlledWells does comm_.sum, GroupConstraintCalculator
and updateGroupTargetReduction walk GroupStateHelper which is
collective).  The slave-facing MPI sends in
sendSlaveGroupConstraintsToSlave_ are rank-0-only inside the
underlying helpers, so the Phase-3 loop is safe to enter from every
rank.  A trailing GroupState::communicate_rates(comm) aggregates any
per-rank-partial reduction rates so the post-redistribution state is
consistent across master ranks.

Supporting changes:

* GroupStateHelper::updateGroupControlledWells -- conditional GCW
  for master groups: GCW=1 under FLD/NONE control, GCW=0 under
  individual control.  Without this the calculator cannot
  distinguish between capped groups (excluded from distribution)
  and uncapped groups (absorbing the surplus).

* BlackoilWellModel::updateGroupControls -- guard at the top that
  skips master groups, plus a new isReservoirCouplingMasterGroup
  forwarding method on the RescoupProxy facade.  Master-group
  controls and targets must be read-only outside the constraint
  calculator; the guard prevents checkGroupHigherConstraints and
  updateGroupIndividualControl from modifying them during the
  assemble() Newton iteration.

Known limitations, deferred to follow-up work:

* A master group with GCONPROD CONTROL_MODE set to a
  rate mode (ORAT, WRAT, ...) AND RESPOND_TO_PARENT = YES has both
  an own rate limit and parent control available.  The current GCW
  logic returns 0 in this case and excludes the group from the
  FractionCalculator guide-rate sum, so Phase 1's localFraction
  yields a wrong target.  Typical RC setups have master groups
  acting as pure routing nodes (CONTROL_MODE = FLD or NONE) and are
  unaffected.

* Injection -- the cap-and-redistribute pass currently applies only
  to production master groups.  Per-phase injection extension
  requires a slave-reported injection potential on
  SlaveGroupInjectionData (currently absent) plus the parallel set
  of helpers.

* Finished slaves -- the inactive-slave handling covers only the
  not-yet-activated case.  A slave run can finish before the master;
  detecting that finish is a separate PR with its own MPI-protocol
  changes.
2026-05-01 08:20:37 +02:00
Kjetil Olsen Lye 1ce9999f45 gpu_smart_pointer: extend GPU smart-pointer utilities
Adds host-side allocator helpers, host/device-decorated raw-pointer
accessors and small additions to MiniVector that the rest of the GPU
intensive-quantities work depends on.  Updates test_gpu_smart_pointers.cu
to cover the new behaviour.
2026-04-30 20:50:30 +00:00
Bård Skaflestad 0116ca6531 Merge pull request #7022 from GitPaean/correcting_EQUIL_support
updating the EQUIL keyword item names in PartiallySupportedFlowKeywords
2026-04-30 15:52:43 +02:00
Kai Bao ed25b00a54 Merge pull request #7024 from GitPaean/linearsolver_injectivity
fall back to use ilu0 preconditioner for polymer injectivity run instead of throw
2026-04-30 15:47:35 +02:00
Kai Bao 8e1d439515 fall back to use ilu0 preconditioner for polymer injectivity run
instead of throw, so that those cases can be run with default
parameters.
2026-04-30 14:49:02 +02:00
Kjetil Olsen Lye 49dc9bcb18 Basic .clang-tidy and recommendation to use it (#7023)
* Added .clang-tidy

* Added description in CONTRIBUTION.md
2026-04-30 13:52:56 +02:00
Kai Bao c67ad2bea6 updating the EQUIL keyword item names in PartiallySupportedFlowKeywords 2026-04-29 22:54:02 +02:00
Bård Skaflestad 04873a8eb9 Merge pull request #7019 from GitPaean/DEBUGLOG_co2_ptflash_ecfv
Add DEBUGLOG backend to PTFlash example co2_ptflash_ecfv
2026-04-29 14:05:49 +02:00
Markus Blatt 481b03f787 Merge pull request #7012 from blattms/bugfix/support-parmetis-again
[cmake] Search for ParMETIS and use it if it is there.
2026-04-29 13:15:34 +02:00
Kai Bao bb5d1230fb Add DEBUGLOG backend to PTFlash example co2_ptflash_ecfv 2026-04-29 13:14:21 +02:00
Markus Blatt 88b985c2af Document the processing of the *prereq.cmake file a bit. 2026-04-29 12:52:35 +02:00
Markus Blatt 2314c80699 Only search for ParMETIS in the prereq file
and make sure that we always search for ParMETIS in the *prereq.cmake file

This file gets processed when running CMake for opm-simulators and
during a find_package(opm-simulators) call.
2026-04-29 12:52:35 +02:00
Arne Morten Kvarving 50478b7516 Merge pull request #7002 from blattms/bugfix/recover-avx-flags
[bugfix,cmake] Make sure avx2 defines are set for compilation if supported.
2026-04-29 08:14:31 +02:00
Markus Blatt 827fdda14f [bugfix] Make sure avx2 defines are set for compilation if supported.
Previously this was done via config.h, but due to the recent build
system refactoring these defines became MIA and some  code is never
activated even if it would be supported by the hardware.

We now set the necessary compile definitois as properties for the relevant
source files to fix this.
2026-04-28 20:58:40 +02:00
Markus Blatt 656cd9540c Merge pull request #6972 from aritorto/bridgeNNCs
[LGR] Pass in writeInitial an NNCCollection to allow output of the 3 NNC types
2026-04-28 20:06:58 +02:00
Bård Skaflestad 3bce02799a Merge pull request #7013 from akva2/janitoring_move_log_to_tu
SimulatorFullyImplicitBlackoil: move tuning logging to TU
2026-04-28 13:57:19 +02:00
Bård Skaflestad 84442eddcf Merge pull request #7010 from hakonhagland/sfib_doxygen
Add Doxygen to SimulatorFullyImplicitBlackoil.hpp
2026-04-28 13:39:14 +02:00
Arne Morten Kvarving 46cc3dcedd SimulatorFullyImplicitBlackoil: move tuning logging to TU 2026-04-28 12:42:07 +02:00
Håkon Hægland 9457b7ea2f Add Doxygen to SimulatorFullyImplicitBlackoil.hpp
Document the class, the constructor, and the member functions whose
semantics are not self-evident from the name; add brief annotations
to the member variables describing role, ownership, and lifecycle.

Class-level docs cover the per-report-step loop, what the class owns
(solver, tuning-update callback, report aggregation, convergence-output
thread, OPMRST, reservoir-coupling bring-up), and how it is instantiated.

Member functions documented individually: the constructor, destructor,
registerParameters, both run() overloads (RC and non-RC),
checkRunningAsReservoirCouplingMaster, both init() overloads,
updateTUNING, updateTUNINGDP, runStep, finalize, serializeOp,
loadState, saveState, getHeader, createSolver.

Outdated comments removed/rewritten.

No behavior change.
2026-04-28 12:28:13 +02:00
Håkon Hægland f493b4e4c5 Merge pull request #7008 from hakonhagland/refact_sfib
Split SimulatorFullyImplicitBlackoil header
2026-04-28 12:26:09 +02:00
Tor Harald Sandve 2c3ce902d4 Merge pull request #6999 from hakonhagland/fix_sync_steps
Reservoir coupling: Sync master and slaves at master time steps by default
2026-04-28 11:23:42 +02:00
Kjetil Olsen Lye e7351300b5 Merge pull request #6995 from kjetilly/gpu_description
Added a description of how to port a class to GPU
2026-04-28 08:45:59 +02:00
Bård Skaflestad eac3fbb428 Merge pull request #7011 from GitPaean/removing_segment_indices
removing unused segment_indices in initWellStateMSWell
2026-04-27 16:53:33 +02:00
Markus Blatt 6c29bef524 [cmake] Search for ParMETIS and use it if it there.
This is what we did before refactoring the build system. Somehow this
was accidentally skipped during the refactoring and this commit
reintroduces it.

This is needed, because without it we will always directly agglomerate
the data on the coase levels to on process instead of fewer and fewer.
This should make a difference in scalability of the linear solver when
using many processes.
2026-04-27 16:52:04 +02:00
Kai Bao b3d43acf60 removing unused segment_indices in initWellStateMSWell 2026-04-27 16:34:24 +02:00
Håkon Hægland 4f68559a50 Delete unconventional blank line 2026-04-27 15:13:16 +02:00
Håkon Hægland a3c0c6d755 Split SimulatorFullyImplicitBlackoil header
Move all template-method definitions out of
SimulatorFullyImplicitBlackoil.hpp into a new
SimulatorFullyImplicitBlackoil_impl.hpp, mirroring the layout
already used by AdaptiveTimeStepping, BlackoilModel, and most
template classes under opm/simulators/.

The .hpp now contains only declarations (with Doxygen) plus
trivial inline accessors (grid, model, eclState, schedule,
isRestart, wellModel_, getCellMapping). The header shrinks from 754
to 223 lines, making the public API of the class easier to skim
as new methods are added.

Pure mechanical refactor: method bodies are moved verbatim
modulo template<class TypeTag> and qualifier prefixes.
2026-04-27 14:08:16 +02:00
Atgeirr Flø Rasmussen 0267e51139 Merge pull request #6997 from hakonhagland/rc_tracy
Instrument reservoir coupling MPI exchanges for Tracy
2026-04-27 13:31:40 +02:00
Bård Skaflestad 380461b8ca Merge pull request #7003 from hakonhagland/tuning_test
Adaptive time-stepping: rename `dt` callback param and add Doxygen
2026-04-27 10:55:05 +02:00
Håkon Hægland 4ea59677d7 Add Doxygen to AdaptiveTimeStepping.hpp
Document the three classes, the TuningUpdateCallback alias, and the
member functions whose semantics are not self-evident from the name.

No behavior change.
2026-04-24 18:24:58 +02:00
Håkon Hægland 90f7b2ac2b Rename tuning-update callback parameters
Rename the `dt` and `timeStep` parameters of the tuning-update
callback and its passthroughs to `substep_length` and
`sub_step_number`.  The old names were generic enough to hide the
"substep vs report-step" distinction whose confusion caused the
bug fixed in #6998: the callback fires once per substep and its
length/index arguments are specifically substep-scoped, not
report-step-scoped.
2026-04-24 17:08:13 +02:00
Atgeirr Flø Rasmussen c4dc12226b Merge pull request #6993 from hnil/hypre_fix
fixed issures with parallel hypre on mac ++
2026-04-24 15:48:06 +02:00
Håkon Hægland 145e2ae118 Sync rescoup master loop at master time steps by default
Restructure the rescoup master's outer substep loop so that each
outer iteration is one master actual time step.  The master's
adaptive timestepping now drives the sync cadence instead of
saturating at the slave report-step size.  This matches the
coupling semantics of the reference simulator, where
master<->slave exchanges are tied to master actual time steps
rather than to slave report steps.

Introduce two sync modes, selected by the
--rescoup-sync-at-report-steps CLI flag added in the previous
commit:

  TSYNC (default, flag=false)
    Each outer iteration is one master time step.  Sync-step
    length is chosen fresh each iteration from the master's
    adaptive suggestion, capped at the max time step and at the
    remaining report-step time, then chopped against slave
    report dates.

  RSYNC (flag=true)
    Each chunk between slave report-step boundaries is one sync
    step.  Preserves the pre-change OPM behavior.

Both modes share a single outer-loop function; the mode-specific
bits (step-length selection, user-visible log line, chop against
slave reports) are encapsulated in the new private helper
`getRcMasterSyncStepLength_`.
2026-04-24 12:33:50 +02:00
Håkon Hægland 42871af2cd Add --rescoup-sync-at-report-steps CLI flag
Add a new boolean parameter `RescoupSyncAtReportSteps` (default `false`)
to the time-stepping parameter set, registered with a developer-facing
description.  Read it in the `ReservoirCouplingMaster` constructor,
store it as a member, expose it via a `syncAtReportSteps()` getter, and
log the chosen mode once at simulation start.

This is a no-op precursor for the upcoming change to the master's outer
sync loop.  The flag is read and made available, but no code consults
it yet, so behavior is unchanged on both values.

Future use: when `true`, the master will sync with its slaves at slave
report-step boundaries (the current OPM behavior).  When `false`, the
master will sync at every master actual time step.
2026-04-24 12:33:50 +02:00