From 1fd280c68dde9db872394a4d40021a994abaec65 Mon Sep 17 00:00:00 2001 From: David Landa Marban Date: Thu, 2 Oct 2025 10:22:55 +0200 Subject: [PATCH] Removing trailing spaces and adding eol at eof --- CHANGELOG.md | 10 +- CMakeLists.txt | 7 +- README.md | 4 +- examples/problems/co2ptflashproblem.hh | 4 +- examples/tutorial1problem.hh | 1 - flow/flow.cpp | 1 - flow/flow_biofilm.cpp | 2 +- flow/flow_blackoil_alugrid.cpp | 2 +- flow/flow_brine.cpp | 2 +- flow/flow_brine_energy.cpp | 2 +- flow/flow_brine_precsalt_vapwat.cpp | 2 +- flow/flow_brine_saltprecipitation.cpp | 2 +- flow/flow_distribute_z.cpp | 1 - flow/flow_gaswater_brine.cpp | 2 +- flow/flow_gaswater_saltprec_energy.cpp | 2 +- flow/flow_gaswater_saltprec_vapwat.cpp | 2 +- flow/flow_oilwater_brine.cpp | 2 +- ...ilEnergyIntensiveQuantitiesGlobalIndex.hpp | 8 +- ...BlackOilIntensiveQuantitiesGlobalIndex.hpp | 2 +- flowexperimental/comp/flowexp_comp.hpp | 4 +- .../blackoil/blackoilbioeffectsmodules.hh | 32 ++--- .../blackoil/blackoilbioeffectsparams.cpp | 4 +- .../blackoil/blackoilbioeffectsparams.hpp | 2 +- opm/models/blackoil/blackoilbrinemodules.hh | 2 +- .../blackoilconvectivemixingmodule.hh | 2 +- .../blackoil/blackoildiffusionmodule.hh | 16 +-- .../blackoil/blackoildispersionmodule.hh | 6 +- .../blackoil/blackoilintensivequantities.hh | 2 +- .../blackoil/blackoillocalresidualtpfa.hh | 4 +- opm/models/blackoil/blackoilnewtonmethod.hpp | 4 +- .../blackoil/blackoilonephaseindices.hh | 2 +- .../blackoil/blackoilprimaryvariables.hh | 2 +- opm/models/blackoil/blackoilproblem.hh | 2 +- opm/models/blackoil/blackoilproperties.hh | 2 +- opm/models/blackoil/blackoilsolventmodules.hh | 16 +-- .../blackoil/blackoiltwophaseindices.hh | 2 +- .../blackoilvariableandequationindices.hh | 2 +- .../discretization/common/tpfalinearizer.hh | 2 +- opm/models/ptflash/flashindices.hh | 2 +- opm/models/ptflash/flashlocalresidual.hh | 4 +- opm/models/ptflash/flashmodel.hh | 2 +- opm/models/utils/simulator.hh | 2 +- opm/models/utils/start.hh | 2 +- .../flow/AluGridCartesianIndexMapper.hpp | 6 +- .../flow/AluGridLevelCartesianIndexMapper.hpp | 2 +- opm/simulators/flow/AluGridVanguard.hpp | 12 +- opm/simulators/flow/BioeffectsContainer.cpp | 2 +- opm/simulators/flow/BlackoilModel.hpp | 2 +- .../flow/BlackoilModelParameters.cpp | 2 +- .../flow/BlackoilModelParameters.hpp | 4 +- .../flow/BlackoilModelProperties.hpp | 2 +- opm/simulators/flow/CpGridVanguard.hpp | 2 +- opm/simulators/flow/DamarisParameters.hpp | 2 +- opm/simulators/flow/DamarisWriter.hpp | 94 +++++++------- opm/simulators/flow/EquilInitializer.hpp | 2 +- opm/simulators/flow/FlowBaseVanguard.hpp | 2 +- opm/simulators/flow/FlowGenericProblem.hpp | 2 +- .../flow/FlowGenericProblem_impl.hpp | 2 +- opm/simulators/flow/FlowGenericVanguard.cpp | 4 +- opm/simulators/flow/FlowProblem.hpp | 8 +- opm/simulators/flow/FlowProblemBlackoil.hpp | 2 +- opm/simulators/flow/FlowProblemComp.hpp | 6 +- .../flow/GenericOutputBlackoilModule.cpp | 6 +- .../flow/GenericTracerModel_impl.hpp | 8 +- opm/simulators/flow/Main.cpp | 4 +- opm/simulators/flow/Main.hpp | 8 +- opm/simulators/flow/MixingRateControls.cpp | 2 +- opm/simulators/flow/MixingRateControls.hpp | 6 +- opm/simulators/flow/NlddReporting.hpp | 2 +- opm/simulators/flow/OutputBlackoilModule.hpp | 32 ++--- .../flow/ReservoirCouplingMaster.cpp | 1 - .../flow/SimulatorFullyImplicitBlackoil.hpp | 2 +- .../flow/equil/EquilibrationHelpers.cpp | 2 +- opm/simulators/flow/equil/InitStateEquil.hpp | 2 +- .../flow/equil/InitStateEquil_impl.hpp | 2 +- opm/simulators/linalg/FlexibleSolver_impl.hpp | 6 +- opm/simulators/linalg/ISTLSolverGpuBridge.cpp | 2 +- .../linalg/ISTLSolverRuntimeOptionProxy.hpp | 8 +- .../linalg/LinearSolverAcceleratorType.hpp | 2 +- .../linalg/ParallelIstlInformation.hpp | 4 +- .../linalg/ParallelOverlappingILU0_impl.hpp | 2 +- .../linalg/PreconditionerWithUpdate.hpp | 2 +- .../linalg/PressureBhpTransferPolicy.hpp | 1 - .../StandardPreconditioners_gpu_serial.hpp | 8 +- .../linalg/StandardPreconditioners_mpi.hpp | 16 +-- .../linalg/StandardPreconditioners_serial.hpp | 20 +-- opm/simulators/linalg/WellOperators.hpp | 5 +- .../linalg/gpubridge/CprCreation.cpp | 4 +- .../linalg/gpubridge/CprCreation.hpp | 7 +- opm/simulators/linalg/gpubridge/Misc.cpp | 2 +- opm/simulators/linalg/gpubridge/Misc.hpp | 2 +- .../MultisegmentWellContribution.cpp | 1 - .../linalg/gpubridge/Preconditioner.hpp | 2 +- .../linalg/gpubridge/amgclSolverBackend.hpp | 2 +- .../gpubridge/cuda/cusparseSolverBackend.hpp | 5 +- .../linalg/gpubridge/opencl/ChowPatelIlu.cpp | 1 - .../linalg/gpubridge/opencl/openclCPR.cpp | 6 +- .../linalg/gpubridge/opencl/openclCPR.hpp | 1 - .../linalg/gpubridge/rocm/hipKernels.cpp | 32 ++--- .../linalg/gpubridge/rocm/hipKernels.hpp | 18 +-- .../rocm/rocalutionSolverBackend.hpp | 4 +- .../linalg/gpubridge/rocm/rocsparseBILU0.cpp | 24 ++-- .../linalg/gpubridge/rocm/rocsparseBILU0.hpp | 11 +- .../linalg/gpubridge/rocm/rocsparseCPR.cpp | 120 +++++++++--------- .../linalg/gpubridge/rocm/rocsparseCPR.hpp | 17 ++- .../linalg/gpubridge/rocm/rocsparseMatrix.cpp | 8 +- .../linalg/gpubridge/rocm/rocsparseMatrix.hpp | 6 +- .../rocm/rocsparsePreconditioner.cpp | 1 - .../rocm/rocsparsePreconditioner.hpp | 18 +-- .../gpubridge/rocm/rocsparseSolverBackend.cpp | 36 +++--- .../gpubridge/rocm/rocsparseSolverBackend.hpp | 2 +- opm/simulators/linalg/gpuistl/GpuJac.cpp | 4 +- opm/simulators/linalg/gpuistl/GpuSender.hpp | 2 +- opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp | 4 +- .../linalg/gpuistl/GpuSparseMatrix.hpp | 16 +-- .../linalg/gpuistl/GpuSparseMatrixGeneric.hpp | 4 +- .../linalg/gpuistl/GpuSparseMatrixWrapper.hpp | 8 +- .../linalg/gpuistl/ISTLSolverGPUISTL.hpp | 10 +- opm/simulators/linalg/gpuistl/OpmGpuILU0.hpp | 2 +- .../gpuistl/detail/FlexibleSolverWrapper.cpp | 6 +- .../gpuistl/detail/FlexibleSolverWrapper.hpp | 4 +- .../detail/gpu_preconditioner_utils.hpp | 2 +- opm/simulators/linalg/ilufirstelement.hh | 2 - opm/simulators/linalg/is_gpu_operator.hpp | 4 +- .../linalg/istlsparsematrixadapter.hh | 2 +- opm/simulators/linalg/twolevelmethodcpr.hh | 4 +- .../timestepping/SimulatorReport.cpp | 4 +- .../timestepping/TimeStepControl.hpp | 9 +- opm/simulators/utils/ComponentName.hpp | 1 - opm/simulators/utils/DamarisKeywords.cpp | 44 +++---- opm/simulators/utils/DamarisKeywords.hpp | 20 +-- opm/simulators/utils/DamarisOutputModule.cpp | 10 +- opm/simulators/utils/DamarisOutputModule.hpp | 8 +- .../utils/DeferredLoggingErrorHelpers.hpp | 2 +- .../utils/PartiallySupportedFlowKeywords.cpp | 12 +- .../utils/UnsupportedFlowKeywords.cpp | 2 +- opm/simulators/utils/initDamarisXmlFile.cpp | 96 +++++++------- opm/simulators/utils/readDeck.cpp | 4 +- .../satfunc/OilPhaseConsistencyChecks.hpp | 2 +- .../utils/satfunc/RelpermDiagnostics.cpp | 2 +- opm/simulators/wells/ALQState.hpp | 3 - opm/simulators/wells/BlackoilWellModel.hpp | 2 +- .../wells/BlackoilWellModelConstraints.cpp | 6 +- .../wells/BlackoilWellModelGasLift_impl.hpp | 2 +- .../wells/BlackoilWellModelGeneric.cpp | 14 +- .../wells/BlackoilWellModelGeneric.hpp | 2 +- .../wells/BlackoilWellModelNldd.hpp | 8 +- .../wells/BlackoilWellModel_impl.hpp | 6 +- opm/simulators/wells/GasLiftGroupInfo.cpp | 10 +- .../wells/GasLiftSingleWellGeneric.cpp | 4 +- opm/simulators/wells/GlobalWellInfo.hpp | 1 - opm/simulators/wells/GroupState.cpp | 4 +- opm/simulators/wells/GuideRateHandler.cpp | 1 - .../wells/MultisegmentWellAssemble.cpp | 6 +- .../wells/MultisegmentWellEquations.cpp | 2 +- opm/simulators/wells/MultisegmentWellEval.cpp | 8 +- opm/simulators/wells/MultisegmentWellEval.hpp | 2 +- .../wells/MultisegmentWellGeneric.cpp | 2 +- .../wells/MultisegmentWellGeneric.hpp | 2 +- .../wells/MultisegmentWellSegments.cpp | 28 ++-- .../wells/MultisegmentWellSegments.hpp | 4 +- .../wells/MultisegmentWell_impl.hpp | 40 +++--- opm/simulators/wells/StandardWell.hpp | 4 +- .../wells/StandardWellEquations.hpp | 2 +- opm/simulators/wells/StandardWellEval.cpp | 4 +- opm/simulators/wells/StandardWellEval.hpp | 2 +- opm/simulators/wells/VFPHelpers.cpp | 22 ++-- opm/simulators/wells/VFPHelpers.hpp | 2 +- opm/simulators/wells/VFPProdProperties.hpp | 2 +- opm/simulators/wells/WellAssemble.cpp | 4 +- opm/simulators/wells/WellBhpThpCalculator.cpp | 32 ++--- opm/simulators/wells/WellBhpThpCalculator.hpp | 6 +- opm/simulators/wells/WellConvergence.cpp | 2 +- opm/simulators/wells/WellConvergence.hpp | 2 +- opm/simulators/wells/WellGroupHelpers.cpp | 20 +-- opm/simulators/wells/WellGroupHelpers.hpp | 2 +- opm/simulators/wells/WellInterface.hpp | 14 +- opm/simulators/wells/WellInterfaceGeneric.cpp | 6 +- opm/simulators/wells/WellInterface_impl.hpp | 40 +++--- python/README.md | 2 +- .../dockerfiles/common/setup_apt.sh | 1 - .../scripts/src/opm_wheels/config_reader.py | 4 +- python/simulators/CMakeLists.txt | 2 - python/simulators/PyBlackOilSimulator.cpp | 1 - python/simulators/PyGasWaterSimulator.cpp | 1 - python/simulators/PyOnePhaseSimulator.cpp | 2 +- python/test/pytest_common.py | 1 - python/test/test_basic.py | 7 +- python/test/test_throw.py | 1 - tests/gpuistl/test_GpuOwnerOverlapCopy.cpp | 2 +- tests/models/test_tasklets.cpp | 1 - tests/not-unit/test_ad.cpp | 1 - tests/run-init-regressionTest.sh | 2 +- tests/run-parallel-unitTest.sh | 2 +- tests/run-vtu-test.sh | 4 +- tests/test_GroupState.cpp | 2 - tests/test_convergencereport.cpp | 1 - tests/test_cusparseSolver.cpp | 2 +- tests/test_dilu.cpp | 8 +- tests/test_equil.cpp | 24 ++-- tests/test_extractMatrix.cpp | 2 +- tests/test_ghostlastmatrixadapter.cpp | 4 +- tests/test_glift1.cpp | 1 - tests/test_milu.cpp | 10 +- tests/test_outputdir.cpp | 12 +- tests/test_partitionCells.cpp | 2 +- tests/test_stoppedwells.cpp | 2 +- tests/test_tuning_TSINIT_NEXTSTEP.cpp | 11 +- tests/test_vfpproperties.cpp | 2 - tests/test_wellmodel.cpp | 2 +- tests/test_wellprodindexcalculator.cpp | 2 +- 211 files changed, 749 insertions(+), 804 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3acc9fa62b..fc57091871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,7 +57,7 @@ Instead, version numbers indicate the year and month of release. opm/simulators/linalg). The namespace Ewoms was renamed to Opm. - Most files from opm/autodiff/ have been moved to opm/simulators/{aquifers,linalg,utils,wells} - + ### Removed - Dependency on libecl @@ -136,11 +136,3 @@ Instead, version numbers indicate the year and month of release. ### Fixed - Many small bugs have been fixed. In total more than two hundred pull requests have been merged since last release. - - - - - - - - diff --git a/CMakeLists.txt b/CMakeLists.txt index a374b70a86..4dd0cd4fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -548,7 +548,7 @@ add_library(MainDispatchDynamic OBJECT opm/simulators/flow/MainDispatchDynamic.c set_property(TARGET MainDispatchDynamic PROPERTY POSITION_INDEPENDENT_CODE ON) # We only wait for the hipification process if we are compiling HIP. -# That is, we need to wait for the HIP header files to be generated +# That is, we need to wait for the HIP header files to be generated # before the rest of the code can compile. HIP header file includes # anything in gpuistl, say. if (CONVERT_CUDA_TO_HIP) @@ -595,13 +595,13 @@ foreach(OBJ ${COMMON_MODELS} ${FLOW_MODELS} ${FLOW_VARIANT_MODELS}) endif() # We only wait for the hipification process if we are compiling HIP. - # That is, we need to wait for the HIP header files to be generated + # That is, we need to wait for the HIP header files to be generated # before the rest of the code can compile. HIP header file includes # anything in gpuistl, say. if(CONVERT_CUDA_TO_HIP) add_dependencies(flow_lib${OBJ} hipified_headers) endif() - + opm_add_test(flow_${OBJ} ONLY_COMPILE SOURCES @@ -832,4 +832,3 @@ endif() install(DIRECTORY doc/man1 DESTINATION ${CMAKE_INSTALL_MANDIR} FILES_MATCHING PATTERN "*.1") - diff --git a/README.md b/README.md index ec58269e84..f7d762e10d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Zenodo](https://img.shields.io/badge/Zenodo_Src-10.5281%2Fzenodo.12637570-ff2222)](https://doi.org/10.5281/zenodo.12637570) > The `opm-simulators` repository contains the OPM Flow reservoir simulator which uses automatic differentiation and standard input-formats to simulate reservoirs of industrial complexity on real assets by commercial actors. It is cooperatively developed by multiple industry-partners and academic institutions under the GPL 3 license. -> +> > Flow is a fully implicit black-oil simulators which also supports CO2 storage, H2 storage, thermal simulations, solvents, as well as polymers. It works with the Eclipse formats, making it easy to integrate into existing workflows. The automatic differentiation is implemented in [opm-common](https://github.com/OPM/opm-common). The manual can be found here on the OPM [home page](https://opm-project.org/?page_id=955). ## Supported Platforms @@ -54,7 +54,7 @@ The resulting file can be uploaded to for instance gist.github.com. To cite OPM Flow we primarily use the paper `The Open Porous Media Flow reservoir simulator` published in the `Computers & Mathematics with Applications` (CAMWA) Journal. The correctly attribute credit to later contributors, we also want the Zenodo repository containing the source code to be cited. The BibTex for both can be found below.
BibTeX for CAMWA article - + ```bibtex @article{OPMFLOW, title = {The {Open} {Porous} {Media} {Flow} reservoir simulator}, diff --git a/examples/problems/co2ptflashproblem.hh b/examples/problems/co2ptflashproblem.hh index 07eda2d92a..69590fe656 100644 --- a/examples/problems/co2ptflashproblem.hh +++ b/examples/problems/co2ptflashproblem.hh @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -196,7 +196,7 @@ class CO2PTProblem : public GetPropType using MaterialLaw = GetPropType; using Simulator = GetPropType; using Model = GetPropType; - using MaterialLawParams = GetPropType; + using MaterialLawParams = GetPropType; using Toolbox = Opm::MathToolbox; using CoordScalar = typename GridView::ctype; diff --git a/examples/tutorial1problem.hh b/examples/tutorial1problem.hh index b26b824dcd..d55eee127c 100644 --- a/examples/tutorial1problem.hh +++ b/examples/tutorial1problem.hh @@ -330,4 +330,3 @@ private: } // namespace Opm #endif - diff --git a/flow/flow.cpp b/flow/flow.cpp index 4d0d4d3fed..8b97282b8c 100644 --- a/flow/flow.cpp +++ b/flow/flow.cpp @@ -31,4 +31,3 @@ int main(int argc, char** argv) mainObject.reset(); return ret; } - diff --git a/flow/flow_biofilm.cpp b/flow/flow_biofilm.cpp index 89ced9e5b7..0586295d34 100644 --- a/flow/flow_biofilm.cpp +++ b/flow/flow_biofilm.cpp @@ -33,7 +33,7 @@ namespace Opm { /*! * \brief Two-phase (gas+water) flow problem including biofilm effects (one transported - * quantity: suspended microbes and one solid phase: biofilm). + * quantity: suspended microbes and one solid phase: biofilm). */ namespace Properties { namespace TTag { diff --git a/flow/flow_blackoil_alugrid.cpp b/flow/flow_blackoil_alugrid.cpp index f18f158652..6f2cc67a19 100644 --- a/flow/flow_blackoil_alugrid.cpp +++ b/flow/flow_blackoil_alugrid.cpp @@ -23,7 +23,7 @@ // can switch to it by defining the macro #define DISABLE_SFC_ORDERING 1. // This will change the default cell order to Cartesian. // Note that this option is not available for pre-built or installed versions of dune-ALUGrid. -// To enable changig to Cartesian ordering, you will need to rebuild dune-ALUGrid from source, ensuring +// To enable changig to Cartesian ordering, you will need to rebuild dune-ALUGrid from source, ensuring // the build configuration allows disabling SFC ordering from OPM. // For more details, refer to the files gridfactory.hh and aluinline.hh located in the dune-alugrid/3d/ diff --git a/flow/flow_brine.cpp b/flow/flow_brine.cpp index 5931f0b146..b1e7a029a3 100644 --- a/flow/flow_brine.cpp +++ b/flow/flow_brine.cpp @@ -40,7 +40,7 @@ struct EnableBrine { }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flow/flow_brine_energy.cpp b/flow/flow_brine_energy.cpp index 054aba9f7d..334070f24f 100644 --- a/flow/flow_brine_energy.cpp +++ b/flow/flow_brine_energy.cpp @@ -39,7 +39,7 @@ struct EnableEnergy { }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flow/flow_brine_precsalt_vapwat.cpp b/flow/flow_brine_precsalt_vapwat.cpp index cda9770e5d..e03d3da632 100644 --- a/flow/flow_brine_precsalt_vapwat.cpp +++ b/flow/flow_brine_precsalt_vapwat.cpp @@ -49,7 +49,7 @@ struct EnableVapwat { }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flow/flow_brine_saltprecipitation.cpp b/flow/flow_brine_saltprecipitation.cpp index 924cf24a7a..c1e3a1c5ce 100644 --- a/flow/flow_brine_saltprecipitation.cpp +++ b/flow/flow_brine_saltprecipitation.cpp @@ -45,7 +45,7 @@ struct EnableSaltPrecipitation }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flow/flow_distribute_z.cpp b/flow/flow_distribute_z.cpp index 353ab83358..d0848f0d6a 100644 --- a/flow/flow_distribute_z.cpp +++ b/flow/flow_distribute_z.cpp @@ -67,4 +67,3 @@ int main(int argc, char** argv) mainObject.reset(); return ret; } - diff --git a/flow/flow_gaswater_brine.cpp b/flow/flow_gaswater_brine.cpp index f5ed7fc98f..fa87501ac7 100644 --- a/flow/flow_gaswater_brine.cpp +++ b/flow/flow_gaswater_brine.cpp @@ -51,7 +51,7 @@ struct EnableVapwat { }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flow/flow_gaswater_saltprec_energy.cpp b/flow/flow_gaswater_saltprec_energy.cpp index 13582b4ee1..1d3543302b 100644 --- a/flow/flow_gaswater_saltprec_energy.cpp +++ b/flow/flow_gaswater_saltprec_energy.cpp @@ -60,7 +60,7 @@ struct EnableEnergy { }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flow/flow_gaswater_saltprec_vapwat.cpp b/flow/flow_gaswater_saltprec_vapwat.cpp index e1c329cb36..6993f24914 100644 --- a/flow/flow_gaswater_saltprec_vapwat.cpp +++ b/flow/flow_gaswater_saltprec_vapwat.cpp @@ -55,7 +55,7 @@ struct EnableDisgasInWater { }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flow/flow_oilwater_brine.cpp b/flow/flow_oilwater_brine.cpp index 756325493f..608167704d 100644 --- a/flow/flow_oilwater_brine.cpp +++ b/flow/flow_oilwater_brine.cpp @@ -41,7 +41,7 @@ struct EnableBrine { }; template -struct Linearizer { +struct Linearizer { using type = TpfaLinearizer; }; diff --git a/flowexperimental/BlackOilEnergyIntensiveQuantitiesGlobalIndex.hpp b/flowexperimental/BlackOilEnergyIntensiveQuantitiesGlobalIndex.hpp index 94f9b5aa31..fd75d70efc 100644 --- a/flowexperimental/BlackOilEnergyIntensiveQuantitiesGlobalIndex.hpp +++ b/flowexperimental/BlackOilEnergyIntensiveQuantitiesGlobalIndex.hpp @@ -54,7 +54,7 @@ class BlackOilEnergyIntensiveQuantitiesGlobalIndex using ThermalConductionLaw = GetPropType; using ParamCache = typename FluidSystem::template ParameterCache; static constexpr bool enableTemperature = getPropValue(); - + using Indices = GetPropType; static constexpr unsigned temperatureIdx = Indices::temperatureIdx; static constexpr unsigned numPhases = FluidSystem::numPhases; @@ -76,7 +76,7 @@ public: const ParamCache& paramCache) { auto& fs = Parent::asImp_().fluidState_; - + // compute the specific enthalpy of the fluids, the specific enthalpy of the rock // and the thermal conductivity coefficients for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { @@ -137,7 +137,7 @@ public: const typename FluidSystem::template ParameterCache&) { } }; - + } // namespace Opm -#endif +#endif diff --git a/flowexperimental/BlackOilIntensiveQuantitiesGlobalIndex.hpp b/flowexperimental/BlackOilIntensiveQuantitiesGlobalIndex.hpp index 3f906a72a0..148eae0029 100644 --- a/flowexperimental/BlackOilIntensiveQuantitiesGlobalIndex.hpp +++ b/flowexperimental/BlackOilIntensiveQuantitiesGlobalIndex.hpp @@ -520,7 +520,7 @@ public: const Evaluation& permFactor() const { - throw std::logic_error("permFactor() is not yet implemented for compositional modeling"); + throw std::logic_error("permFactor() is not yet implemented for compositional modeling"); } private: diff --git a/flowexperimental/comp/flowexp_comp.hpp b/flowexperimental/comp/flowexp_comp.hpp index ab3fe327ff..3a1fda05db 100644 --- a/flowexperimental/comp/flowexp_comp.hpp +++ b/flowexperimental/comp/flowexp_comp.hpp @@ -187,8 +187,8 @@ struct EnableMech> { }; template -struct EnableDisgasInWater> { - static constexpr bool value = false; +struct EnableDisgasInWater> { + static constexpr bool value = false; }; template diff --git a/opm/models/blackoil/blackoilbioeffectsmodules.hh b/opm/models/blackoil/blackoilbioeffectsmodules.hh index abbf9a6b1f..fcea0f24a9 100644 --- a/opm/models/blackoil/blackoilbioeffectsmodules.hh +++ b/opm/models/blackoil/blackoilbioeffectsmodules.hh @@ -45,23 +45,23 @@ namespace Opm { * \ingroup BlackOil * \brief Contains the high level supplements required to extend the black oil * model by bioeffects. - * + * * The two implemented model extensions are MICP and biofilm effects in - * underground storage. For details on the mathematical models, refer to the + * underground storage. For details on the mathematical models, refer to the * OPM Flow manual. - * + * * I) MICP (Microbially Induced Calcite Precipitation) * MICP is a novel and sustainable technology that leverages biochemical * processes to form barriers through calcium carbonate cementation. This * approach shows promise for sealing leakage zones in geological formations. - * + * * The conceptual model includes the following key mechanisms: * - Suspended microbes attach to pore walls, forming biofilm. * - A growth solution is introduced to stimulate biofilm development. * - The biofilm utilizes a cementation solution to produce calcite. * - Calcite precipitates reduce pore space, thereby decreasing rock * permeability. - * + * * This implementation considers a single-phase (water) system with the * following primary variables: * - Pressure of the water phase @@ -70,17 +70,17 @@ namespace Opm { * - Concentration of urea * - Volume fraction of biofilm * - Volume fraction of calcite - * + * * II) Biofilm effects in underground applications (e.g., hydrogen storage) - * + * * Biofilm-related effects in subsurface applications such as hydrogen * storage include reduced injectivity and hydrogen loss. The conceptual * model includes the following mechanisms: - * + * * - Biofilm is present in the storage site prior to injection. * - The biofilm consumes injected hydrogen/CO2, leading to clogging * effects. - * + * * This implementation considers a two-phase (gas + water) system with the * following primary variables: * - Pressure of the gas phase @@ -156,7 +156,7 @@ public: { if constexpr (enableBioeffects) if constexpr (enableMICP) - return eqIdx == contiMicrobialEqIdx || eqIdx == contiOxygenEqIdx || eqIdx == contiUreaEqIdx + return eqIdx == contiMicrobialEqIdx || eqIdx == contiOxygenEqIdx || eqIdx == contiUreaEqIdx || eqIdx == contiBiofilmEqIdx || eqIdx == contiCalciteEqIdx; else return eqIdx == contiMicrobialEqIdx || eqIdx == contiBiofilmEqIdx; @@ -319,23 +319,23 @@ public: b * (Y * k_g - k_d - k_a) + rho_b * intQuants.biofilmVolumeFraction() * k_str * pow(normVelocityCell / intQuants.porosity(), eta); - source[Indices::contiOxygenEqIdx] -= (intQuants.microbialConcentration() * intQuants.porosity() * + source[Indices::contiOxygenEqIdx] -= (intQuants.microbialConcentration() * intQuants.porosity() * b + rho_b * intQuants.biofilmVolumeFraction()) * F * k_g; source[Indices::contiUreaEqIdx] -= rho_b * intQuants.biofilmVolumeFraction() * k_c; source[Indices::contiBiofilmEqIdx] += intQuants.biofilmVolumeFraction() * (Y * k_g - k_d - - k_str * pow(normVelocityCell / intQuants.porosity(), eta) - Y_uc * (rho_b / rho_c) * - intQuants.biofilmVolumeFraction() * k_c / (intQuants.porosity() + + k_str * pow(normVelocityCell / intQuants.porosity(), eta) - Y_uc * (rho_b / rho_c) * + intQuants.biofilmVolumeFraction() * k_c / (intQuants.porosity() + intQuants.biofilmVolumeFraction())) + k_a * intQuants.microbialConcentration() * intQuants.porosity() * b / rho_b; source[Indices::contiCalciteEqIdx] += (rho_b / rho_c) * intQuants.biofilmVolumeFraction() * Y_uc * k_c; - + // since the urea concentration can be much larger than 1, then we apply a scaling factor source[Indices::contiUreaEqIdx] *= getPropValue(); } - else { + else { const Scalar normVelocityCellG = std::accumulate(velocityInfos.begin(), velocityInfos.end(), 0.0, [](const auto acc, const auto& info) @@ -402,7 +402,7 @@ public: static const Scalar detachmentRate(unsigned satnumRegionIdx) { - return params_.detachmentRate_[satnumRegionIdx]; + return params_.detachmentRate_[satnumRegionIdx]; } static const Scalar detachmentExponent(unsigned satnumRegionIdx) diff --git a/opm/models/blackoil/blackoilbioeffectsparams.cpp b/opm/models/blackoil/blackoilbioeffectsparams.cpp index 20ffd44ae3..91e41b4832 100644 --- a/opm/models/blackoil/blackoilbioeffectsparams.cpp +++ b/opm/models/blackoil/blackoilbioeffectsparams.cpp @@ -46,7 +46,7 @@ template void BlackOilBioeffectsParams:: initFromState(const EclipseState& eclState) { - // some sanity checks: + // some sanity checks: // if biofilm is enabled, the BIOFILM keyword must be present, // if biofilm is disabled the keyword must not be present, // if MICP is enabled, the MICP keyword must be present, and @@ -138,7 +138,7 @@ initFromState(const EclipseState& eclState) bioDiffCoefficient_[pvtRegionIdx][BlackOilBioeffectsParams::ureaDiffIdx] = diffMICPTable.getUreaDiffusion().front(); } } - + if constexpr (!enableMICP) { const TableContainer& pcfactTables = tableManager.getPcfactTables(); if (!pcfactTables.empty()) { diff --git a/opm/models/blackoil/blackoilbioeffectsparams.hpp b/opm/models/blackoil/blackoilbioeffectsparams.hpp index b8e4343379..fa797ea2eb 100644 --- a/opm/models/blackoil/blackoilbioeffectsparams.hpp +++ b/opm/models/blackoil/blackoilbioeffectsparams.hpp @@ -70,7 +70,7 @@ struct BlackOilBioeffectsParams std::vector oxygenConsumptionFactor_{}; std::vector yieldGrowthCoefficient_{}; std::vector yieldUreaToCalciteCoefficient_{}; - + std::vector> bioDiffCoefficient_{}; }; diff --git a/opm/models/blackoil/blackoilbrinemodules.hh b/opm/models/blackoil/blackoilbrinemodules.hh index 0dbf4ce8e3..7781589c19 100644 --- a/opm/models/blackoil/blackoilbrinemodules.hh +++ b/opm/models/blackoil/blackoilbrinemodules.hh @@ -230,7 +230,7 @@ public: const Evaluation& volFlux, const FluidState& upFs) { - if constexpr (enableBrine) { + if constexpr (enableBrine) { if (phaseIdx == waterPhaseIdx) { flux[contiBrineEqIdx] = decay(upFs.saltConcentration()) diff --git a/opm/models/blackoil/blackoilconvectivemixingmodule.hh b/opm/models/blackoil/blackoilconvectivemixingmodule.hh index 16a522e876..39dbbd5443 100644 --- a/opm/models/blackoil/blackoilconvectivemixingmodule.hh +++ b/opm/models/blackoil/blackoilconvectivemixingmodule.hh @@ -177,7 +177,7 @@ public: const IntensiveQuantities& intQuantsEx, const unsigned phaseIdx, const ConvectiveMixingModuleParam& info) { - + if (info.active_.empty()) { return; } diff --git a/opm/models/blackoil/blackoildiffusionmodule.hh b/opm/models/blackoil/blackoildiffusionmodule.hh index 1182855be8..128f476ed1 100644 --- a/opm/models/blackoil/blackoildiffusionmodule.hh +++ b/opm/models/blackoil/blackoildiffusionmodule.hh @@ -117,7 +117,7 @@ class BlackOilDiffusionModule public: using ExtensiveQuantities = BlackOilDiffusionExtensiveQuantities; - + #if HAVE_ECL_INPUT /*! * \brief Initialize all internal data structures needed by the diffusion module @@ -139,11 +139,11 @@ public: * integration point. Following the notation in blackoilmodel.hh, * the diffusive flux for component \f$\kappa\f$ in phase \f$\alpha\f$ * is given by: \f$-\phi b_\alpha S_\alpha D \mathbf{grad}X_\alpha^\kappa\f$, - * where \f$b_\alpha\f$ is the shrinkage/expansion factor [-], + * where \f$b_\alpha\f$ is the shrinkage/expansion factor [-], * \f$S_\alpha\f$ is the saturation [-] D is the diffusion coefficient [L/T^2] - * and \f$X_\alpha^\kappa\f$ the component mass fraction [-] or molar fraction [-], + * and \f$X_\alpha^\kappa\f$ the component mass fraction [-] or molar fraction [-], * depending on the input use_mole_fraction_ (default true) - * Each component mass/molar fraction can be computed using \f$R_s,\;R_v,\;R_{sw},\;R_{vw}\f$. + * Each component mass/molar fraction can be computed using \f$R_s,\;R_v,\;R_{sw},\;R_{vw}\f$. * For example the mass fraction are given by, * \f$X_w^G=\frac{R_{sw}}{R_{sw}+\rho_w/\rho_g}\f$, where \f$\rho_w\f$ and \f$\rho_g\f$ * are the reference densities. @@ -152,9 +152,9 @@ public: * \f$-b_{w,ij}S_{w,ij}D_{w,ij}(\frac{1}{R_{sw,ij}+\rho_w/\rho_g})DT_{ij}(R_{sw,i}-R_{sw,j})\f$ * where \f$b_{w,ij}\f$, \f$S_{w,ij}\f$, \f$D_{w,ij}\f$, and \f$R_{sw,ij}\f$ are computed using the arithmetic mean, and * the ratio \f$\frac{1}{R_{sw,ij}+\rho_w/\rho_g}\f$ is denoted as conversion factor. The diffusivity - * \f$DT_{ij}\f$ is computed in ecltransmissibility_impl.hh, using the cells porosity, face area and distance between - * cell center and the integration point. - * For mol fraction the convertion factor is given by \f$\frac{1}{R_{sw,ij}+(Mm_g\rho_w)/(Mm_w\rho_g)}\f$ + * \f$DT_{ij}\f$ is computed in ecltransmissibility_impl.hh, using the cells porosity, face area and distance between + * cell center and the integration point. + * For mol fraction the convertion factor is given by \f$\frac{1}{R_{sw,ij}+(Mm_g\rho_w)/(Mm_w\rho_g)}\f$ */ template static void addDiffusiveFlux(RateVector& flux, const Context& context, @@ -277,7 +277,7 @@ public: Evaluation diffR = 0.0; // The diffusion coefficients are given for mass concentrations - Evaluation bAvg = (inFs.saturation(waterPhaseIdx) * inFs.invB(waterPhaseIdx) + + Evaluation bAvg = (inFs.saturation(waterPhaseIdx) * inFs.invB(waterPhaseIdx) + Toolbox::value(exFs.saturation(waterPhaseIdx)) * Toolbox::value(exFs.invB(waterPhaseIdx))) / 2; diffR = inIq.microbialConcentration() - Toolbox::value(exIq.microbialConcentration()); flux[contiMicrobialEqIdx] += diff --git a/opm/models/blackoil/blackoildispersionmodule.hh b/opm/models/blackoil/blackoildispersionmodule.hh index e0b480f4b2..30eed11e26 100644 --- a/opm/models/blackoil/blackoildispersionmodule.hh +++ b/opm/models/blackoil/blackoildispersionmodule.hh @@ -52,7 +52,7 @@ namespace Opm { * \ingroup Dispersion * \class Opm::BlackOilDispersionModule * \brief Provides the auxiliary methods required for consideration of the - * dispersion equation. + * dispersion equation. */ template class BlackOilDispersionModule; @@ -379,7 +379,7 @@ class BlackOilDispersionIntensiveQuantities enum { conti0EqIdx = Indices::conti0EqIdx }; enum { enableDispersion = getPropValue() }; -public: +public: /*! * \brief Returns the max. norm of the filter velocity of the cell. */ @@ -418,7 +418,7 @@ protected: for (const auto& velocityInfo : velocityInfos) { for (unsigned i = 0; i < phaseIdxs.size(); ++i) { if (FluidSystem::phaseIsActive(phaseIdxs[i])) { - normVelocityCell_[phaseIdxs[i]] = std::max(normVelocityCell_[phaseIdxs[i]], + normVelocityCell_[phaseIdxs[i]] = std::max(normVelocityCell_[phaseIdxs[i]], std::abs(velocityInfo.velocity[conti0EqIdx + FluidSystem::canonicalToActiveCompIdx(compIdxs[i])])); } diff --git a/opm/models/blackoil/blackoilintensivequantities.hh b/opm/models/blackoil/blackoilintensivequantities.hh index bda4538aee..a5eaa8760a 100644 --- a/opm/models/blackoil/blackoilintensivequantities.hh +++ b/opm/models/blackoil/blackoilintensivequantities.hh @@ -580,7 +580,7 @@ public: timeIdx, linearizationType); Evaluation calcite_ = 0.0; if constexpr (enableMICP) { - calcite_ = priVars.makeEvaluation(Indices::calciteVolumeFractionIdx, timeIdx, linearizationType); + calcite_ = priVars.makeEvaluation(Indices::calciteVolumeFractionIdx, timeIdx, linearizationType); } porosity_ -= min(biofilm_ + calcite_, referencePorosity_ - 1e-8); } diff --git a/opm/models/blackoil/blackoillocalresidualtpfa.hh b/opm/models/blackoil/blackoillocalresidualtpfa.hh index 4ba6ed2ecc..0aadb7abe3 100644 --- a/opm/models/blackoil/blackoillocalresidualtpfa.hh +++ b/opm/models/blackoil/blackoillocalresidualtpfa.hh @@ -467,7 +467,7 @@ public: nbInfo.faceArea, moduleParams.convectiveMixingModuleParam); } - + // deal with energy (if present) if constexpr (enableEnergy) { const Scalar inAlpha = nbInfo.inAlpha; @@ -523,7 +523,7 @@ public: tmpdispersivity, normVelocityAvg); } - + // apply the scaling for the urea equation in MICP if constexpr (enableMICP) { BioeffectsModule::applyScaling(flux); diff --git a/opm/models/blackoil/blackoilnewtonmethod.hpp b/opm/models/blackoil/blackoilnewtonmethod.hpp index 25a691457f..0f5de4e006 100644 --- a/opm/models/blackoil/blackoilnewtonmethod.hpp +++ b/opm/models/blackoil/blackoilnewtonmethod.hpp @@ -390,9 +390,9 @@ protected: // keep the values above 0 // for the biofilm and calcite, we set an upper limit equal to the initial porosity - // minus 1e-8. This prevents singularities (e.g., one of the calcite source term is + // minus 1e-8. This prevents singularities (e.g., one of the calcite source term is // evaluated at 1/(iniPoro - calcite)). The value 1e-8 is taken from the salt precipitation - // clapping above. + // clapping above. if constexpr (enableBioeffects) { if (pvIdx == Indices::microbialConcentrationIdx) { nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0}); diff --git a/opm/models/blackoil/blackoilonephaseindices.hh b/opm/models/blackoil/blackoilonephaseindices.hh index 30fa5f46a6..4614510a76 100644 --- a/opm/models/blackoil/blackoilonephaseindices.hh +++ b/opm/models/blackoil/blackoilonephaseindices.hh @@ -70,7 +70,7 @@ struct BlackOilOnePhaseIndices //! Is MICP involved? (microbes, oxygen, urea, biofilm, and calcite) static constexpr bool enableMICP = numBioCompV == 5; - //! Biofilm effects on co2/h2store only for two phase indices + //! Biofilm effects on co2/h2store only for two phase indices static constexpr bool enableBiofilm = false; //! Number of solvent components to be considered diff --git a/opm/models/blackoil/blackoilprimaryvariables.hh b/opm/models/blackoil/blackoilprimaryvariables.hh index a446f233a4..95f87f5749 100644 --- a/opm/models/blackoil/blackoilprimaryvariables.hh +++ b/opm/models/blackoil/blackoilprimaryvariables.hh @@ -601,7 +601,7 @@ public: else if constexpr (enableBioeffects) { if (BioeffectsModule::hasPcfactTables() && problem.referencePorosity(globalDofIdx, 0) > 0) { unsigned satnumRegionIdx = problem.satnumRegionIndex(globalDofIdx); - Scalar Sb = biofilmVolumeFraction_() / + Scalar Sb = biofilmVolumeFraction_() / problem.referencePorosity(globalDofIdx, 0); Scalar porosityFactor = std::min(1.0 - Sb, 1.0); //phi/phi_0 const auto& pcfactTable = BioeffectsModule::pcfactTable(satnumRegionIdx); diff --git a/opm/models/blackoil/blackoilproblem.hh b/opm/models/blackoil/blackoilproblem.hh index 73b5235479..c6c7ce0838 100644 --- a/opm/models/blackoil/blackoilproblem.hh +++ b/opm/models/blackoil/blackoilproblem.hh @@ -102,7 +102,7 @@ public: unsigned, unsigned) const { return 0; } - + Scalar satnumRegionIndex(unsigned) const { return 0; } diff --git a/opm/models/blackoil/blackoilproperties.hh b/opm/models/blackoil/blackoilproperties.hh index 94b33d8704..b5216f3b5b 100644 --- a/opm/models/blackoil/blackoilproperties.hh +++ b/opm/models/blackoil/blackoilproperties.hh @@ -89,7 +89,7 @@ struct EnableTemperature { using type = UndefinedProperty; }; template struct EnableMech { using type = UndefinedProperty; }; - + //! The relative weight of the residual of the energy equation compared to the mass //! residuals //! diff --git a/opm/models/blackoil/blackoilsolventmodules.hh b/opm/models/blackoil/blackoilsolventmodules.hh index 3184488f30..7cbc124e03 100644 --- a/opm/models/blackoil/blackoilsolventmodules.hh +++ b/opm/models/blackoil/blackoilsolventmodules.hh @@ -296,7 +296,7 @@ public: } else { priVars.setPrimaryVarsMeaningSolvent(PrimaryVariables::SolventMeaning::Rsolw); priVars[solventSaturationIdx] = solventRsw; - } + } } /*! @@ -518,13 +518,13 @@ public: } } - static bool isSolubleInWater() + static bool isSolubleInWater() { return params_.rsSolw_active_; } - static bool isCO2Sol() + static bool isCO2Sol() { return params_.co2sol_; } - static bool isH2Sol() + static bool isH2Sol() { return params_.h2sol_; } private: @@ -819,13 +819,13 @@ public: const auto& muWat = fs.viscosity(waterPhaseIdx); const auto& muWatEff = brineCo2Pvt.viscosity(pvtRegionIdx, T, p, rsSolw()); mobw *= muWat / muWatEff; - } else { + } else { const auto& h2gasPvt = SolventModule::h2GasPvt(); solventInvFormationVolumeFactor_ = h2gasPvt.inverseFormationVolumeFactor(pvtRegionIdx, T, p, rv, rvw); solventRefDensity_ = h2gasPvt.gasReferenceDensity(pvtRegionIdx); - solventViscosity_ = h2gasPvt.viscosity(pvtRegionIdx, T, p, rv, rvw); - + solventViscosity_ = h2gasPvt.viscosity(pvtRegionIdx, T, p, rv, rvw); + const auto& brineH2Pvt = SolventModule::brineH2Pvt(); auto& fs = asImp_().fluidState_; const auto& bw = brineH2Pvt.inverseFormationVolumeFactor(pvtRegionIdx, T, p, rsSolw()); @@ -844,7 +844,7 @@ public: solventInvFormationVolumeFactor_ = solventPvt.inverseFormationVolumeFactor(pvtRegionIdx, T, p); solventRefDensity_ = solventPvt.referenceDensity(pvtRegionIdx); solventViscosity_ = solventPvt.viscosity(pvtRegionIdx, T, p); - } + } solventDensity_ = solventInvFormationVolumeFactor_*solventRefDensity_; effectiveProperties(elemCtx, scvIdx, timeIdx); diff --git a/opm/models/blackoil/blackoiltwophaseindices.hh b/opm/models/blackoil/blackoiltwophaseindices.hh index 28388321e6..f998fd5311 100644 --- a/opm/models/blackoil/blackoiltwophaseindices.hh +++ b/opm/models/blackoil/blackoiltwophaseindices.hh @@ -91,7 +91,7 @@ struct BlackOilTwoPhaseIndices //! Number of salt equations to be considered static constexpr int numBrine = enableBrine? 1 : 0; - //! Number of biofilm equations to be considered + //! Number of biofilm equations to be considered static constexpr int numBioComp = enableBiofilm ? numBioCompV : 0; //! Number of biocomponents in the water phase diff --git a/opm/models/blackoil/blackoilvariableandequationindices.hh b/opm/models/blackoil/blackoilvariableandequationindices.hh index 5bb4a65dbb..103b5a3a1a 100644 --- a/opm/models/blackoil/blackoilvariableandequationindices.hh +++ b/opm/models/blackoil/blackoilvariableandequationindices.hh @@ -181,7 +181,7 @@ struct BlackOilVariableAndEquationIndices //! Index of the continuity equation for the second polymer component (molecular weight) static constexpr int contiPolymerMWEqIdx = numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000; - + //! No bioeffects for three phase indices static constexpr int contiMicrobialEqIdx = -1000; static constexpr int contiOxygenEqIdx = -1000; diff --git a/opm/models/discretization/common/tpfalinearizer.hh b/opm/models/discretization/common/tpfalinearizer.hh index 041a5c2505..22dbf08d15 100644 --- a/opm/models/discretization/common/tpfalinearizer.hh +++ b/opm/models/discretization/common/tpfalinearizer.hh @@ -605,7 +605,7 @@ private: loc_flinfo[dofIdx - 1] = FlowInfo{faceId, flow, nncId}; loc_vlinfo[dofIdx - 1] = VelocityInfo{flow}; } - } + } for (unsigned bdfIdx = 0; bdfIdx < stencil.numBoundaryFaces(); ++bdfIdx) { const auto& scvf = stencil.boundaryFace(bdfIdx); diff --git a/opm/models/ptflash/flashindices.hh b/opm/models/ptflash/flashindices.hh index cb0a67964d..bce3a81664 100644 --- a/opm/models/ptflash/flashindices.hh +++ b/opm/models/ptflash/flashindices.hh @@ -74,7 +74,7 @@ public: //! Index of water saturation static constexpr int water0Idx = enableWater ? z0Idx + numComponents - 1 : -1000; - + // equation indices //! Index of the mass conservation equation for the first diff --git a/opm/models/ptflash/flashlocalresidual.hh b/opm/models/ptflash/flashlocalresidual.hh index 9f43cfdc38..0b6037eccf 100644 --- a/opm/models/ptflash/flashlocalresidual.hh +++ b/opm/models/ptflash/flashlocalresidual.hh @@ -88,7 +88,7 @@ public: // compute water storage term if (waterEnabled && phaseIdx == static_cast(waterPhaseIdx)) { const unsigned eqIdx = conti0EqIdx + numComponents; - storage[eqIdx] = + storage[eqIdx] = Toolbox::template decay(fs.density(phaseIdx)) * Toolbox::template decay(fs.saturation(phaseIdx)) * Toolbox::template decay(intQuants.porosity()); @@ -180,7 +180,7 @@ public: const Evaluation tmp = Toolbox::value(up.fluidState().density(phaseIdx)) * extQuants.volumeFlux(phaseIdx); - + if (waterEnabled && phaseIdx == static_cast(waterPhaseIdx)) { const unsigned eqIdx = conti0EqIdx + numComponents; flux[eqIdx] = tmp; diff --git a/opm/models/ptflash/flashmodel.hh b/opm/models/ptflash/flashmodel.hh index 36601b6b2b..06d38aff43 100644 --- a/opm/models/ptflash/flashmodel.hh +++ b/opm/models/ptflash/flashmodel.hh @@ -139,7 +139,7 @@ struct EnableEnergy { static constexpr bool value = false; }; template -struct EnableWater +struct EnableWater { static constexpr int value = GetPropType::waterEnabled; }; } // namespace Opm::Properties diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index 03c1d172a1..31cd1c190a 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -101,7 +101,7 @@ public: explicit Simulator(bool verbose = true) : Simulator(Communication(), verbose) - { + { } explicit Simulator(Communication comm, bool verbose = true) diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index ac11b8e051..a1c6dc771d 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -312,7 +312,7 @@ static inline int start(int argc, char **argv, bool registerParams) simulator.run(); if (myRank == 0) { - std::cout << "Simulation completed" << std::endl; + std::cout << "Simulation completed" << std::endl; } return 0; } diff --git a/opm/simulators/flow/AluGridCartesianIndexMapper.hpp b/opm/simulators/flow/AluGridCartesianIndexMapper.hpp index 7984b1ea6d..07daad669d 100644 --- a/opm/simulators/flow/AluGridCartesianIndexMapper.hpp +++ b/opm/simulators/flow/AluGridCartesianIndexMapper.hpp @@ -50,11 +50,11 @@ namespace Dune { public: #if HAVE_MPI - using Grid = Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridMPIComm>; -#else + using Grid = Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridMPIComm>; +#else using Grid = Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridNoComm>; #endif //HAVE_MPI - + // data handle for communicating global ids during load balance and communication template class GlobalIndexDataHandle : public Dune::CommDataHandleIF, int> diff --git a/opm/simulators/flow/AluGridLevelCartesianIndexMapper.hpp b/opm/simulators/flow/AluGridLevelCartesianIndexMapper.hpp index bebc0028c0..94623e2ef8 100644 --- a/opm/simulators/flow/AluGridLevelCartesianIndexMapper.hpp +++ b/opm/simulators/flow/AluGridLevelCartesianIndexMapper.hpp @@ -101,7 +101,7 @@ class LevelCartesianIndexMapper> cartesianIndexMapper_; - + void throwIfLevelPositive(int level) const { if (level) { diff --git a/opm/simulators/flow/AluGridVanguard.hpp b/opm/simulators/flow/AluGridVanguard.hpp index 73ec669e79..633e908a6a 100644 --- a/opm/simulators/flow/AluGridVanguard.hpp +++ b/opm/simulators/flow/AluGridVanguard.hpp @@ -72,10 +72,10 @@ struct Vanguard { template struct Grid { #if HAVE_MPI - using type = Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridMPIComm>; -#else + using type = Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridMPIComm>; +#else using type = Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridNoComm>; -#endif //HAVE_MPI +#endif //HAVE_MPI }; template struct EquilGrid { @@ -106,7 +106,7 @@ class AluGridVanguard : public FlowBaseVanguard public: using Grid = GetPropType; using EquilGrid = GetPropType; - using GridView = GetPropType; + using GridView = GetPropType; using CartesianIndexMapper = Dune::CartesianIndexMapper; using LevelCartesianIndexMapper = Opm::LevelCartesianIndexMapper; using EquilCartesianIndexMapper = Dune::CartesianIndexMapper; @@ -279,11 +279,11 @@ public: } std::vector cellPartition() const - { + { // not required for this type of grid yet return {}; } - + unsigned int gridEquilIdxToGridIdx(unsigned int elemIndex) const { return equilGridToGrid_[elemIndex]; } diff --git a/opm/simulators/flow/BioeffectsContainer.cpp b/opm/simulators/flow/BioeffectsContainer.cpp index 9b50ef5507..457109840a 100644 --- a/opm/simulators/flow/BioeffectsContainer.cpp +++ b/opm/simulators/flow/BioeffectsContainer.cpp @@ -107,7 +107,7 @@ outputRestart(data::Solution& sol, const bool isMICP) data::TargetType::RESTART_OPM_EXTENDED); } }; - + auto solutionMicrobes = DataEntry{"MICROBES", UnitSystem::measure::density, cMicrobes_}; insert(solutionMicrobes); auto solutionBiofilm = DataEntry{"BIOFILM", UnitSystem::measure::identity, cBiofilm_}; diff --git a/opm/simulators/flow/BlackoilModel.hpp b/opm/simulators/flow/BlackoilModel.hpp index dc73e98679..34a1ae6547 100644 --- a/opm/simulators/flow/BlackoilModel.hpp +++ b/opm/simulators/flow/BlackoilModel.hpp @@ -312,7 +312,7 @@ public: { return compNames_; } //! \brief Returns true if an NLDD solver exists - bool hasNlddSolver() const + bool hasNlddSolver() const { return nlddSolver_ != nullptr; } protected: diff --git a/opm/simulators/flow/BlackoilModelParameters.cpp b/opm/simulators/flow/BlackoilModelParameters.cpp index 633d384f73..be75780752 100644 --- a/opm/simulators/flow/BlackoilModelParameters.cpp +++ b/opm/simulators/flow/BlackoilModelParameters.cpp @@ -234,7 +234,7 @@ void BlackoilModelParameters::registerParameters() Parameters::Register ("Compute implict IPR for stability checks and stable solution search"); Parameters::Register - ("Allow checking of group constraints during inner well iterations"); + ("Allow checking of group constraints during inner well iterations"); Parameters::Register ("Maximum outer iterations in network solver before relaxing tolerance"); Parameters::Register diff --git a/opm/simulators/flow/BlackoilModelParameters.hpp b/opm/simulators/flow/BlackoilModelParameters.hpp index b88b6f0bc9..c9954290d5 100644 --- a/opm/simulators/flow/BlackoilModelParameters.hpp +++ b/opm/simulators/flow/BlackoilModelParameters.hpp @@ -306,7 +306,7 @@ public: bool use_implicit_ipr_; /// Whether to allow checking/changing to group controls during inner well iterations - bool check_group_constraints_inner_well_iterations_; + bool check_group_constraints_inner_well_iterations_; /// Maximum number of iterations in the network solver before relaxing tolerance int network_max_strict_outer_iterations_; @@ -334,7 +334,7 @@ public: /// Nonlinear solver type: newton or nldd std::string nonlinear_solver_; - + /// 'jacobi' and 'gauss-seidel' supported DomainSolveApproach local_solve_approach_{DomainSolveApproach::Jacobi}; diff --git a/opm/simulators/flow/BlackoilModelProperties.hpp b/opm/simulators/flow/BlackoilModelProperties.hpp index 9cb2ecac21..1f73cd7f56 100644 --- a/opm/simulators/flow/BlackoilModelProperties.hpp +++ b/opm/simulators/flow/BlackoilModelProperties.hpp @@ -37,7 +37,7 @@ namespace Opm::Properties { namespace TTag { struct FlowIstlSolver; -struct FlowBaseProblemBlackoil; +struct FlowBaseProblemBlackoil; struct FlowProblem { using InheritsFrom = std::tuple; }; } diff --git a/opm/simulators/flow/CpGridVanguard.hpp b/opm/simulators/flow/CpGridVanguard.hpp index 974d8a9fda..3e8d7d4d62 100644 --- a/opm/simulators/flow/CpGridVanguard.hpp +++ b/opm/simulators/flow/CpGridVanguard.hpp @@ -127,7 +127,7 @@ public: const auto& lgr_dim = this->grid().currentData()[lgr_level]->logicalCartesianSize(); const auto lgr_cartesian_index = (lgr_ijk[2]*lgr_dim[0]*lgr_dim[1]) + (lgr_ijk[1]*lgr_dim[0]) + (lgr_ijk[0]); return ParentType::lgrMappers_.value()[lgr_level].at(lgr_cartesian_index); - } + } /*! * Checking consistency of simulator */ diff --git a/opm/simulators/flow/DamarisParameters.hpp b/opm/simulators/flow/DamarisParameters.hpp index ebe6a555d0..61867185ef 100644 --- a/opm/simulators/flow/DamarisParameters.hpp +++ b/opm/simulators/flow/DamarisParameters.hpp @@ -3,7 +3,7 @@ /* Copyright 2022 SINTEF Digital, Mathematics and Cybernetics. Copyright 2023 Inria, Bretagne–Atlantique Research Center - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify diff --git a/opm/simulators/flow/DamarisWriter.hpp b/opm/simulators/flow/DamarisWriter.hpp index 86b72a73ab..9c2a70b841 100644 --- a/opm/simulators/flow/DamarisWriter.hpp +++ b/opm/simulators/flow/DamarisWriter.hpp @@ -3,7 +3,7 @@ /* Copyright 2022 SINTEF Digital, Mathematics and Cybernetics. Copyright 2023 Inria, Bretagne–Atlantique Research Center - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify @@ -76,11 +76,11 @@ void handleError(const int dam_err, Parallel::Communication comm, const std::str * * Currently only passing through PRESSURE, GLOBAL_CELL_INDEX and MPI_RANK information. * This class now passes through the 3D mesh information to Damaris to enable - * in situ visualization via Paraview or Ascent. And developed so that variables specified + * in situ visualization via Paraview or Ascent. And developed so that variables specified * through the Eclipse input deck will be available to Damaris. */ - - + + template class DamarisWriter : public EclGenericWriter, GetPropType, @@ -96,7 +96,7 @@ class DamarisWriter : public EclGenericWriter; using Element = typename GridView::template Codim<0>::Entity; using ElementMapper = GetPropType; - + using BaseType = EclGenericWriter; using DamarisVarInt = DamarisOutput::DamarisVar; using DamarisVarChar = DamarisOutput::DamarisVar; @@ -133,7 +133,7 @@ public: this->nranks_ = this->simulator_.vanguard().grid().comm().size(); this->elements_rank_offsets_.resize(this->nranks_); - + // Get the size of the unique vector elements (excludes the shared 'ghost' elements) // // Might possibly use @@ -162,7 +162,7 @@ public: this->damarisOutputModule_ = std::make_unique> (simulator, this->eclIO_->finalSummaryConfig(), this->collectOnIORank_); } - + wanted_vars_set_ = DamarisOutput::getSetOfIncludedVariables(); } @@ -177,14 +177,14 @@ public: // added this as localCellData was not being written if (!isSubStep) - this->damarisOutputModule_->invalidateLocalData() ; + this->damarisOutputModule_->invalidateLocalData() ; this->prepareLocalCellData(isSubStep, reportStepNum); this->damarisOutputModule_->outputErrorLog(cc); // The damarisWriter is not outputing well or aquifer data (yet) auto localWellData = simulator_.problem().wellModel().wellData(); // data::Well - if (! isSubStep) + if (! isSubStep) { if (localCellData.size() == 0) { this->damarisOutputModule_->assignToSolution(localCellData); @@ -192,37 +192,37 @@ public: // add cell data to perforations for Rft output this->damarisOutputModule_->addRftDataToWells(localWellData, reportStepNum, cc); - + // On first call and if the mesh and variable size change then set damarisUpdate_ to true if (damarisUpdate_ == true) { - // Sets the damaris parameter values "n_elements_local" and "n_elements_total" + // Sets the damaris parameter values "n_elements_local" and "n_elements_total" // which define sizes of the Damaris variables, per-rank and globally (over all ranks). - // Also sets the offsets to where a ranks array data sits within the global array. + // Also sets the offsets to where a ranks array data sits within the global array. // This is usefull for HDF5 output and for defining distributed arrays in Dask. dam_err_ = DamarisOutput::setupWritingPars(cc, numElements_, elements_rank_offsets_); - + // sets positions and data for non-time-varying variables MPI_RANK and GLOBAL_CELL_INDEX - this->setGlobalIndexForDamaris() ; - + this->setGlobalIndexForDamaris() ; + // Set the geometry data for the mesh model. // this function writes the mesh data directly to Damaris shared memory using Opm::DamarisOutput::DamarisVar objects. this->writeDamarisGridOutput() ; - + // Currently by default we assume a static mesh grid (the geometry unchanging through the simulation) - // Set damarisUpdate_ to true if we want to update the geometry sent to Damaris - this->damarisUpdate_ = false; + // Set damarisUpdate_ to true if we want to update the geometry sent to Damaris + this->damarisUpdate_ = false; } - + int cell_data_written = 0 ; // Call damaris_write() for all available variables - for ( const auto& damVar : localCellData ) + for ( const auto& damVar : localCellData ) { // std::map const std::string& name = damVar.first ; - // If the wanted_vars_set_ set is empty then we default to passing through + // If the wanted_vars_set_ set is empty then we default to passing through // all the variables/ - if (wanted_vars_set_.count(name) || wanted_vars_set_.empty()) + if (wanted_vars_set_.count(name) || wanted_vars_set_.empty()) { const data::CellData& dataCol = damVar.second ; OpmLog::debug(fmt::format("Name of Damaris Variable : ( rank:{}) name: {} ", rank_, name)); @@ -233,7 +233,7 @@ public: dam_err_ = DamarisOutput::setPosition(name.c_str(), this->elements_rank_offsets_[rank_]); // It does not seem I can test for what type of data is present (double or int) - // in the std::variant within the data::CellData, so I will use a try catch block. + // in the std::variant within the data::CellData, so I will use a try catch block. try { if (dataCol.data().size() >= static_cast::size_type>(this->numElements_)) { dam_err_ = DamarisOutput::write(name.c_str(), dataCol.data().data()) ; @@ -260,7 +260,7 @@ public: OpmLog::debug(fmt::format("( rank:{}) {} Damaris Variables written to the Damaris servers", rank_, cell_data_written)); } - /* + /* Code for when we want to pass to Damaris the single cell 'block' data variables auto mybloc = damarisOutputModule_->getBlockData() ; for ( auto damVar : mybloc ) { @@ -268,9 +268,9 @@ public: const std::string name = std::get<0>(damVar.first) ; const int part = std::get<1>(damVar.first) ; double dataCol = damVar.second ; - std::cout << "Name of Damaris Block Varaiable : (" << rank_ << ") " << name << " part : " << part << " Value : " << dataCol << std::endl ; - } - + std::cout << "Name of Damaris Block Varaiable : (" << rank_ << ") " << name << " part : " << part << " Value : " << dataCol << std::endl ; + } + dam_err_ = DamarisOutput::endIteration(); */ if (!this->damarisOutputModule_->getFluidPressure().empty()) @@ -278,17 +278,17 @@ public: dam_err_ = DamarisOutput::endIteration(); } DamarisOutput::handleError(dam_err_, cc, "endIteration()"); - + } // end of ! isSubstep } private: int dam_err_ ; - int rank_ ; + int rank_ ; int nranks_ ; int numElements_ ; ///< size of the unique vector elements std::unordered_set wanted_vars_set_ ; - + Simulator& simulator_; std::unique_ptr> damarisOutputModule_; std::vector elements_rank_offsets_ ; @@ -300,11 +300,11 @@ private: return enable; } - void setGlobalIndexForDamaris () + void setGlobalIndexForDamaris () { const auto& cc = simulator_.vanguard().grid().comm(); // Use damaris_set_position to set the offset in the global size of the array. - // This is used so that output functionality (e.g. HDF5Store) knows the global offsets of + // This is used so that output functionality (e.g. HDF5Store) knows the global offsets of // the data of the ranks data. dam_err_ = DamarisOutput::setPosition("GLOBAL_CELL_INDEX", elements_rank_offsets_[rank_]); DamarisOutput::handleError(dam_err_, cc, "setPosition() for GLOBAL_CELL_INDEX"); @@ -315,8 +315,8 @@ private: // N.B. MPI_RANK is only saved to HDF5 if --damaris-save-mesh-to-hdf=true is specified DamarisVarInt mpi_rank_var(1, {"n_elements_local"}, "MPI_RANK", rank_); mpi_rank_var.setDamarisPosition({static_cast(elements_rank_offsets_[rank_])}); - - // GLOBAL_CELL_INDEX is used to reorder variable data when writing to disk + + // GLOBAL_CELL_INDEX is used to reorder variable data when writing to disk // This is enabled using select-file="GLOBAL_CELL_INDEX" in the XML tag if (this->collectOnIORank_.isParallel()) { const std::vector& local_to_global = @@ -333,8 +333,8 @@ private: mpi_rank_var.setDamarisParameterAndShmem( {this->numElements_ } ) ; // Fill the created memory area std::fill(mpi_rank_var.data(), mpi_rank_var.data() + numElements_, rank_); - - // Pass the output directory string through as a Damaris variable so that + + // Pass the output directory string through as a Damaris variable so that // Python code (as an example) can use the path as required. const auto& outputDir = simulator_.vanguard().eclState().cfg().io().getOutputDir(); if (outputDir.size() > 0) { @@ -356,34 +356,34 @@ private: OpmLog::error(fmt::format("ERORR: rank {} The DUNE geometry grid has polyhedral elements - These elements are currently not supported.", rank_ )); } - // This is the template XML model for x,y,z coordinates defined in initDamarisXmlFile.cpp which is used to + // This is the template XML model for x,y,z coordinates defined in initDamarisXmlFile.cpp which is used to // build the internally generated Damaris XML configuration file. // // // - // + // // // // // DamarisVarDbl var_x(1, {"n_coords_local"}, "coordset/coords/values/x", rank_) ; - // N.B. We have not set any position/offset values (using DamarisVar::SetDamarisPosition). - // They are not needed for mesh data as each process has a local geometric model. + // N.B. We have not set any position/offset values (using DamarisVar::SetDamarisPosition). + // They are not needed for mesh data as each process has a local geometric model. // However, HDF5 collective and Dask arrays cannot be used for this data. var_x.setDamarisParameterAndShmem( { geomData.getNVertices() } ) ; - + DamarisVarDbl var_y(1, {"n_coords_local"}, "coordset/coords/values/y", rank_) ; var_y.setDamarisParameterAndShmem( { geomData.getNVertices() } ) ; - + DamarisVarDbl var_z(1, {"n_coords_local"}, "coordset/coords/values/z", rank_) ; var_z.setDamarisParameterAndShmem( { geomData.getNVertices() } ) ; - + // Now we can use the shared memory area that Damaris has allocated and use it to write the x,y,z coordinates if ( geomData.writeGridPoints(var_x, var_y, var_z) < 0) DUNE_THROW(Dune::IOError, geomData.getError() ); - - // This is the template XML model for connectivity, offsets and types, as defined in initDamarisXmlFile.cpp which is used to + + // This is the template XML model for connectivity, offsets and types, as defined in initDamarisXmlFile.cpp which is used to // build the internally generated Damaris XML configuration file. // // @@ -409,7 +409,7 @@ private: // Copy the mesh data from the Dune grid long i = 0 ; GridDataOutput::ConnectivityVertexOrder vtkorder = GridDataOutput::VTK ; - + i = geomData.writeConnectivity(var_connectivity, vtkorder) ; if ( i != geomData.getNCorners()) DUNE_THROW(Dune::IOError, geomData.getError()); @@ -422,7 +422,7 @@ private: if ( i != geomData.getNCells()) DUNE_THROW(Dune::IOError,geomData.getError()); } - catch (std::exception& e) + catch (std::exception& e) { OpmLog::error(e.what()); } diff --git a/opm/simulators/flow/EquilInitializer.hpp b/opm/simulators/flow/EquilInitializer.hpp index fc2a60261f..028fc8c946 100644 --- a/opm/simulators/flow/EquilInitializer.hpp +++ b/opm/simulators/flow/EquilInitializer.hpp @@ -182,7 +182,7 @@ public: // set the salt concentration if constexpr (enableBrine) fluidState.setSaltConcentration(initialState.saltConcentration()[elemIdx]); - + //set the (solid) salt saturation if constexpr (enableSaltPrecipitation) fluidState.setSaltSaturation(initialState.saltSaturation()[elemIdx]); diff --git a/opm/simulators/flow/FlowBaseVanguard.hpp b/opm/simulators/flow/FlowBaseVanguard.hpp index 686c15443d..6b1e60894b 100644 --- a/opm/simulators/flow/FlowBaseVanguard.hpp +++ b/opm/simulators/flow/FlowBaseVanguard.hpp @@ -206,7 +206,7 @@ public: } } - virtual int compressedIndexForInteriorLGR([[maybe_unused]] const std::string& lgr_tag, + virtual int compressedIndexForInteriorLGR([[maybe_unused]] const std::string& lgr_tag, [[maybe_unused]] const Connection& conn) const { throw std::runtime_error("compressedIndexForInteriorLGR not implemented"); diff --git a/opm/simulators/flow/FlowGenericProblem.hpp b/opm/simulators/flow/FlowGenericProblem.hpp index ee1d3e1791..af90be3d8f 100644 --- a/opm/simulators/flow/FlowGenericProblem.hpp +++ b/opm/simulators/flow/FlowGenericProblem.hpp @@ -345,7 +345,7 @@ protected: bool enableTuning_; Scalar initialTimeStepSize_; Scalar maxTimeStepAfterWellEvent_; - + // equilibration parameters int numPressurePointsEquil_; diff --git a/opm/simulators/flow/FlowGenericProblem_impl.hpp b/opm/simulators/flow/FlowGenericProblem_impl.hpp index 5f10e0328d..9be32dacf5 100644 --- a/opm/simulators/flow/FlowGenericProblem_impl.hpp +++ b/opm/simulators/flow/FlowGenericProblem_impl.hpp @@ -215,7 +215,7 @@ readRockParameters_(const std::vector& cellCenterDepths, } else if (!overburdTables.empty() && rock_config.store()) { OpmLog::warning("ROCKOPTS item 2 set to STORE, OVERBURD ignored!"); - } + } } template diff --git a/opm/simulators/flow/FlowGenericVanguard.cpp b/opm/simulators/flow/FlowGenericVanguard.cpp index d56ba17a30..d6d77d0d19 100644 --- a/opm/simulators/flow/FlowGenericVanguard.cpp +++ b/opm/simulators/flow/FlowGenericVanguard.cpp @@ -342,7 +342,7 @@ void FlowGenericVanguard::init() if(!comm_){ FlowGenericVanguard::setCommunication(std::make_unique()); } - + // set eclState if not already set as in opm flow // it means that setParams is called if(!eclState_){ @@ -350,7 +350,7 @@ void FlowGenericVanguard::init() this->defineSimulationModel(std::move(this->modelParams_)); } - + if (!this->summaryState_) { this->summaryState_ = std::make_unique (TimeService::from_time_t(this->eclSchedule_->getStartTime()), diff --git a/opm/simulators/flow/FlowProblem.hpp b/opm/simulators/flow/FlowProblem.hpp index 1051ecf0a6..d0b1ac70c7 100644 --- a/opm/simulators/flow/FlowProblem.hpp +++ b/opm/simulators/flow/FlowProblem.hpp @@ -2,7 +2,7 @@ // vi: set et ts=4 sw=4 sts=4: /* Copyright 2023 INRIA - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify @@ -1117,12 +1117,12 @@ public: LhsEval wellTransMultiplier(const IntensiveQuantities& intQuants, unsigned elementIdx) const { OPM_TIMEBLOCK_LOCAL(wellTransMultiplier, Subsystem::Wells); - + const bool implicit = !this->explicitRockCompaction_; double trans_mult = implicit ? this->simulator().problem().template computeRockCompTransMultiplier_(intQuants, elementIdx) : this->simulator().problem().getRockCompTransMultVal(elementIdx); trans_mult *= this->simulator().problem().template permFactTransMultiplier(intQuants, elementIdx); - + return trans_mult; } @@ -1657,7 +1657,7 @@ protected: if (!this->overburdenPressure_.empty()) effectivePressure -= this->overburdenPressure_[elementIdx]; - + if (rock_config.store()) { effectivePressure -= asImp_().initialFluidState(elementIdx).pressure(refPressurePhaseIdx_()); } diff --git a/opm/simulators/flow/FlowProblemBlackoil.hpp b/opm/simulators/flow/FlowProblemBlackoil.hpp index 5fa442ccd6..8ba91f341f 100644 --- a/opm/simulators/flow/FlowProblemBlackoil.hpp +++ b/opm/simulators/flow/FlowProblemBlackoil.hpp @@ -3,7 +3,7 @@ /* Copyright 2023 INRIA Copyright 2024 SINTEF Digital - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify diff --git a/opm/simulators/flow/FlowProblemComp.hpp b/opm/simulators/flow/FlowProblemComp.hpp index ed4886d687..14882b1f61 100644 --- a/opm/simulators/flow/FlowProblemComp.hpp +++ b/opm/simulators/flow/FlowProblemComp.hpp @@ -104,7 +104,7 @@ public: // tighter tolerance is needed for compositional modeling here Parameters::SetDefault>(1e-7); } - + Opm::CompositionalConfig::EOSType getEosType() const { auto& simulator = this->simulator(); @@ -361,7 +361,7 @@ public: Dune::FieldVector z(0.0); Scalar sumMoles = 0.0; for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { - if (Indices::waterEnabled && phaseIdx == static_cast(waterPhaseIdx)){ + if (Indices::waterEnabled && phaseIdx == static_cast(waterPhaseIdx)){ continue; } const auto saturation = fs.saturation(phaseIdx); @@ -450,7 +450,7 @@ protected: { readExplicitInitialConditionCompositional_(); } - + void readExplicitInitialConditionCompositional_() { const auto& simulator = this->simulator(); diff --git a/opm/simulators/flow/GenericOutputBlackoilModule.cpp b/opm/simulators/flow/GenericOutputBlackoilModule.cpp index a5f1c4e43e..eb7d837d36 100644 --- a/opm/simulators/flow/GenericOutputBlackoilModule.cpp +++ b/opm/simulators/flow/GenericOutputBlackoilModule.cpp @@ -280,7 +280,7 @@ calc_inplace(std::map& miscSummaryData, const Parallel::Communication& comm) { auto inplace = this->accumulateRegionSums(comm); - + if (comm.rank() != 0) return inplace; @@ -288,7 +288,7 @@ calc_inplace(std::map& miscSummaryData, miscSummaryData, regionData); - + return inplace; } @@ -939,7 +939,7 @@ doAllocBuffers(const unsigned bufferSize, } if (enableBioeffects_) { - // Biofilms for gas-water systems; MICP only for water systems + // Biofilms for gas-water systems; MICP only for water systems this->bioeffectsC_.allocate(bufferSize, !FluidSystem::phaseIsActive(gasPhaseIdx)); } diff --git a/opm/simulators/flow/GenericTracerModel_impl.hpp b/opm/simulators/flow/GenericTracerModel_impl.hpp index 4dc52336dc..07e26e8587 100644 --- a/opm/simulators/flow/GenericTracerModel_impl.hpp +++ b/opm/simulators/flow/GenericTracerModel_impl.hpp @@ -282,7 +282,7 @@ doInit(bool rst, std::size_t numGridDof, free_tvdp.evaluate("TRACER_CONCENTRATION", centroids_(globalDofIdx)[2]); } - } + } else { OpmLog::warning(fmt::format("No TBLKF or TVDPF given for free tracer {}. " "Initial values set to zero. ", tracer.name)); @@ -293,8 +293,8 @@ doInit(bool rst, std::size_t numGridDof, } // Solution tracer initialization only needed for gas/oil tracers with DISGAS/VAPOIL active - if (tracer.phase != Phase::WATER && - ((tracer.phase == Phase::GAS && FluidSystem::enableDissolvedGas()) || + if (tracer.phase != Phase::WATER && + ((tracer.phase == Phase::GAS && FluidSystem::enableDissolvedGas()) || (tracer.phase == Phase::OIL && FluidSystem::enableVaporizedOil()))) { // TBLKS keyword if (tracer.solution_concentration.has_value()){ @@ -322,7 +322,7 @@ doInit(bool rst, std::size_t numGridDof, solution_tvdp.evaluate("TRACER_CONCENTRATION", centroids_(globalDofIdx)[2]); } - } + } else { // No solution tracers, default to zero enableSolTracers_[tracerIdx] = false; diff --git a/opm/simulators/flow/Main.cpp b/opm/simulators/flow/Main.cpp index 9ce461cce0..79ea05a537 100644 --- a/opm/simulators/flow/Main.cpp +++ b/opm/simulators/flow/Main.cpp @@ -366,9 +366,9 @@ void Main::setupDamaris(const std::string& outputDir ) find_replace_map); int is_client; MPI_Comm new_comm; - // damaris_start() is where the Damaris Server ranks will block, until damaris_stop() + // damaris_start() is where the Damaris Server ranks will block, until damaris_stop() // is called from the client ranks - int err = damaris_start(&is_client); + int err = damaris_start(&is_client); isSimulationRank_ = (is_client > 0); if (isSimulationRank_ && err == DAMARIS_OK) { damaris_client_comm_get(&new_comm); diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index 2c62a72c40..6c223f9fa8 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -4,7 +4,7 @@ Copyright 2015 IRIS AS Copyright 2014 STATOIL ASA. Copyright 2023 Inria - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify @@ -228,7 +228,7 @@ protected: #if HAVE_DAMARIS enableDamarisOutput_ = Parameters::Get(); - + // Reset to false as we cannot use Damaris if there is only one rank. if ((enableDamarisOutput_ == true) && (FlowGenericVanguard::comm().size() == 1)) { std::string msg ; @@ -253,13 +253,13 @@ protected: } #endif // HAVE_DAMARIS - // Guard for when the Damaris core(s) return from damaris_start() + // Guard for when the Damaris core(s) return from damaris_start() // which happens when damaris_stop() is called in main simulation if (!isSimulationRank_) { exitCode = EXIT_SUCCESS; return true; } - + int mpiRank = FlowGenericVanguard::comm().rank(); outputCout_ = false; if (mpiRank == 0) diff --git a/opm/simulators/flow/MixingRateControls.cpp b/opm/simulators/flow/MixingRateControls.cpp index a617ffd871..88f8b5d3e8 100644 --- a/opm/simulators/flow/MixingRateControls.cpp +++ b/opm/simulators/flow/MixingRateControls.cpp @@ -348,7 +348,7 @@ updateConvectiveDRsDt_(const unsigned compressedDofIdx, factor /= Xhi; deltaDensity = (saturatedDensity - co2Density); } - + convectiveDrs_[compressedDofIdx] = factor * permz * rssat * max(Scalar{0.0}, deltaDensity) * gravity / ( std::max(sg_max - sg, Scalar{0.0}) * diff --git a/opm/simulators/flow/MixingRateControls.hpp b/opm/simulators/flow/MixingRateControls.hpp index 4b8a982455..e29b18d8fe 100644 --- a/opm/simulators/flow/MixingRateControls.hpp +++ b/opm/simulators/flow/MixingRateControls.hpp @@ -42,7 +42,7 @@ class EclipseState; //! \brief Class handling mixing rate controls for a FlowProblemBlackoil. template -class MixingRateControls +class MixingRateControls { public: using Scalar = typename FluidSystem::Scalar; @@ -60,7 +60,7 @@ public: bool drsdtActive(int episodeIdx) const; bool drvdtActive(int episodeIdx) const; bool drsdtConvective(int episodeIdx) const; - + bool drsdtActive(int episodeIdx, std::size_t pvtRegionIdx) const; bool drvdtActive(int episodeIdx, std::size_t pvtRegionIdx) const; bool drsdtConvective(int episodeIdx, std::size_t pvtRegionIdx) const; @@ -138,7 +138,7 @@ public: const auto& rs = (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) ? getValue(fs.Rsw()) : getValue(fs.Rs()); - + const auto& salt = getValue(fs.saltSaturation()); this->updateConvectiveDRsDt_(compressedDofIdx, diff --git a/opm/simulators/flow/NlddReporting.hpp b/opm/simulators/flow/NlddReporting.hpp index 2e436ed56c..e874cb7009 100644 --- a/opm/simulators/flow/NlddReporting.hpp +++ b/opm/simulators/flow/NlddReporting.hpp @@ -122,7 +122,7 @@ void writeNonlinearIterationsPerCell( for (auto domain_idx = 0*ds; domain_idx < ds; ++domain_idx) { const auto& domain = domains[domain_idx]; const auto& report = domain_reports[domain_idx]; - const int iterations = report.success.total_newton_iterations + + const int iterations = report.success.total_newton_iterations + report.failure.total_newton_iterations; for (const int cell_idx : domain.cells) { diff --git a/opm/simulators/flow/OutputBlackoilModule.hpp b/opm/simulators/flow/OutputBlackoilModule.hpp index e5ecfc2d6f..8c5ae36145 100644 --- a/opm/simulators/flow/OutputBlackoilModule.hpp +++ b/opm/simulators/flow/OutputBlackoilModule.hpp @@ -937,7 +937,7 @@ private: } if constexpr(enableBioeffects) { - const auto surfVolWat = pv * getValue(fs.saturation(waterPhaseIdx)) * + const auto surfVolWat = pv * getValue(fs.saturation(waterPhaseIdx)) * getValue(fs.invB(waterPhaseIdx)); if (this->fipC_.hasMicrobialMass()) { this->updateMicrobialMass(globalDofIdx, intQuants, surfVolWat); @@ -1089,7 +1089,7 @@ private: const Scalar rhoW = FluidSystem::referenceDensity(waterPhaseIdx, fs.pvtRegionIndex()); this->fipC_.assignWaterMass(globalDofIdx, fip, rhoW); - } + } template void updateMicrobialMass(const unsigned globalDofIdx, @@ -2247,7 +2247,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * std::min(strandedGas, sg); } @@ -2271,7 +2271,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * std::max(Scalar{0.0}, sg - strandedGas); } @@ -2293,7 +2293,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * std::min(trappedGas, getValue(ectx.fs.saturation(gasPhaseIdx))); } @@ -2315,7 +2315,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * std::max(Scalar{0.0}, getValue(ectx.fs.saturation(gasPhaseIdx)) - trappedGas); } @@ -2327,7 +2327,7 @@ private: { const auto& scaledDrainageInfo = problem.materialLawManager() ->oilWaterScaledEpsInfoDrainage(ectx.dofIdx); - const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); + const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); Scalar sgcr = scaledDrainageInfo.Sgcr; if (problem.materialLawManager()->enableHysteresis()) { const auto& matParams = problem.materialLawParams(ectx.dofIdx); @@ -2342,7 +2342,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * getValue(ectx.fs.saturation(gasPhaseIdx)); } @@ -2355,7 +2355,7 @@ private: { const auto& scaledDrainageInfo = problem.materialLawManager() ->oilWaterScaledEpsInfoDrainage(ectx.dofIdx); - const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); + const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); Scalar sgcr = scaledDrainageInfo.Sgcr; if (problem.materialLawManager()->enableHysteresis()) { const auto& matParams = problem.materialLawParams(ectx.dofIdx); @@ -2370,7 +2370,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * getValue(ectx.fs.saturation(gasPhaseIdx)); } @@ -2393,7 +2393,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * std::min(sgcr, getValue(ectx.fs.saturation(gasPhaseIdx))) / FluidSystem::molarMass(gasCompIdx, ectx.intQuants.pvtRegionIndex()); @@ -2416,7 +2416,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * std::max(Scalar{0.0}, getValue(ectx.fs.saturation(gasPhaseIdx)) - sgcr) / FluidSystem::molarMass(gasCompIdx, ectx.intQuants.pvtRegionIndex()); @@ -2429,7 +2429,7 @@ private: { const auto& scaledDrainageInfo = problem.materialLawManager() ->oilWaterScaledEpsInfoDrainage(ectx.dofIdx); - const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); + const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); Scalar sgcr = scaledDrainageInfo.Sgcr; if (problem.materialLawManager()->enableHysteresis()) { const auto& matParams = problem.materialLawParams(ectx.dofIdx); @@ -2444,7 +2444,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * getValue(ectx.fs.saturation(gasPhaseIdx)) / FluidSystem::molarMass(gasCompIdx, ectx.intQuants.pvtRegionIndex()); @@ -2458,7 +2458,7 @@ private: { const auto& scaledDrainageInfo = problem.materialLawManager() ->oilWaterScaledEpsInfoDrainage(ectx.dofIdx); - const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); + const Scalar sg = getValue(ectx.fs.saturation(gasPhaseIdx)); Scalar sgcr = scaledDrainageInfo.Sgcr; if (problem.materialLawManager()->enableHysteresis()) { const auto& matParams = problem.materialLawParams(ectx.dofIdx); @@ -2473,7 +2473,7 @@ private: : FluidSystem::convertRvToXgO(getValue(ectx.fs.Rv()), ectx.intQuants.pvtRegionIndex()); return (1.0 - xgW) * model.dofTotalVolume(ectx.globalDofIdx) * - getValue(ectx.intQuants.porosity()) * + getValue(ectx.intQuants.porosity()) * getValue(ectx.fs.density(gasPhaseIdx)) * getValue(ectx.fs.saturation(gasPhaseIdx)) / FluidSystem::molarMass(gasCompIdx, ectx.intQuants.pvtRegionIndex()); diff --git a/opm/simulators/flow/ReservoirCouplingMaster.cpp b/opm/simulators/flow/ReservoirCouplingMaster.cpp index 082b4e2d78..a15da21f22 100644 --- a/opm/simulators/flow/ReservoirCouplingMaster.cpp +++ b/opm/simulators/flow/ReservoirCouplingMaster.cpp @@ -396,4 +396,3 @@ getMasterActivationDate_() const } // namespace Opm - diff --git a/opm/simulators/flow/SimulatorFullyImplicitBlackoil.hpp b/opm/simulators/flow/SimulatorFullyImplicitBlackoil.hpp index f60eab1802..ff3170dfa8 100644 --- a/opm/simulators/flow/SimulatorFullyImplicitBlackoil.hpp +++ b/opm/simulators/flow/SimulatorFullyImplicitBlackoil.hpp @@ -540,7 +540,7 @@ public: // Increment timer, remember well state. ++timer; - + if (terminalOutput_) { std::string msg = "Time step took " + std::to_string(solverTimer_->secsSinceStart()) + " seconds; " diff --git a/opm/simulators/flow/equil/EquilibrationHelpers.cpp b/opm/simulators/flow/equil/EquilibrationHelpers.cpp index 4ad2fb4abc..821771f175 100644 --- a/opm/simulators/flow/equil/EquilibrationHelpers.cpp +++ b/opm/simulators/flow/equil/EquilibrationHelpers.cpp @@ -26,7 +26,7 @@ namespace Opm { namespace EQUIL { - + template using MatLaw = EclMaterialLaw::Manager>; template using FS = BlackOilFluidSystem; diff --git a/opm/simulators/flow/equil/InitStateEquil.hpp b/opm/simulators/flow/equil/InitStateEquil.hpp index f7ea44f6b7..fc4f49d8cd 100644 --- a/opm/simulators/flow/equil/InitStateEquil.hpp +++ b/opm/simulators/flow/equil/InitStateEquil.hpp @@ -724,7 +724,7 @@ private: template void updateInitialSaltSaturation_(const EclipseState& eclState, const RMap& reg); - void updateCellProps_(const GridView& gridView, + void updateCellProps_(const GridView& gridView, const NumericalAquifers& aquifer); void applyNumericalAquifers_(const GridView& gridView, diff --git a/opm/simulators/flow/equil/InitStateEquil_impl.hpp b/opm/simulators/flow/equil/InitStateEquil_impl.hpp index e384bccf8b..ea3bbcf4c0 100644 --- a/opm/simulators/flow/equil/InitStateEquil_impl.hpp +++ b/opm/simulators/flow/equil/InitStateEquil_impl.hpp @@ -1834,7 +1834,7 @@ calcPressSatRsRv(const RMap& reg, using PhaseSat = Details::PhaseSaturations< MaterialLawManager, FluidSystem, EquilReg, typename RMap::CellId >; - + auto ptable = Details::PressureTable>{ grav, this->num_pressure_points_ }; auto psat = PhaseSat { materialLawManager, this->swatInit_ }; auto vspan = std::array{}; diff --git a/opm/simulators/linalg/FlexibleSolver_impl.hpp b/opm/simulators/linalg/FlexibleSolver_impl.hpp index 572314bd5c..4e1d0d1e9c 100644 --- a/opm/simulators/linalg/FlexibleSolver_impl.hpp +++ b/opm/simulators/linalg/FlexibleSolver_impl.hpp @@ -168,8 +168,8 @@ namespace Dune const int verbosity = is_iorank ? prm.get("verbosity", 0) : 0; const std::string solver_type = prm.get("solver", "bicgstab"); - - // make sure it is nullptr at the start (used for error checking in the end). + + // make sure it is nullptr at the start (used for error checking in the end). // while the linSolver_ is initalized as a nullptr, we want to make sure it is reset here, // simply because we will check if it is at the end of this function and need to keep this invariant // (that it is nullptr at the start of this function). @@ -197,7 +197,7 @@ namespace Dune restart, maxiter, // maximum number of iterations verbosity); - + } else { if constexpr (!Opm::is_gpu_operator_v) { if (solver_type == "flexgmres") { diff --git a/opm/simulators/linalg/ISTLSolverGpuBridge.cpp b/opm/simulators/linalg/ISTLSolverGpuBridge.cpp index 0436ebeced..0a103d0e3b 100644 --- a/opm/simulators/linalg/ISTLSolverGpuBridge.cpp +++ b/opm/simulators/linalg/ISTLSolverGpuBridge.cpp @@ -117,7 +117,7 @@ apply(Vector& rhs, bool use_multithreading = true; #if HAVE_OPENMP - // if user manually sets --threads-per-process=1, do not use multithreading + // if user manually sets --threads-per-process=1, do not use multithreading if (omp_get_max_threads() == 1) use_multithreading = false; #endif // HAVE_OPENMP diff --git a/opm/simulators/linalg/ISTLSolverRuntimeOptionProxy.hpp b/opm/simulators/linalg/ISTLSolverRuntimeOptionProxy.hpp index b7dc8922c5..72bb090025 100644 --- a/opm/simulators/linalg/ISTLSolverRuntimeOptionProxy.hpp +++ b/opm/simulators/linalg/ISTLSolverRuntimeOptionProxy.hpp @@ -27,7 +27,7 @@ #if HAVE_CUDA #include -#endif +#endif namespace Opm { @@ -153,15 +153,15 @@ private: #else istlSolver_ = std::make_unique>(simulator, std::forward(args)...); #endif - } + } #if HAVE_CUDA else if (backend == Parameters::LinearSolverAcceleratorType::GPU) { istlSolver_ = std::make_unique>(simulator, std::forward(args)...); - } + } #endif else { // If we reach here, it means the backend is not supported. This could be because we have added a third backend - // that we need to handle. A user error would be handled in the linearSolverAcceleratorTypeFromString function called above. + // that we need to handle. A user error would be handled in the linearSolverAcceleratorTypeFromString function called above. OPM_THROW(std::invalid_argument, fmt::format("Unknown backend: {}", Parameters::toString(backend))); } } diff --git a/opm/simulators/linalg/LinearSolverAcceleratorType.hpp b/opm/simulators/linalg/LinearSolverAcceleratorType.hpp index 8549b1e51c..b724afd6df 100644 --- a/opm/simulators/linalg/LinearSolverAcceleratorType.hpp +++ b/opm/simulators/linalg/LinearSolverAcceleratorType.hpp @@ -26,7 +26,7 @@ namespace Opm::Parameters { -/** +/** * For the CLI options. */ struct LinearSolverAccelerator { static constexpr auto value = "cpu"; }; diff --git a/opm/simulators/linalg/ParallelIstlInformation.hpp b/opm/simulators/linalg/ParallelIstlInformation.hpp index 44a02e4607..0c0ce15e0b 100644 --- a/opm/simulators/linalg/ParallelIstlInformation.hpp +++ b/opm/simulators/linalg/ParallelIstlInformation.hpp @@ -118,10 +118,10 @@ public: /// one global communication. /// The possible functors needed can be constructed with Opm::Reduction::makeGlobalMaxFunctor(), /// Opm::Reduction::makeLInfinityNormFunctor(), - /// Opm::Reduction::makeGlobalMinFunctor(), and + /// Opm::Reduction::makeGlobalMinFunctor(), and /// Opm::Reduction::makeGlobalSumFunctor(). /// \tparam type of the container or the tuple of containers. - /// \tparam tyoe of the operator or a tuple of operators, examples are e.g. + /// \tparam tyoe of the operator or a tuple of operators, examples are e.g. /// Reduction::MaskIDOperator, Reduction::MaskToMinOperator, /// and Reduction::MaskToMaxOperator. Has to provide an operator() that takes three /// arguments (the last one is the mask value: 1 for a dof that we own, 0 otherwise), diff --git a/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp b/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp index 822ea19e34..6c86be406c 100644 --- a/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp +++ b/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp @@ -101,7 +101,7 @@ void ghost_last_bilu0_decomposition (M& A, std::size_t interiorSize) template void convertToCRS(const M& A, CRS& lower, CRS& upper, InvVector& inv) { - OPM_TIMEBLOCK(convertToCRS); + OPM_TIMEBLOCK(convertToCRS); // No need to do anything for 0 rows. Return to prevent indexing a // a zero sized array. if ( A.N() == 0 ) diff --git a/opm/simulators/linalg/PreconditionerWithUpdate.hpp b/opm/simulators/linalg/PreconditionerWithUpdate.hpp index 8e33895ed0..a396fe2595 100644 --- a/opm/simulators/linalg/PreconditionerWithUpdate.hpp +++ b/opm/simulators/linalg/PreconditionerWithUpdate.hpp @@ -108,7 +108,7 @@ struct GeneralPreconditionerMaker { template struct PreconditionerMaker : public GeneralPreconditionerMaker { using GenericPreconditioner = Preconditioner; - + explicit PreconditionerMaker(Args&&... args) : args_(args...) { diff --git a/opm/simulators/linalg/PressureBhpTransferPolicy.hpp b/opm/simulators/linalg/PressureBhpTransferPolicy.hpp index f8fedcb25c..3d6e78bae9 100644 --- a/opm/simulators/linalg/PressureBhpTransferPolicy.hpp +++ b/opm/simulators/linalg/PressureBhpTransferPolicy.hpp @@ -272,4 +272,3 @@ private: }; } // namespace Opm - diff --git a/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp b/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp index fbc62cac40..65ce544207 100644 --- a/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp +++ b/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp @@ -32,7 +32,7 @@ namespace Opm template struct StandardPreconditioners>> + typename std::enable_if_t>> { using O = Operator; @@ -62,9 +62,9 @@ struct StandardPreconditioners&, std::size_t) -> PrecPtr { @@ -150,7 +150,7 @@ struct StandardPreconditioners::makeAmgPreconditioner(const Operator& } template // Note: Last argument is to allow partial specialization for GPU -struct StandardPreconditioners +struct StandardPreconditioners { static void add() { @@ -343,10 +343,10 @@ struct StandardPreconditioners using field_type = typename V::field_type; using GpuJac = typename gpuistl::GpuJac, gpuistl::GpuVector, gpuistl::GpuVector>; - - using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, + + using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, GpuJac, M>; - + auto gpuJac = std::make_shared(op.getmat(), w); auto adapted = std::make_shared>(gpuJac); @@ -361,9 +361,9 @@ struct StandardPreconditioners const bool reorder = prm.get("reorder", true); using field_type = typename V::field_type; using GpuDILU = typename gpuistl::GpuDILU, gpuistl::GpuVector>; - using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, + using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, GpuDILU, M>; - + // Note: op.getmat() is passed twice, because the GpuDILU needs both the CPU and GPU matrix. // The first argument will be converted to a GPU matrix, and the second one is used as a CPU matrix. auto gpuDILU = std::make_shared(op.getmat(), op.getmat(), split_matrix, tune_gpu_kernels, mixed_precision_scheme, reorder); @@ -380,9 +380,9 @@ struct StandardPreconditioners using field_type = typename V::field_type; using OpmGpuILU0 = typename gpuistl::OpmGpuILU0, gpuistl::GpuVector>; - using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, + using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, OpmGpuILU0, M>; - + // Note: op.getmat() is passed twice, because the OPMGPUILU0 needs both the CPU and GPU matrix. // The first argument will be converted to a GPU matrix, and the second one is used as a CPU matrix. auto gpuilu0 = std::make_shared(op.getmat(), op.getmat(), split_matrix, tune_gpu_kernels, mixed_precision_scheme); diff --git a/opm/simulators/linalg/StandardPreconditioners_serial.hpp b/opm/simulators/linalg/StandardPreconditioners_serial.hpp index 368656869b..b45c7bfb80 100644 --- a/opm/simulators/linalg/StandardPreconditioners_serial.hpp +++ b/opm/simulators/linalg/StandardPreconditioners_serial.hpp @@ -33,7 +33,7 @@ namespace Opm { template -struct StandardPreconditioners>> +struct StandardPreconditioners>> { static void add() { @@ -264,8 +264,8 @@ struct StandardPreconditioners, gpuistl::GpuVector, gpuistl::GpuVector>; - - using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, + + using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, GPUJac, M>; return std::make_shared>( std::make_shared(op.getmat(), w)); @@ -278,10 +278,10 @@ struct StandardPreconditioners, gpuistl::GpuVector>; - using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, + using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, GPUILU0, M>; return std::make_shared>( - // Note: op.getmat() is passed twice, because the ILU0 needs both the CPU and GPU matrix. + // Note: op.getmat() is passed twice, because the ILU0 needs both the CPU and GPU matrix. // The first argument will be converted to a GPU matrix, and the second one is used as a CPU matrix. std::make_shared(op.getmat(), op.getmat(), split_matrix, tune_gpu_kernels, mixed_precision_scheme)); }); @@ -294,10 +294,10 @@ struct StandardPreconditioners("reorder", true); using field_type = typename V::field_type; using GPUDILU = typename gpuistl::GpuDILU, gpuistl::GpuVector>; - using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, + using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, GPUDILU, M>; return std::make_shared>( - // Note: op.getmat() is passed twice, because the DILU needs both the CPU and GPU matrix. + // Note: op.getmat() is passed twice, because the DILU needs both the CPU and GPU matrix. // The first argument will be converted to a GPU matrix, and the second one is used as a CPU matrix. std::make_shared(op.getmat(), op.getmat(), split_matrix, tune_gpu_kernels, mixed_precision_scheme, reorder)); }); @@ -312,14 +312,14 @@ struct StandardPreconditioners>; using matrix_type_to = typename Dune::BCRSMatrix>; using GpuDILU = typename gpuistl::GpuDILU, gpuistl::GpuVector>; - using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, + using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, GpuDILU, matrix_type_to>; using Adapter = typename gpuistl::PreconditionerAdapter; using Converter = typename gpuistl::PreconditionerConvertFieldTypeAdapter; - + auto converted = std::make_shared(op.getmat()); - // Note: converted->getConvertedMatrix() is passed twice, because the DILU needs both the CPU and GPU matrix. + // Note: converted->getConvertedMatrix() is passed twice, because the DILU needs both the CPU and GPU matrix. // The first argument will be converted to a GPU matrix, and the second one is used as a CPU matrix. auto adapted = std::make_shared(std::make_shared( converted->getConvertedMatrix(), converted->getConvertedMatrix(), diff --git a/opm/simulators/linalg/WellOperators.hpp b/opm/simulators/linalg/WellOperators.hpp index 49d0e03905..6dcc25709d 100644 --- a/opm/simulators/linalg/WellOperators.hpp +++ b/opm/simulators/linalg/WellOperators.hpp @@ -390,9 +390,9 @@ protected: }; /*! - \brief Dune linear operator that assumes ghost rows are ordered after + \brief Dune linear operator that assumes ghost rows are ordered after interior rows. Avoids some computations because of this. - + This is similar to WellModelGhostLastMatrixAdapter, with the difference that here we do not have a well model, and also do calcilate the interiorSize using the parallel index set. Created for use in AMG/CPR smoothers. @@ -513,4 +513,3 @@ public: } // end namespace Dune #endif // OPM_WELLOPERATORS_HEADER_INCLUDED - diff --git a/opm/simulators/linalg/gpubridge/CprCreation.cpp b/opm/simulators/linalg/gpubridge/CprCreation.cpp index 3add337389..b98c0345e5 100644 --- a/opm/simulators/linalg/gpubridge/CprCreation.cpp +++ b/opm/simulators/linalg/gpubridge/CprCreation.cpp @@ -263,7 +263,7 @@ analyzeHierarchy() template void CprCreation:: -analyzeAggregateMaps() +analyzeAggregateMaps() { PcolIndices.resize(num_levels - 1); Rmatrices.clear(); @@ -317,5 +317,3 @@ INSTANTIATE_TYPE(float) #endif } // namespace Opm - - diff --git a/opm/simulators/linalg/gpubridge/CprCreation.hpp b/opm/simulators/linalg/gpubridge/CprCreation.hpp index 04a4d4d12d..c3a3bf53cd 100644 --- a/opm/simulators/linalg/gpubridge/CprCreation.hpp +++ b/opm/simulators/linalg/gpubridge/CprCreation.hpp @@ -42,17 +42,17 @@ class CprCreation int cprnnz; int cprnnzb; -public: +public: CprCreation(); protected: - + int num_levels; std::vector weights, coarse_vals, coarse_x, coarse_y; std::vector> Amatrices, Rmatrices; // scalar matrices that represent the AMG hierarchy std::vector > PcolIndices; // prolongation does not need a full matrix, only store colIndices std::vector > invDiags; // inverse of diagonal of Amatrices - + BlockedMatrix *mat = nullptr; // input matrix, blocked using DuneMat = Dune::BCRSMatrix >; @@ -85,4 +85,3 @@ protected: } // namespace Opm #endif - diff --git a/opm/simulators/linalg/gpubridge/Misc.cpp b/opm/simulators/linalg/gpubridge/Misc.cpp index f699df7f4f..628fa7a779 100644 --- a/opm/simulators/linalg/gpubridge/Misc.cpp +++ b/opm/simulators/linalg/gpubridge/Misc.cpp @@ -26,7 +26,7 @@ Scalar get_absmax(const Scalar* data, // solve A^T * x = b template -void solve_transposed_3x3(const Scalar* A, +void solve_transposed_3x3(const Scalar* A, const Scalar* b, Scalar* x) { diff --git a/opm/simulators/linalg/gpubridge/Misc.hpp b/opm/simulators/linalg/gpubridge/Misc.hpp index a9571f69cb..710ea63ebc 100644 --- a/opm/simulators/linalg/gpubridge/Misc.hpp +++ b/opm/simulators/linalg/gpubridge/Misc.hpp @@ -61,7 +61,7 @@ std::cerr << "rocsparseSolverBackend::rocsparse error: " << stat << std::endl; \ } \ } while(0) - + namespace Opm::Accelerator { unsigned int ceilDivision(const unsigned int A, diff --git a/opm/simulators/linalg/gpubridge/MultisegmentWellContribution.cpp b/opm/simulators/linalg/gpubridge/MultisegmentWellContribution.cpp index a49a82bb84..e1f6c74af0 100644 --- a/opm/simulators/linalg/gpubridge/MultisegmentWellContribution.cpp +++ b/opm/simulators/linalg/gpubridge/MultisegmentWellContribution.cpp @@ -142,4 +142,3 @@ template class MultisegmentWellContribution; #endif } //namespace Opm - diff --git a/opm/simulators/linalg/gpubridge/Preconditioner.hpp b/opm/simulators/linalg/gpubridge/Preconditioner.hpp index bd4499fd40..8e1ccaeb5b 100644 --- a/opm/simulators/linalg/gpubridge/Preconditioner.hpp +++ b/opm/simulators/linalg/gpubridge/Preconditioner.hpp @@ -55,7 +55,7 @@ protected: public: virtual ~Preconditioner() = default; - + static std::unique_ptr create(PreconditionerType type, bool opencl_ilu_parallel, int verbosity); diff --git a/opm/simulators/linalg/gpubridge/amgclSolverBackend.hpp b/opm/simulators/linalg/gpubridge/amgclSolverBackend.hpp index a69159bfd5..ae1f826b60 100644 --- a/opm/simulators/linalg/gpubridge/amgclSolverBackend.hpp +++ b/opm/simulators/linalg/gpubridge/amgclSolverBackend.hpp @@ -143,7 +143,7 @@ public: std::shared_ptr> jacMatrix, WellContributions& wellContribs, GpuResult& res) override; - + /// Get result after linear solve, and peform postprocessing if necessary /// \param[inout] x resulting x vector, caller must guarantee that x points to a valid array void get_result(Scalar* x) override; diff --git a/opm/simulators/linalg/gpubridge/cuda/cusparseSolverBackend.hpp b/opm/simulators/linalg/gpubridge/cuda/cusparseSolverBackend.hpp index 365e6356f4..994c4cb0d3 100644 --- a/opm/simulators/linalg/gpubridge/cuda/cusparseSolverBackend.hpp +++ b/opm/simulators/linalg/gpubridge/cuda/cusparseSolverBackend.hpp @@ -67,7 +67,7 @@ private: bool useJacMatrix = false; int nnzbs_prec; // number of nonzero blocks in the matrix for preconditioner // could be jacMatrix or matrix - + double c_copy = 0.0; // cummulative timer measuring the total time it takes to transfer the data to the GPU /// Solve linear system using ilu0-bicgstab @@ -139,7 +139,7 @@ public: std::shared_ptr> jacMatrix, WellContributions& wellContribs, GpuResult& res) override; - + /// Get resulting vector x after linear solve, also includes post processing if necessary /// \param[inout] x resulting x vector, caller must guarantee that x points to a valid array void get_result(Scalar* x) override; @@ -149,4 +149,3 @@ public: } // namespace Opm::Accelerator #endif - diff --git a/opm/simulators/linalg/gpubridge/opencl/ChowPatelIlu.cpp b/opm/simulators/linalg/gpubridge/opencl/ChowPatelIlu.cpp index 67a39cb580..ca0fd42d58 100644 --- a/opm/simulators/linalg/gpubridge/opencl/ChowPatelIlu.cpp +++ b/opm/simulators/linalg/gpubridge/opencl/ChowPatelIlu.cpp @@ -1005,4 +1005,3 @@ INSTANTIATE_GPU_FUNCTIONS(6); } // namespace Opm #endif // CHOW_PATEL - diff --git a/opm/simulators/linalg/gpubridge/opencl/openclCPR.cpp b/opm/simulators/linalg/gpubridge/opencl/openclCPR.cpp index 5336db6d7b..8a224eb74f 100644 --- a/opm/simulators/linalg/gpubridge/opencl/openclCPR.cpp +++ b/opm/simulators/linalg/gpubridge/opencl/openclCPR.cpp @@ -99,13 +99,13 @@ create_preconditioner(BlockedMatrix* mat_, BlockedMatrix* jacMat Dune::Timer t_amg; this->create_preconditioner_amg(this->mat); // already points to bilu0::rmat if needed - + if (verbosity >= 3) { std::ostringstream out; out << "openclCPR create_preconditioner_amg(): " << t_amg.stop() << " s"; OpmLog::info(out.str()); } - + // initialize OpenclMatrices and Buffers if needed auto init_func = std::bind(&openclCPR::init_opencl_buffers, this); std::call_once(opencl_buffers_allocated, init_func); @@ -134,7 +134,7 @@ create_preconditioner(BlockedMatrix* mat_) { out << "openclCPR create_preconditioner_amg(): " << t_amg.stop() << " s"; OpmLog::info(out.str()); } - + // initialize OpenclMatrices and Buffers if needed auto init_func = std::bind(&openclCPR::init_opencl_buffers, this); std::call_once(opencl_buffers_allocated, init_func); diff --git a/opm/simulators/linalg/gpubridge/opencl/openclCPR.hpp b/opm/simulators/linalg/gpubridge/opencl/openclCPR.hpp index 53aea96ea7..bf7a524535 100644 --- a/opm/simulators/linalg/gpubridge/opencl/openclCPR.hpp +++ b/opm/simulators/linalg/gpubridge/opencl/openclCPR.hpp @@ -106,4 +106,3 @@ public: } // namespace Opm::Accelerator #endif - diff --git a/opm/simulators/linalg/gpubridge/rocm/hipKernels.cpp b/opm/simulators/linalg/gpubridge/rocm/hipKernels.cpp index 78a89fd926..c122da8f06 100644 --- a/opm/simulators/linalg/gpubridge/rocm/hipKernels.cpp +++ b/opm/simulators/linalg/gpubridge/rocm/hipKernels.cpp @@ -146,12 +146,12 @@ __global__ void residual_blocked_k(const Scalar *vals, const unsigned int lane = idx_t % warpsize; const unsigned int c = (lane / bs) % bs; const unsigned int r = lane % bs; - + // for 3x3 blocks: // num_active_threads: 27 (CUDA) vs 63 (ROCM) // num_blocks_per_warp: 3 (CUDA) vs 7 (ROCM) - int offsetTarget = warpsize == 64 ? 48 : 32; - + int offsetTarget = warpsize == 64 ? 48 : 32; + while(target_block_row < Nb){ unsigned int first_block = rows[target_block_row]; unsigned int last_block = rows[target_block_row+1]; @@ -167,8 +167,8 @@ __global__ void residual_blocked_k(const Scalar *vals, } // do reduction in shared mem - tmp[lane] = local_out; - + tmp[lane] = local_out; + for(unsigned int offset = 3; offset <= offsetTarget; offset <<= 1) { if (lane + offset < warpsize) @@ -177,7 +177,7 @@ __global__ void residual_blocked_k(const Scalar *vals, } __syncthreads(); } - + if(lane < bs){ unsigned int row = target_block_row*bs + lane; out[row] = rhs[row] - tmp[lane]; @@ -186,7 +186,7 @@ __global__ void residual_blocked_k(const Scalar *vals, } } -// KERNEL residual_k +// KERNEL residual_k // res = rhs - mat * x // algorithm based on: // Optimization of Block Sparse Matrix-Vector Multiplication on Shared-MemoryParallel Architectures, @@ -251,7 +251,7 @@ __global__ void spmv_k(const Scalar *vals, extern __shared__ Scalar tmp[]; const unsigned int bsize = blockDim.x; const unsigned int gid = blockDim.x * blockIdx.x + threadIdx.x; - const unsigned int idx_b = gid / bsize; + const unsigned int idx_b = gid / bsize; const unsigned int idx_t = threadIdx.x; const unsigned int num_workgroups = gridDim.x; @@ -351,7 +351,7 @@ full_to_pressure_restriction([[maybe_unused]] const Scalar* fine_y, #else OPM_THROW(std::logic_error, "Error full_to_pressure_restriction for rocsparse only supported when compiling with hipcc"); #endif - + if (verbosity >= 4) { std::ostringstream oss; oss << std::scientific << "HipKernels full_to_pressure_restriction() time: " << t.stop() << " s"; @@ -396,12 +396,12 @@ prolongate_vector([[maybe_unused]] const Scalar* in, [[maybe_unused]] hipStream_t stream) { Timer t; - + #ifdef __HIP__ unsigned blockDim = 64; unsigned blocks = Accelerator::ceilDivision(N, blockDim); unsigned gridDim = blocks * blockDim; - unsigned shared_mem_size = blockDim * sizeof(Scalar); + unsigned shared_mem_size = blockDim * sizeof(Scalar); // dim3(N) will create a vector {N, 1, 1} prolongate_vector_k<<>>(in, out, cols, N); @@ -435,7 +435,7 @@ residual([[maybe_unused]] Scalar* vals, unsigned blockDim = 64; const unsigned int num_work_groups = Accelerator::ceilDivision(Nb, blockDim); unsigned gridDim = num_work_groups * blockDim; - unsigned shared_mem_size = blockDim * sizeof(Scalar); + unsigned shared_mem_size = blockDim * sizeof(Scalar); if (block_size > 1) { // dim3(N) will create a vector {N, 1, 1} @@ -447,7 +447,7 @@ residual([[maybe_unused]] Scalar* vals, #else OPM_THROW(std::logic_error, "Error residual for rocsparse only supported when compiling with hipcc"); #endif - + if (verbosity >= 4) { HIP_CHECK(hipStreamSynchronize(stream)); std::ostringstream oss; @@ -472,15 +472,15 @@ spmv([[maybe_unused]] Scalar* vals, unsigned blockDim = 64; const unsigned int num_work_groups = Accelerator::ceilDivision(Nb, blockDim); unsigned gridDim = num_work_groups * blockDim; - unsigned shared_mem_size = blockDim * sizeof(Scalar); + unsigned shared_mem_size = blockDim * sizeof(Scalar); spmv_k<<>>(vals, cols, rows, Nb, x, y); - + HIP_CHECK(hipStreamSynchronize(stream)); #else OPM_THROW(std::logic_error, "Error spmv for rocsparse only supported when compiling with hipcc"); #endif - + if (verbosity >= 4) { std::ostringstream oss; oss << std::scientific << "HipKernels spmv_blocked() time: " << t_spmv.stop() << " s"; diff --git a/opm/simulators/linalg/gpubridge/rocm/hipKernels.hpp b/opm/simulators/linalg/gpubridge/rocm/hipKernels.hpp index 10072281d3..164b5e66a9 100644 --- a/opm/simulators/linalg/gpubridge/rocm/hipKernels.hpp +++ b/opm/simulators/linalg/gpubridge/rocm/hipKernels.hpp @@ -35,14 +35,14 @@ class HipKernels private: static int verbosity; static bool initialized; - + HipKernels(); - + public: /// Initialize verbosity level for the HIP kernels /// \param[in] verbosity verbosity level static void init(int verbosity); - + /// Transform blocked vector to scalar vector using pressure-weights, where every workitem handles one blockrow /// \param[in] fine_y Input y vector /// \param[in] weights Weights used to combine cells @@ -57,7 +57,7 @@ public: /// Add the coarse pressure solution back to the finer, complete solution; every workitem handles one blockrow /// \param[in] coarse_x Input scalar x vector - /// \param[out] fine_x Output blocked x vector + /// \param[out] fine_x Output blocked x vector /// \param[in] pressure_idx Pressure index /// \param[in] Nb Number of blocks in the original matrix /// \param[in] stream Hip stream to use for the computations @@ -68,9 +68,9 @@ public: hipStream_t stream); - /// Function to multiply vector with another vector and a scalar, element-wise and add the result to a third vector (out = alpha * in1 + in2) - /// \param[in] alpha Input scalar - /// \param[in] in1 First input vector + /// Function to multiply vector with another vector and a scalar, element-wise and add the result to a third vector (out = alpha * in1 + in2) + /// \param[in] alpha Input scalar + /// \param[in] in1 First input vector /// \param[in] in2 Second input vector /// \param[out] out Output vector /// \param[in] N Size of the vector @@ -81,10 +81,10 @@ public: Scalar* out, int N, hipStream_t stream); - + /// Function to prolongate vector during amg cycle, every workitem handles one row /// \param[in] in Input fine-grained vector - /// \param[out] out Output course-graned vector + /// \param[out] out Output course-graned vector /// \param[in] cols Column indexes /// \param[in] N Size of the vector /// \param[in] stream Hip stream to use for the computations diff --git a/opm/simulators/linalg/gpubridge/rocm/rocalutionSolverBackend.hpp b/opm/simulators/linalg/gpubridge/rocm/rocalutionSolverBackend.hpp index c0a69addf6..d2bf39f11b 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocalutionSolverBackend.hpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocalutionSolverBackend.hpp @@ -100,11 +100,9 @@ public: /// Get result after linear solve, and peform postprocessing if necessary /// \param[inout] x resulting x vector, caller must guarantee that x points to a valid array void get_result(Scalar* x) override; - + }; // end class rocalutionSolverBackend } // namespace Opm::Accelerator #endif - - diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.cpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.cpp index ef51ef0e5e..0ae206a079 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.cpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -33,7 +33,7 @@ #include extern std::shared_ptr copyThread; - + #if HAVE_OPENMP #include #endif //HAVE_OPENMP @@ -45,7 +45,7 @@ using Dune::Timer; template rocsparseBILU0:: -rocsparseBILU0(int verbosity_) : +rocsparseBILU0(int verbosity_) : Base(verbosity_) { } @@ -75,8 +75,8 @@ bool rocsparseBILU0:: initialize(std::shared_ptr> matrix, std::shared_ptr> jacMatrix, rocsparse_int *d_Arows, - rocsparse_int *d_Acols) -{ + rocsparse_int *d_Acols) +{ this->Nb = matrix->Nb; this->N = Nb * block_size; this->nnzb = matrix->nnzbs; @@ -217,7 +217,7 @@ analyze_matrix() template bool rocsparseBILU0:: -analyze_matrix(BlockedMatrix *mat) +analyze_matrix(BlockedMatrix *mat) { return analyze_matrix(mat, &(*this->jacMat)); } @@ -325,7 +325,7 @@ analyze_matrix(BlockedMatrix*, template bool rocsparseBILU0:: -create_preconditioner(BlockedMatrix *mat) +create_preconditioner(BlockedMatrix *mat) { return create_preconditioner(mat, &*this->jacMat); } @@ -354,7 +354,7 @@ create_preconditioner(BlockedMatrix*, // Check for zero pivot int zero_position = 0; rocsparse_status status = rocsparse_bsrilu0_zero_pivot(this->handle, ilu_info, &zero_position); - + if (rocsparse_status_success != status) { printf("L has structural and/or numerical zero at L(%d,%d)\n", zero_position, zero_position); @@ -366,7 +366,7 @@ create_preconditioner(BlockedMatrix*, template void rocsparseBILU0:: -copy_system_to_gpu(Scalar *d_Avals) +copy_system_to_gpu(Scalar *d_Avals) { bool use_multithreading = true; @@ -374,7 +374,7 @@ copy_system_to_gpu(Scalar *d_Avals) if (omp_get_max_threads() == 1) use_multithreading = false; #endif - + if (this->useJacMatrix){ if (use_multithreading && copyThread) { copyThread->join(); @@ -425,11 +425,11 @@ update_system_on_gpu(Scalar*, Scalar *d_Avals) template void rocsparseBILU0:: -apply(const Scalar& y, Scalar& x, [[maybe_unused]] WellContributions& wellContribs) +apply(const Scalar& y, Scalar& x, [[maybe_unused]] WellContributions& wellContribs) { Scalar one = 1.0; - HIP_CHECK(hipMemsetAsync(d_t, 0, N * sizeof(Scalar), this->stream)); + HIP_CHECK(hipMemsetAsync(d_t, 0, N * sizeof(Scalar), this->stream)); if constexpr (std::is_same_v) { ROCSPARSE_CHECK(rocsparse_sbsrsv_solve(this->handle, this->dir, diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.hpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.hpp index 8c5c1595ca..b47a7805b1 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.hpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseBILU0.hpp @@ -47,14 +47,14 @@ class rocsparseBILU0 : public rocsparsePreconditioner using Base::verbosity; private: - + rocsparse_mat_descr descr_M, descr_L, descr_U; rocsparse_mat_info ilu_info; #if HIP_VERSION >= 50400000 rocsparse_mat_info spmv_info; #endif - rocsparse_int *d_Mrows, *d_Mcols; + rocsparse_int *d_Mrows, *d_Mcols; Scalar *d_Mvals, *d_t; void *d_buffer; // buffer space, used by rocsparse ilu0 analysis @@ -81,7 +81,7 @@ public: /// Analysis, extract parallelism if specified /// \param[in] mat matrix A bool analyze_matrix(BlockedMatrix *mat) override; - + /// Analysis, extract parallelism if specified /// \param[in] mat matrix A /// \param[in] jacMat matrix for preconditioner, analyze this as well @@ -91,7 +91,7 @@ public: /// ILU decomposition /// \param[in] mat matrix A to decompose bool create_preconditioner(BlockedMatrix *mat) override; - + /// ILU decomposition /// \param[in] mat matrix A /// \param[in] jacMat matrix for preconditioner, decompose this one if used @@ -118,7 +118,7 @@ public: /// \param[in] mCols Array of matrix column indices /// \param[in] reuse True to reuse old matrix void copy_values_to_gpu(Scalar *mVals, int *mRows, int *mCols, bool reuse); - + /// Update GPU values after a new assembly is done /// \param[in] b New b vector void update_system_on_gpu(Scalar*, Scalar* b) override; @@ -127,4 +127,3 @@ public: } // namespace Opm #endif - diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.cpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.cpp index f30acee29a..1582c8ba0b 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.cpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.cpp @@ -81,7 +81,7 @@ copy_system_to_gpu(Scalar *b) template void rocsparseCPR:: -update_system_on_gpu(Scalar* h_vals, Scalar *vals) +update_system_on_gpu(Scalar* h_vals, Scalar *vals) { bilu0->update_system_on_gpu(h_vals, vals); this->mat->nnzValues = h_vals; @@ -89,17 +89,17 @@ update_system_on_gpu(Scalar* h_vals, Scalar *vals) template bool rocsparseCPR:: -analyze_matrix(BlockedMatrix *mat_) +analyze_matrix(BlockedMatrix *mat_) { this->Nb = mat_->Nb; this->nnzb = mat_->nnzbs; this->N = Nb * block_size; this->nnz = nnzb * block_size * block_size; - + bool success = bilu0->analyze_matrix(mat_); - - this->mat = mat_; - + + this->mat = mat_; + return success; } @@ -132,25 +132,25 @@ bool rocsparseCPR:: create_preconditioner(BlockedMatrix *mat_) { bool result = bilu0->create_preconditioner(mat_); bool amgcreated = this->create_preconditioner_amg(this->mat); - + if(amgcreated) { smootherilu0s.clear(); } - + for (int i=0; inum_levels-1; i++) { - std::shared_ptr> smoother; - + std::shared_ptr> smoother; + //convert Matrix to BlockMatrix - auto levelMat = std::make_shared>(this->Amatrices[i].N, this->Amatrices[i].nnzs, 1, &(this->Amatrices[i].nnzValues[0]), &(this->Amatrices[i].colIndices[0]), &(this->Amatrices[i].rowPointers[0])); + auto levelMat = std::make_shared>(this->Amatrices[i].N, this->Amatrices[i].nnzs, 1, &(this->Amatrices[i].nnzValues[0]), &(this->Amatrices[i].colIndices[0]), &(this->Amatrices[i].rowPointers[0])); if(amgcreated) { smoother = std::make_shared>(verbosity); smootherilu0s.push_back(smoother); smoother->set_context(this->handle, this->blas_handle, this->dir, this->operation, this->stream); - - smoother->initialize(levelMat,levelMat,0,0); + + smoother->initialize(levelMat,levelMat,0,0); smoother->copy_values_to_gpu(&(this->Amatrices[i].nnzValues[0]), &(this->Amatrices[i].rowPointers[0]), &(this->Amatrices[i].colIndices[0]), false); smoother->analyze_matrix(levelMat.get()); } @@ -182,7 +182,7 @@ create_preconditioner(BlockedMatrix *mat_) { template void rocsparseCPR:: -init_rocm_buffers_fineMatrix() +init_rocm_buffers_fineMatrix() { d_mat = std::make_unique>(h_mat.get()->Nb, h_mat.get()->Nb, h_mat.get()->nnzbs, block_size); d_weights.emplace_back(this->N); @@ -190,7 +190,7 @@ init_rocm_buffers_fineMatrix() template void rocsparseCPR:: -init_rocm_buffers() +init_rocm_buffers() { d_Amatrices.reserve(this->num_levels); d_Rmatrices.reserve(this->num_levels - 1); @@ -200,11 +200,11 @@ init_rocm_buffers() d_PcolIndices.reserve(this->num_levels - 1); d_invDiags.reserve(this->num_levels - 1); d_t.reserve(this->num_levels - 1); - + for (Matrix& m : this->Amatrices) { d_Amatrices.emplace_back(m.N, m.M, m.nnzs, 1); } - + for (Matrix& m : this->Rmatrices) { d_Rmatrices.emplace_back(m.N, m.M, m.nnzs, 1); d_f.emplace_back(m.N); @@ -213,13 +213,13 @@ init_rocm_buffers() d_invDiags.emplace_back(m.M); d_t.emplace_back(m.M); } - + HIP_CHECK(hipMalloc((void**)&d_tmp, sizeof(Scalar) * this->N)); HIP_CHECK(hipMalloc((void**)&d_yamg, sizeof(Scalar) * this->N)); HIP_CHECK(hipMalloc((void**)&d_ywell, sizeof(Scalar) * this->N)); d_rs.emplace_back(this->N); - + d_coarse_y.emplace_back(this->Nb); d_coarse_x.emplace_back(this->Nb); d_yinput.emplace_back(this->Nb); @@ -227,7 +227,7 @@ init_rocm_buffers() template void rocsparseCPR:: -clear_rocm_buffers() +clear_rocm_buffers() { d_Amatrices.clear(); d_Rmatrices.clear(); @@ -236,13 +236,13 @@ clear_rocm_buffers() d_u.clear(); d_PcolIndices.clear(); d_t.clear(); - + HIP_CHECK(hipFree(d_tmp)); HIP_CHECK(hipFree(d_yamg)); HIP_CHECK(hipFree(d_ywell)); d_rs.clear(); - + d_coarse_y.clear(); d_coarse_x.clear(); d_yinput.clear(); @@ -250,14 +250,14 @@ clear_rocm_buffers() template void rocsparseCPR:: -rocm_upload() +rocm_upload() { d_mat->upload(h_mat.get(), this->stream); for (unsigned int i = 0; i < this->Rmatrices.size(); ++i) { d_Amatrices[i].upload(&this->Amatrices[i], this->stream); d_Rmatrices[i].upload(&this->Rmatrices[i], this->stream); - + HIP_CHECK(hipMemcpyAsync(d_invDiags[i].nnzValues, this->invDiags[i].data(), sizeof(Scalar) * this->Amatrices[i].N, hipMemcpyHostToDevice, this->stream)); HIP_CHECK(hipMemcpyAsync(d_PcolIndices[i].nnzValues, this->PcolIndices[i].data(), sizeof(int) * this->Amatrices[i].N, hipMemcpyHostToDevice, this->stream)); } @@ -274,11 +274,11 @@ amg_cycle_gpu(const int level, Scalar zero = 0.0; RocmMatrix *A = &d_Amatrices[level]; RocmMatrix *R = &d_Rmatrices[level]; - - std::shared_ptr> S; - + + std::shared_ptr> S; + int Ncur = A->Nb; - + rocsparse_mat_descr descr_R; ROCSPARSE_CHECK(rocsparse_create_mat_descr(&descr_R)); @@ -287,7 +287,7 @@ amg_cycle_gpu(const int level, std::vector h_y(Ncur), h_x(Ncur, 0); HIP_CHECK(hipMemcpyAsync(h_y.data(), &y, sizeof(Scalar) * Ncur, hipMemcpyDeviceToHost, this->stream)); - + // The if constexpr is needed to make the code compile // since the umfpack member is an 'int' with float Scalar. // We will never get here with float Scalar as we throw earlier. @@ -297,7 +297,7 @@ amg_cycle_gpu(const int level, } HIP_CHECK(hipMemcpyAsync(&x, h_x.data(), sizeof(Scalar) * Ncur, hipMemcpyHostToDevice, this->stream)); - + return; } else @@ -310,7 +310,7 @@ amg_cycle_gpu(const int level, // presmooth for (unsigned i = 0; i < this->num_pre_smooth_steps; ++i){ S->apply(y, x, wellContribs); - + if constexpr (std::is_same_v) { ROCBLAS_CHECK(rocblas_saxpy(this->blas_handle, Ncur, &one, &x, 1, t.nnzValues, 1)); //t is output, x input } else { @@ -343,7 +343,7 @@ amg_cycle_gpu(const int level, ROCSPARSE_CHECK(rocsparse_destroy_mat_info(spmv_info)); amg_cycle_gpu(level + 1, *f.nnzValues, *u.nnzValues, wellContribs);//f is input = y, u is output = x! - + HIP_CHECK(hipMemsetAsync(&x, 0, sizeof(Scalar) * Ncur, this->stream)); if(level < this->num_levels - 2) { @@ -352,14 +352,14 @@ amg_cycle_gpu(const int level, else { HipKernels::prolongate_vector(u.nnzValues, &x, d_PcolIndices[level].nnzValues, Ncur, this->stream); } - - // accumulate update + + // accumulate update if constexpr (std::is_same_v) { ROCBLAS_CHECK(rocblas_saxpy(this->blas_handle, Ncur, &one, &x, 1, t.nnzValues, 1)); } else { ROCBLAS_CHECK(rocblas_daxpy(this->blas_handle, Ncur, &one, &x, 1, t.nnzValues, 1)); } - + // postsmooth for (unsigned i = 0; i < this->num_post_smooth_steps; ++i){ // update defect @@ -368,39 +368,39 @@ amg_cycle_gpu(const int level, //smoother applier S->apply(y, x, wellContribs); - // accumulate update + // accumulate update if constexpr (std::is_same_v) { ROCBLAS_CHECK(rocblas_saxpy(this->blas_handle, Ncur, &one, &x, 1, t.nnzValues, 1)); } else { ROCBLAS_CHECK(rocblas_daxpy(this->blas_handle, Ncur, &one, &x, 1, t.nnzValues, 1)); - } + } } } // x = prec(y) template void rocsparseCPR:: -apply_amg(const Scalar& y, +apply_amg(const Scalar& y, Scalar& x, [[maybe_unused]] WellContributions& wellContribs) { HIP_CHECK(hipMemsetAsync(d_coarse_x.data()->nnzValues, 0, sizeof(Scalar) * this->Nb, this->stream)); - - for (unsigned int i = 0; i < d_t.size(); ++i) { + + for (unsigned int i = 0; i < d_t.size(); ++i) { HIP_CHECK(hipMemsetAsync(d_t[i].nnzValues, 0, sizeof(Scalar) * d_t[i].size, this->stream)); } - + HipKernels::full_to_pressure_restriction(&y, d_weights.data()->nnzValues, d_coarse_y.data()->nnzValues, Nb, this->stream); - + //NOTE: input b=y is is overwritten, so duplicate into d_yinput HIP_CHECK(hipMemcpyAsync(d_yinput.data()->nnzValues, d_coarse_y.data()->nnzValues, sizeof(Scalar) * d_coarse_y.data()->size, hipMemcpyDeviceToDevice, this->stream)); - + amg_cycle_gpu(0, *(d_coarse_y.data()->nnzValues), *(d_coarse_x.data()->nnzValues), wellContribs); - + RocmMatrix *A = &d_Amatrices[0]; - + // update defect - HipKernels::residual(A->nnzValues, A->colIndices, A->rowPointers, d_t[0].nnzValues, d_yinput.data()->nnzValues, d_yinput.data()->nnzValues, d_yinput.data()->size, 1, this->stream); // params: x@in, y@in, y@out = (A.., x, rhs, out, Nb, block_size, stream) + HipKernels::residual(A->nnzValues, A->colIndices, A->rowPointers, d_t[0].nnzValues, d_yinput.data()->nnzValues, d_yinput.data()->nnzValues, d_yinput.data()->size, 1, this->stream); // params: x@in, y@in, y@out = (A.., x, rhs, out, Nb, block_size, stream) //NOTE: this initialization is required to get mathcing result with spmv in applyscaleadd of the well operator HIP_CHECK(hipMemsetAsync(&x, 0, sizeof(Scalar) *N, this->stream)); @@ -418,19 +418,19 @@ apply(const Scalar& y, Scalar one = 1.0; Scalar mone = -1.0; rocsparse_mat_descr descr_mat; - + HIP_CHECK(hipMemsetAsync(&x, 0, sizeof(Scalar) *N, this->stream)); HIP_CHECK(hipMemcpyAsync(d_yamg, &y, sizeof(Scalar) * this->N, hipMemcpyDeviceToDevice, this->stream)); HIP_CHECK(hipStreamSynchronize(this->stream)); - - apply_amg(*d_yamg, x, wellContribs); - + + apply_amg(*d_yamg, x, wellContribs); + ROCSPARSE_CHECK(rocsparse_create_mat_descr(&descr_mat)); - + #if HIP_VERSION >= 50400000 ROCSPARSE_CHECK(rocsparse_create_mat_info(&spmv_info)); #endif - + #if HIP_VERSION >= 60000000 if constexpr (std::is_same_v) { ROCSPARSE_CHECK(rocsparse_sbsrmv_analysis(this->handle, this->dir, this->operation, Nb, Nb, N, descr_mat, d_mat->nnzValues, d_mat->rowPointers, d_mat->colIndices, block_size, spmv_info)); @@ -444,7 +444,7 @@ apply(const Scalar& y, ROCSPARSE_CHECK(rocsparse_dbsrmv_ex_analysis(this->handle, this->dir, this->operation, Nb, Nb, N, descr_mat, d_mat->nnzValues, d_mat->rowPointers, d_mat->colIndices, block_size, spmv_info)); } #endif - + //NOTE: below is the correct y -= AX but it is curretly not working so I am debugging spmv = Ax above alone! #if HIP_VERSION >= 60000000 if constexpr (std::is_same_v) { @@ -481,11 +481,11 @@ apply(const Scalar& y, #if HIP_VERSION >= 50400000 ROCSPARSE_CHECK(rocsparse_destroy_mat_info(spmv_info)); #endif - + ROCSPARSE_CHECK(rocsparse_destroy_mat_descr(descr_mat)); - + HIP_CHECK(hipMemsetAsync(d_ywell, 0, sizeof(Scalar) *N, this->stream)); - // NOTE: we need to also apply the wells to the defect!!! + // NOTE: we need to also apply the wells to the defect!!! // apply wellContributions if (wellContribs.getNumWells() > 0) { static_cast&>(wellContribs).apply(&x, d_ywell); @@ -499,16 +499,16 @@ apply(const Scalar& y, } HIP_CHECK(hipMemsetAsync(d_tmp, 0, N * sizeof(Scalar), this->stream)); - + bilu0->apply(*d_yamg, *d_tmp, wellContribs); - + HIP_CHECK(hipStreamSynchronize(this->stream)); // Accumulate update: *levelContext.update += *levelContext.lhs; if constexpr (std::is_same_v) { - ROCBLAS_CHECK(rocblas_saxpy(this->blas_handle, N, &one, d_tmp, 1, &x, 1)); + ROCBLAS_CHECK(rocblas_saxpy(this->blas_handle, N, &one, d_tmp, 1, &x, 1)); } else { - ROCBLAS_CHECK(rocblas_daxpy(this->blas_handle, N, &one, d_tmp, 1, &x, 1)); + ROCBLAS_CHECK(rocblas_daxpy(this->blas_handle, N, &one, d_tmp, 1, &x, 1)); } } diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.hpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.hpp index 635eec541c..4e1220958b 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.hpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.hpp @@ -49,7 +49,7 @@ class rocsparseCPR : public rocsparsePreconditioner, public private: std::vector> d_Amatrices, d_Rmatrices; // scalar matrices that represent the AMG hierarchy - + std::vector> d_PcolIndices; // prolongation does not need a full matrix, only store colIndices std::vector> d_invDiags; // inverse of diagonal of Amatrices std::vector> d_t, d_f; // intermediate vectors used during amg cycle @@ -93,7 +93,7 @@ private: Scalar &y, Scalar &x, WellContributions& wellContribs); - + public: rocsparseCPR(int verbosity); @@ -107,12 +107,12 @@ public: std::shared_ptr> jacMatrix, rocsparse_int *d_Arows, rocsparse_int *d_Acols) override; - + /// Analysis, extract parallelism if specified /// \param[in] mat matrix A bool analyze_matrix(BlockedMatrix *mat) override; - + /// Analysis, extract parallelism if specified /// \param[in] mat matrix A /// \param[in] jacMat matrix for preconditioner, analyze this as well @@ -122,13 +122,13 @@ public: /// Create AMG preconditioner and perform ILU decomposition /// \param[in] mat matrix A bool create_preconditioner(BlockedMatrix *mat) override; - + /// Create AMG preconditioner and perform ILU decomposition /// \param[in] mat matrix A /// \param[in] jacMat matrix for preconditioner, decompose this one if used bool create_preconditioner(BlockedMatrix *mat, BlockedMatrix *jacMat) override; - + /// Apply preconditioner, x = prec(y) /// applies blocked ilu0 /// also applies amg for pressure component @@ -138,7 +138,7 @@ public: void apply(const Scalar& y, Scalar& x, WellContributions& wellContribs) override; - + /// Copy matrix A values to GPU /// \param[in] b Input values void copy_system_to_gpu(Scalar *b) override; @@ -147,10 +147,9 @@ public: /// \param[in] vals Matrix values /// \param[in] b input vector, contains N values void update_system_on_gpu(Scalar* vals, Scalar* b) override; - + }; } // namespace Opm #endif - diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.cpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.cpp index 212af3f8fd..24fcf623e1 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.cpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.cpp @@ -34,7 +34,7 @@ namespace Opm::Accelerator { template RocmMatrix:: -RocmMatrix(int Nb_, +RocmMatrix(int Nb_, int Mb_, int nnzbs_, unsigned int block_size_) @@ -44,7 +44,7 @@ RocmMatrix(int Nb_, block_size(block_size_) { HIP_CHECK(hipMalloc((void**)&nnzValues, sizeof(Scalar) * block_size * block_size * nnzbs)); - + HIP_CHECK(hipMalloc((void**)&colIndices, sizeof(int) * nnzbs)); HIP_CHECK(hipMalloc((void**)&rowPointers, sizeof(int) * (Nb + 1))); @@ -109,9 +109,9 @@ RocmVector::~RocmVector() { template void RocmVector:: upload(Scalar *vals, - hipStream_t stream) + hipStream_t stream) { - HIP_CHECK(hipMemcpyAsync(nnzValues, vals, sizeof(Scalar) * size, hipMemcpyHostToDevice, stream)); + HIP_CHECK(hipMemcpyAsync(nnzValues, vals, sizeof(Scalar) * size, hipMemcpyHostToDevice, stream)); } #define INSTANTIATE_TYPE(T) \ diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.hpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.hpp index 46c867ad9e..527b828b1c 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.hpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseMatrix.hpp @@ -39,10 +39,10 @@ public: int *cols, int *rows, hipStream_t stream); - + void upload(Matrix *matrix, hipStream_t stream); - + void upload(BlockedMatrix *matrix, hipStream_t stream); @@ -63,7 +63,7 @@ public: void upload(Scalar *vals, hipStream_t stream); - + void upload(Matrix *matrix, hipStream_t stream); diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.cpp b/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.cpp index 3c095ff6ed..3e7e306ac7 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.cpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.cpp @@ -92,4 +92,3 @@ INSTANTIATE_TYPE(float) #endif } //namespace Opm - diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.hpp b/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.hpp index 577bb1ca6a..96673ccad1 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.hpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparsePreconditioner.hpp @@ -39,45 +39,45 @@ protected: rocsparse_direction dir = rocsparse_direction_row; rocsparse_operation operation = rocsparse_operation_none; rocsparse_mat_descr descr_L, descr_U; - + hipStream_t stream; - + rocsparsePreconditioner(int verbosity_) : Preconditioner(verbosity_) {}; - + public: int nnzbs_prec = 0; // number of nnz blocks in preconditioner matrix M bool useJacMatrix = false; std::shared_ptr> jacMat{}; // matrix for preconditioner - + virtual ~rocsparsePreconditioner() = default; - static std::unique_ptr> create(PreconditionerType type, + static std::unique_ptr> create(PreconditionerType type, int verbosity); virtual bool initialize(std::shared_ptr> matrix, std::shared_ptr> jacMatrix, rocsparse_int* d_Arows, rocsparse_int* d_Acols) = 0; - + virtual void copy_system_to_gpu(Scalar* b) = 0; /// Update linear system to GPU /// \param[in] vals Matrix values /// \param[in] b input vector, contains N values virtual void update_system_on_gpu(Scalar* vals, Scalar* b)=0; - + void set_matrix_analysis(rocsparse_mat_descr descr_L, rocsparse_mat_descr descr_U); - + void set_context(rocsparse_handle handle, rocblas_handle blas_handle, rocsparse_direction dir, rocsparse_operation operation, hipStream_t stream); - + void setJacMat(const BlockedMatrix& jacMat); }; } //namespace Opm diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.cpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.cpp index d0a7cb7eae..37f1d39a62 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.cpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.cpp @@ -65,11 +65,11 @@ rocsparseSolverBackend(int verbosity_, int maxit_, Scalar tolerance_, { int numDevices = 0; bool use_cpr; - + if (linsolver.compare("ilu0") == 0) { use_cpr = false; } else if (linsolver.compare("cpr_quasiimpes") == 0) { - use_cpr = true; + use_cpr = true; } else if (linsolver.compare("isai") == 0) { OPM_THROW(std::logic_error, "Error rocsparseSolver does not support --linear-solver=isai"); } else if (linsolver.compare("cpr_trueimpes") == 0) { @@ -77,7 +77,7 @@ rocsparseSolverBackend(int verbosity_, int maxit_, Scalar tolerance_, } else { OPM_THROW(std::logic_error, "Error unknown value for argument --linear-solver, " + linsolver); } - + HIP_CHECK(hipGetDeviceCount(&numDevices)); if (static_cast(deviceID) >= numDevices) { OPM_THROW(std::runtime_error, "Invalid HIP device ID"); @@ -98,14 +98,14 @@ rocsparseSolverBackend(int verbosity_, int maxit_, Scalar tolerance_, HIP_CHECK(hipStreamCreate(&stream)); ROCSPARSE_CHECK(rocsparse_set_stream(handle, stream)); ROCBLAS_CHECK(rocblas_set_stream(blas_handle, stream)); - + using PCType = typename Opm::Accelerator::PreconditionerType; if (use_cpr) { prec = rocsparsePreconditioner::create(PCType::CPR, verbosity); } else { prec = rocsparsePreconditioner::create(PCType::BILU0, verbosity); } - + prec->set_context(handle, blas_handle, dir, operation, stream); } @@ -459,8 +459,8 @@ gpu_pbicgstab([[maybe_unused]] WellContributions& wellContribs, if (verbosity == 2) { std::ostringstream out; - out << "=== converged: " << res.converged << ", conv_rate: " - << res.conv_rate << ", time: " << res.elapsed + out << "=== converged: " << res.converged << ", conv_rate: " + << res.conv_rate << ", time: " << res.elapsed << ", time per iteration: " << res.elapsed / it << ", iterations: " << it; OpmLog::info(out.str()); } @@ -485,7 +485,7 @@ initialize(std::shared_ptr> matrix, prec->jacMat = matrix; prec->nnzbs_prec = this->nnzb; } - + std::ostringstream out; out << "Initializing GPU, matrix size: " @@ -527,9 +527,9 @@ void rocsparseSolverBackend:: copy_system_to_gpu(Scalar *b) { HIP_CHECK(hipMemcpyAsync(d_Arows, mat->rowPointers, - sizeof(rocsparse_int) * (Nb + 1), + sizeof(rocsparse_int) * (Nb + 1), hipMemcpyHostToDevice, stream)); - HIP_CHECK(hipMemcpyAsync(d_Acols, mat->colIndices, + HIP_CHECK(hipMemcpyAsync(d_Acols, mat->colIndices, sizeof(rocsparse_int) * nnzb, hipMemcpyHostToDevice, stream)); HIP_CHECK(hipMemcpyAsync(d_Avals, mat->nnzValues, @@ -538,8 +538,8 @@ copy_system_to_gpu(Scalar *b) HIP_CHECK(hipMemsetAsync(d_x, 0, N * sizeof(Scalar), stream)); HIP_CHECK(hipMemcpyAsync(d_b, b, N * sizeof(Scalar), hipMemcpyHostToDevice, stream)); - - prec->copy_system_to_gpu(d_Avals); + + prec->copy_system_to_gpu(d_Avals); } // end copy_system_to_gpu() // don't copy rowpointers and colindices, they stay the same @@ -554,7 +554,7 @@ update_system_on_gpu(Scalar* vals, Scalar* b) HIP_CHECK(hipMemsetAsync(d_x, 0, N * sizeof(Scalar), stream)); HIP_CHECK(hipMemcpyAsync(d_b, b, N* sizeof(Scalar), hipMemcpyHostToDevice, stream)); - + prec->update_system_on_gpu(vals, d_Avals); } // end update_system_on_gpu() @@ -569,7 +569,7 @@ analyze_matrix() #endif ROCSPARSE_CHECK(rocsparse_create_mat_descr(&descr_A)); - + #if HIP_VERSION >= 60000000 if constexpr (std::is_same_v) { ROCSPARSE_CHECK(rocsparse_sbsrmv_analysis(handle, dir, operation, @@ -604,7 +604,7 @@ analyze_matrix() OpmLog::info(out.str()); return false; } - + analysis_done = true; return true; @@ -617,9 +617,9 @@ create_preconditioner() bool result; if (prec->useJacMatrix) result = prec->create_preconditioner(mat.get(), jacMat.get()); - else + else result = prec->create_preconditioner(mat.get()); - + return result; } // end create_preconditioner() @@ -668,7 +668,7 @@ solve_system(std::shared_ptr> matrix, } } solve_system(wellContribs, res); - + return SolverStatus::GPU_SOLVER_SUCCESS; } diff --git a/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.hpp b/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.hpp index 6634d96b31..d4b9d5ab7c 100644 --- a/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.hpp +++ b/opm/simulators/linalg/gpubridge/rocm/rocsparseSolverBackend.hpp @@ -79,7 +79,7 @@ private: char rev[64]; std::unique_ptr > prec; // can perform blocked ILU0 and AMG on pressure component - + /// Solve linear system using ilu0-bicgstab /// \param[in] wellContribs WellContributions, to apply them separately, instead of adding them to matrix A /// \param[inout] res summary of solver result diff --git a/opm/simulators/linalg/gpuistl/GpuJac.cpp b/opm/simulators/linalg/gpuistl/GpuJac.cpp index 9433ce718b..a8d68fc270 100644 --- a/opm/simulators/linalg/gpuistl/GpuJac.cpp +++ b/opm/simulators/linalg/gpuistl/GpuJac.cpp @@ -105,7 +105,7 @@ template void GpuJac::invertDiagonalAndFlatten() { - dispatchInvertDiagonalAndFlatten<6>(); + dispatchInvertDiagonalAndFlatten<6>(); } } // namespace Opm::gpuistl @@ -113,6 +113,6 @@ GpuJac::invertDiagonalAndFlatten() template class ::Opm::gpuistl::GpuJac<::Opm::gpuistl::GpuSparseMatrixWrapper, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector> - + INSTANTIATE_CUJAC_DUNE(double); INSTANTIATE_CUJAC_DUNE(float); diff --git a/opm/simulators/linalg/gpuistl/GpuSender.hpp b/opm/simulators/linalg/gpuistl/GpuSender.hpp index 3a8dfe6181..2040db42bf 100644 --- a/opm/simulators/linalg/gpuistl/GpuSender.hpp +++ b/opm/simulators/linalg/gpuistl/GpuSender.hpp @@ -53,7 +53,7 @@ public: virtual ~GPUSender() = default; /** - * @brief copyOwnerToAll will copy the data in source to all processes. + * @brief copyOwnerToAll will copy the data in source to all processes. * * @note Depending on the implementation, this may or may not use GPU aware MPI. * If it does not use GPU aware MPI, the data will be copied to the diff --git a/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp b/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp index 057217a9df..381f2fa68b 100644 --- a/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp +++ b/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp @@ -43,7 +43,7 @@ namespace Opm::gpuistl { - + template void GpuSeqILU0::pre([[maybe_unused]] X& x, [[maybe_unused]] Y& b) @@ -325,7 +325,7 @@ GpuSeqILU0::updateILUConfiguration() template class ::Opm::gpuistl::GpuSeqILU0>, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector> - + INSTANTIATE_GPUSEQILU0_DUNE(double, 1); diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp index cdf4af5149..e82efa0522 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp @@ -60,17 +60,17 @@ class GpuSparseMatrix { public: using field_type = T; - + /** * @brief Maximum block size supported by this implementation. - * + * * This constant defines an upper bound on the block size to ensure reasonable compilation times. - * While this class itself could support larger values, functions that call dispatchOnBlocksize() + * While this class itself could support larger values, functions that call dispatchOnBlocksize() * might have limitations. This value can be increased if needed, but will increase compilation time * due to template instantiations. */ static constexpr int max_block_size = 6; - + //! Create the sparse matrix specified by the raw data. //! //! \note Prefer to use the constructor taking a const reference to a matrix instead. @@ -107,7 +107,7 @@ public: GpuSparseMatrix(const GpuSparseMatrix&); - // We want to have this as non-mutable as possible, that is we do not want + // We want to have this as non-mutable as possible, that is we do not want // to deal with changing matrix sizes and sparsity patterns. GpuSparseMatrix& operator=(const GpuSparseMatrix&) = delete; @@ -333,15 +333,15 @@ public: */ void updateNonzeroValues(const GpuSparseMatrix& matrix); - + /** * @brief Dispatches a function based on the block size of the matrix. - * + * * This method allows executing different code paths depending on the block size * of the matrix, up to the maximum block size specified by max_block_size. * * Use this function if you need the block size to be known at compile time. - * + * * @tparam FunctionType Type of the function to be dispatched * @param function The function to be executed based on the block size * @return The result of the function execution diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp index a036987d49..57395da851 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp @@ -54,9 +54,9 @@ public: /** * @brief Maximum block size supported by this implementation. - * + * * This constant defines an upper bound on the block size to ensure reasonable compilation times. - * While this class itself could support larger values, functions that call dispatchOnBlocksize() + * While this class itself could support larger values, functions that call dispatchOnBlocksize() * might have limitations. This value can be increased if needed, but will increase compilation time * due to template instantiations. */ diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp index a7da763d6f..0f5cbeb5e1 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp @@ -92,7 +92,7 @@ public: * @brief Maximum block size supported by this implementation. * * This constant defines an upper bound on the block size to ensure reasonable compilation times. - * While this class itself could support larger values, functions that call dispatchOnBlocksize() + * While this class itself could support larger values, functions that call dispatchOnBlocksize() * might have limitations. This value can be increased if needed, but will increase compilation time * due to template instantiations. */ @@ -385,15 +385,15 @@ public: m_matrix->updateNonzeroValues(matrix.get()); } - + /** * @brief Dispatches a function based on the block size of the matrix. - * + * * This method allows executing different code paths depending on the block size * of the matrix, up to the maximum block size specified by max_block_size. * * Use this function if you need the block size to be known at compile time. - * + * * @tparam FunctionType Type of the function to be dispatched * @param function The function to be executed based on the block size * @return The result of the function execution diff --git a/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp b/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp index b7e81c3a36..33c06a4888 100644 --- a/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp +++ b/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp @@ -140,7 +140,7 @@ public: /** * \copydoc AbstractISTLSolver::eraseMatrix - * + * * \note This method will not do anything. */ void eraseMatrix() override @@ -150,7 +150,7 @@ public: /** * \copydoc AbstractISTLSolver::setActiveSolver - * + * * \note This method will throw an exception if the solver number is not 0, * as only one solver is available for the GPU backend. */ @@ -163,7 +163,7 @@ public: /** * \copydoc AbstractISTLSolver::numAvailableSolvers - * + * * \note This method always returns 1, as only one solver is available for the GPU backend. */ int numAvailableSolvers() const override @@ -207,7 +207,7 @@ public: "Check for errors related to missing nodes."); } - /** + /** * \copydoc AbstractISTLSolver::setResidual * * \note Unused in this implementation. @@ -235,7 +235,7 @@ public: /** * \copydoc AbstractISTLSolver::setMatrix - * + * * \note This method does not set the matrix directly, as it should be handled in prepare(). */ void setMatrix(const SparseMatrixAdapter&) override diff --git a/opm/simulators/linalg/gpuistl/OpmGpuILU0.hpp b/opm/simulators/linalg/gpuistl/OpmGpuILU0.hpp index e5d2a4240e..b3a791f058 100644 --- a/opm/simulators/linalg/gpuistl/OpmGpuILU0.hpp +++ b/opm/simulators/linalg/gpuistl/OpmGpuILU0.hpp @@ -63,7 +63,7 @@ public: //! \brief The matrix type the preconditioner is for. using matrix_type = GpuMatrix; - + //! \brief Constructor. //! diff --git a/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.cpp b/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.cpp index bda2eb0362..4b22e48d04 100644 --- a/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.cpp +++ b/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.cpp @@ -56,7 +56,7 @@ namespace auto solverPtr = std::make_unique(*operatorPtr, prm, weightCalculator, pressureIndex); auto preconditioner = std::ref(solverPtr->preconditioner()); - return std::make_tuple(std::move(operatorPtr), std::move(solverPtr), preconditioner, + return std::make_tuple(std::move(operatorPtr), std::move(solverPtr), preconditioner, std::shared_ptr{}); } #if HAVE_MPI @@ -70,7 +70,7 @@ namespace // We need the block size at compile time to instantiate the correct types // hence we need to dispatch on the block size return matrix.dispatchOnBlocksize([&](auto blockSizeVal) -> return_type { - // Get the block size from the decltype of the blockSizeVal, + // Get the block size from the decltype of the blockSizeVal, // making it a compile time constant constexpr int block_size = decltype(blockSizeVal)::value; @@ -79,7 +79,7 @@ namespace using CudaCommunication = GpuOwnerOverlapCopy; using SchwarzOperator = Dune::OverlappingSchwarzOperator, Vector, Vector, CudaCommunication>; - + using SolverType = Dune::FlexibleSolver; // Create the communication object that will handle the GPU and MPI communication diff --git a/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.hpp b/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.hpp index 4b010850c5..f41b1f5465 100644 --- a/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.hpp +++ b/opm/simulators/linalg/gpuistl/detail/FlexibleSolverWrapper.hpp @@ -33,10 +33,10 @@ namespace Opm::gpuistl::detail /** * @brief FlexibleSolverWrapper is compilational trick to reduce compile time overhead - * + * * Essentially this class acts as a direct interface towards the FlexibleSolver class, but * we want to have a clear wall between the ISTLSolverGPUISTL and the FlexibleSolver to avoid - * compilational overhead (the former is based on TypeTag the latter on operators). + * compilational overhead (the former is based on TypeTag the latter on operators). * * This wrapper handles the mapping from matrices to concrete operator types. */ diff --git a/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp b/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp index 36b0cef93c..e0749841f0 100644 --- a/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp +++ b/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp @@ -39,7 +39,7 @@ namespace Opm::gpuistl::detail { /** * This function creates a CPU matrix from the operator holding a GPU matrix. * - * This is a workaround for now since some of the GPU preconditioners need a + * This is a workaround for now since some of the GPU preconditioners need a * CPU matrix for the initial setup (graph coloring). The CPU matrix is only * used in the constructor, **not** in the update function or the apply function. */ diff --git a/opm/simulators/linalg/ilufirstelement.hh b/opm/simulators/linalg/ilufirstelement.hh index d921f3e086..2a7ce43715 100644 --- a/opm/simulators/linalg/ilufirstelement.hh +++ b/opm/simulators/linalg/ilufirstelement.hh @@ -33,5 +33,3 @@ K& firstMatrixElement(MatrixBlock& A) { return A[0][0]; } } #endif // EWOMS_ILU_FIRSTELEMENT_HH - - diff --git a/opm/simulators/linalg/is_gpu_operator.hpp b/opm/simulators/linalg/is_gpu_operator.hpp index 0cfa370f83..977ce770ee 100644 --- a/opm/simulators/linalg/is_gpu_operator.hpp +++ b/opm/simulators/linalg/is_gpu_operator.hpp @@ -19,7 +19,7 @@ #include -#if HAVE_CUDA // Avoid including GpuVector.hpp if CUDA +#if HAVE_CUDA // Avoid including GpuVector.hpp if CUDA // is not enabled to avoid linking errors. #include #endif @@ -73,7 +73,7 @@ static constexpr bool is_gpu_operator_v = is_gpu_operator::value; static constexpr bool value = false; #endif }; - + template static constexpr bool is_gpu_matrix_v = is_gpu_matrix::value; diff --git a/opm/simulators/linalg/istlsparsematrixadapter.hh b/opm/simulators/linalg/istlsparsematrixadapter.hh index 360a14b6d4..ac59e12188 100644 --- a/opm/simulators/linalg/istlsparsematrixadapter.hh +++ b/opm/simulators/linalg/istlsparsematrixadapter.hh @@ -158,7 +158,7 @@ public: MatrixBlockType* blockAddress(const size_t rowIdx, const size_t colIdx) const { return &(*istlMatrix_)[rowIdx][colIdx]; } - + /*! * \brief Set matrix block to given block. */ diff --git a/opm/simulators/linalg/twolevelmethodcpr.hh b/opm/simulators/linalg/twolevelmethodcpr.hh index e0e9853897..972e68c272 100644 --- a/opm/simulators/linalg/twolevelmethodcpr.hh +++ b/opm/simulators/linalg/twolevelmethodcpr.hh @@ -328,7 +328,7 @@ private: { return amg_.category(); } - + ~AMGInverseOperator() { if(!first_) @@ -420,7 +420,7 @@ public: * @brief The type of the fine level smoother. */ typedef S SmootherType; - + /** * @brief Constructs a two level method. * diff --git a/opm/simulators/timestepping/SimulatorReport.cpp b/opm/simulators/timestepping/SimulatorReport.cpp index c2b7ef34ec..64ce8667b5 100644 --- a/opm/simulators/timestepping/SimulatorReport.cpp +++ b/opm/simulators/timestepping/SimulatorReport.cpp @@ -102,8 +102,8 @@ namespace Opm unconverged_domains += sr.unconverged_domains; accepted_unconverged_domains += sr.accepted_unconverged_domains; skipped_domains += sr.skipped_domains; - // It makes no sense adding time points. Therefore, do not - // overwrite the value of global_time which gets set in + // It makes no sense adding time points. Therefore, do not + // overwrite the value of global_time which gets set in // NonlinearSolver.hpp by the line: // report.global_time = timer.simulationTimeElapsed(); } diff --git a/opm/simulators/timestepping/TimeStepControl.hpp b/opm/simulators/timestepping/TimeStepControl.hpp index d032e62de7..883b8a2635 100644 --- a/opm/simulators/timestepping/TimeStepControl.hpp +++ b/opm/simulators/timestepping/TimeStepControl.hpp @@ -56,7 +56,7 @@ namespace Opm { public: static constexpr TimeStepControlType Type = TimeStepControlType::SimpleIterationCount; - + SimpleIterationCountTimeStepControl() = default; /// \brief constructor @@ -76,7 +76,7 @@ namespace Opm const int iterations, const RelativeChangeInterface& /* relativeChange */, const AdaptiveSimulatorTimer& /* substepTimer */ ) const override; - + bool timeStepAccepted(const double /* error */, const double /* timeStepJustCompleted */) const override { return true; } @@ -230,7 +230,7 @@ namespace Opm static constexpr TimeStepControlType Type = TimeStepControlType::General3rdOrder; General3rdOrderController() = default; - + /// \brief constructor /// \param tolerance tolerance for the relative changes of the numerical solution to be /// accepted in one time step @@ -307,7 +307,7 @@ namespace Opm { public: static constexpr TimeStepControlType Type = TimeStepControlType::HardCodedTimeStep; - + HardcodedTimeStepControl() = default; /// \brief constructor @@ -343,4 +343,3 @@ namespace Opm } // end namespace Opm #endif - diff --git a/opm/simulators/utils/ComponentName.hpp b/opm/simulators/utils/ComponentName.hpp index 35210f6721..325c6bd5a0 100644 --- a/opm/simulators/utils/ComponentName.hpp +++ b/opm/simulators/utils/ComponentName.hpp @@ -47,4 +47,3 @@ private: } // namespace Opm #endif - diff --git a/opm/simulators/utils/DamarisKeywords.cpp b/opm/simulators/utils/DamarisKeywords.cpp index 6c17fa0ae6..2126e69fe0 100644 --- a/opm/simulators/utils/DamarisKeywords.cpp +++ b/opm/simulators/utils/DamarisKeywords.cpp @@ -1,7 +1,7 @@ /* Copyright 2021 Equinor. Copyright 2023 Inria. - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify @@ -42,7 +42,7 @@ The entries in the map below will be filled by the corresponding Damaris Keywords. - + The command line arguments are defined in opm/simulators/flow/DamarisWriter.hpp and defaults are set in opm/simulators/flow/FlowProblemProperties.hpp */ @@ -53,11 +53,11 @@ bool FileExists(const std::string& filename_in, const Parallel::Communication& comm) { // From c++17 : std::filesystem::exists(filename_in); - + int retint = 1; std::ifstream filestr; bool file_exists = false; - + if ((filename_in.length() == 0) || (filename_in == "#") ) { return file_exists; } @@ -92,7 +92,7 @@ void DamarisSettings::SetRandString(void) std::default_random_engine e1(r()); std::uniform_int_distribution uniform_dist(0, std::numeric_limits::max()); int rand_int = uniform_dist(e1); - + rand_value_str_ = std::to_string(rand_int) ; } @@ -129,7 +129,7 @@ DamarisSettings::getKeywords([[maybe_unused]] const Parallel::Communication& com } } - // Test if input Paraview Python file exists + // Test if input Paraview Python file exists if (paraviewPythonFilename_ != ""){ if (FileExists(paraviewPythonFilename_, comm)) { disableParaviewXMLstart.clear(); @@ -141,7 +141,7 @@ DamarisSettings::getKeywords([[maybe_unused]] const Parallel::Communication& com } } - // Flag error if both scripts are enabled + // Flag error if both scripts are enabled if ((pythonFilename_.size() > 0) && (paraviewPythonFilename_.size() > 0) ) { // A work around of this issue is to remove the Paraview mpi4py library (use print(inspect.getfile(mpi4py))) @@ -165,8 +165,8 @@ DamarisSettings::getKeywords([[maybe_unused]] const Parallel::Communication& com } else { damarisOutputCollective_str = "FilePerCore"; } - OpmLog::info(fmt::format("Opm::DamarisOutput::DamarisKeywords() : ", - damarisOutputCollective_str)); + OpmLog::info(fmt::format("Opm::DamarisOutput::DamarisKeywords() : ", + damarisOutputCollective_str)); std::string simName_str; // Check if simulation name was given on command line @@ -176,10 +176,10 @@ DamarisSettings::getKeywords([[maybe_unused]] const Parallel::Communication& com } else { simName_str = damarisSimName_; } - OpmLog::info(fmt::format("Opm::DamarisOutput::DamarisKeywords() : 0) && (nDamarisNodes_ > 0)) { nDamarisNodes_ = 0; // Default is to use Damaris Cores @@ -216,20 +216,20 @@ DamarisSettings::getKeywords([[maybe_unused]] const Parallel::Communication& com } else { nDamarisNodes_str = "0"; } - - OpmLog::info(fmt::format("Opm::DamarisOutput::DamarisKeywords() : damaris_keywords = { {"_SHMEM_BUFFER_BYTES_REGEX_", shmemSizeBytes_str}, {"_DC_REGEX_", nDamarisCores_str}, @@ -253,7 +253,7 @@ DamarisSettings::getKeywords([[maybe_unused]] const Parallel::Communication& com {"_DISABLEPARAVIEWFIN_",disableParaviewXMLfin}, {"_DASK_SCHEDULER_FILE_",damarisDaskFile_}, }; - + return damaris_keywords; } diff --git a/opm/simulators/utils/DamarisKeywords.hpp b/opm/simulators/utils/DamarisKeywords.hpp index 10c7ae913a..e8069d29f3 100644 --- a/opm/simulators/utils/DamarisKeywords.hpp +++ b/opm/simulators/utils/DamarisKeywords.hpp @@ -39,12 +39,12 @@ */ namespace Opm::DamarisOutput { - -/** - * Returns true if the file exists. - * Tests to see if filename string is empty + +/** + * Returns true if the file exists. + * Tests to see if filename string is empty * or the "#" character and if so returns false. - * Tests for file existance on rank 0 and + * Tests for file existance on rank 0 and * passes result via MPI to all other ranks. */ bool FileExists(const std::string& filename_in, @@ -54,9 +54,9 @@ struct DamarisSettings { bool enableDamarisOutputCollective_ = true; bool saveToDamarisHDF5_ = true; - // if saveMeshToDamarisHDF5 is true, requires enableDamarisOutputCollective to be false + // if saveMeshToDamarisHDF5 is true, requires enableDamarisOutputCollective to be false // (until offsets are are added to mesh data for collective writing) - bool saveMeshToHDF5_ = false; + bool saveMeshToHDF5_ = false; std::string pythonFilename_; std::string paraviewPythonFilename_; @@ -68,13 +68,13 @@ struct DamarisSettings int nDamarisCores_ = 1; // this is the number of (Damaris server) cores per node int nDamarisNodes_ = 0; long shmemSizeBytes_ = 536870912; // 512 MB - - std::string rand_value_str_ ; // to be added to sheared memory name to make unique + + std::string rand_value_str_ ; // to be added to sheared memory name to make unique std::map getKeywords(const Parallel::Communication& comm, const std::string& OutputDir); - + void SetRandString(void); // sets the value of rand_value_str_ }; diff --git a/opm/simulators/utils/DamarisOutputModule.cpp b/opm/simulators/utils/DamarisOutputModule.cpp index 20e8eea0c3..41678d586c 100644 --- a/opm/simulators/utils/DamarisOutputModule.cpp +++ b/opm/simulators/utils/DamarisOutputModule.cpp @@ -47,9 +47,9 @@ initializeDamaris(const Parallel::Communication comm, const int mpiRank, const s /* Get the name of the Damaris input file from an environment variable if available */ const char* cs_damaris_xml_file = getenv("FLOW_DAMARIS_XML_FILE"); - if (cs_damaris_xml_file != NULL) + if (cs_damaris_xml_file != NULL) { - OpmLog::info(std::string("Initializing Damaris from environment variable FLOW_DAMARIS_XML_FILE: ") + cs_damaris_xml_file); + OpmLog::info(std::string("Initializing Damaris from environment variable FLOW_DAMARIS_XML_FILE: ") + cs_damaris_xml_file); dam_err = damaris_initialize(cs_damaris_xml_file, comm); if (dam_err != DAMARIS_OK) { OpmLog::error(fmt::format("ERORR: damariswriter::initializeDamaris() : ( rank:{}) " @@ -70,10 +70,10 @@ initializeDamaris(const Parallel::Communication comm, const int mpiRank, const s if (mpiRank == 0) { myMod.SaveXMLStringToFile(damaris_xml_filename_str); } - - OpmLog::info("Initializing Damaris using internally built file: " + damaris_xml_filename_str + + + OpmLog::info("Initializing Damaris using internally built file: " + damaris_xml_filename_str + " (N.B. use environment variable FLOW_DAMARIS_XML_FILE to override)"); - + dam_err = damaris_initialize(damaris_xml_filename_str.c_str(), comm); if (dam_err != DAMARIS_OK) { OpmLog::error(fmt::format("damariswriter::initializeDamaris() : ( rank:{}) " diff --git a/opm/simulators/utils/DamarisOutputModule.hpp b/opm/simulators/utils/DamarisOutputModule.hpp index 94c2cd66b8..a1f9ec0ef3 100644 --- a/opm/simulators/utils/DamarisOutputModule.hpp +++ b/opm/simulators/utils/DamarisOutputModule.hpp @@ -1,7 +1,7 @@ /* Copyright 2022 SINTEF Digital, Mathematics and Cybernetics. Copyright 2023 INRIA - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify @@ -36,12 +36,12 @@ namespace Opm::DamarisOutput { // Initialize an XML file std::string initDamarisXmlFile(); - + /** * Initialize Damaris by either: * 1/ Filling in a templated XML file and storing it in the chosen directory (output directory) -* 2/ Reading a file specified by the environment variable FLOW_DAMARIS_XML_FILE -* +* 2/ Reading a file specified by the environment variable FLOW_DAMARIS_XML_FILE +* */ void initializeDamaris(const Parallel::Communication comm, const int mpiRank, const std::map& find_replace_map); diff --git a/opm/simulators/utils/DeferredLoggingErrorHelpers.hpp b/opm/simulators/utils/DeferredLoggingErrorHelpers.hpp index 3b4dc0d049..6acf8f1b52 100644 --- a/opm/simulators/utils/DeferredLoggingErrorHelpers.hpp +++ b/opm/simulators/utils/DeferredLoggingErrorHelpers.hpp @@ -193,7 +193,7 @@ catch (const Opm::NumericalProblem& e){ \ } \ OPM_PARALLEL_CATCH_CLAUSE(obptc_exc_type, obptc_exc_msg);\ checkForExceptionsAndThrow(obptc_exc_type, \ - prefix + obptc_exc_msg, comm); + prefix + obptc_exc_msg, comm); /// \brief Catch exception, log, and throw in a parallel try-catch clause /// diff --git a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp index 00dd83dd28..d541479007 100644 --- a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp +++ b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp @@ -97,7 +97,7 @@ partiallySupported() "GCONPROD", { {2,{true, allow_values {"NONE", "FLD", "ORAT", "WRAT", "GRAT", "LRAT", "RESV"}, "GCONPROD(TARGET): valid option should be NONE/FLD/ORAT/WRAT/GRAT/LRAT or RESV"}}, // CONTROL_MODE - {7,{true, allow_values {"NONE", "RATE", "WELL"}, "GCONPROD(ACTION): Only NONE, RATE and WELL are supported"}}, + {7,{true, allow_values {"NONE", "RATE", "WELL"}, "GCONPROD(ACTION): Only NONE, RATE and WELL are supported"}}, {11,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTWAT): Only NONE and RATE are supported"}}, // WATER_EXCEED_PROCEDURE {12,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTGAS): Only NONE and RATE are supported"}}, // GAS_EXCEED_PROCEDURE {13,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTLIQ): Only NONE and RATE are supported"}}, // LIQUID_EXCEED_PROCEDURE @@ -197,8 +197,8 @@ partiallySupported() { "ROCKOPTS", { - {1,{true, allow_values {"PRESSURE"}, "ROCKOPTS: only the PRESSURE options are supported"}}, - {3,{true, allow_values {"PVTNUM", "ROCKNUM"}, "ROCKOPTS: only PVTNUM and ROCKNUM are supported"}}, + {1,{true, allow_values {"PRESSURE"}, "ROCKOPTS: only the PRESSURE options are supported"}}, + {3,{true, allow_values {"PVTNUM", "ROCKNUM"}, "ROCKOPTS: only PVTNUM and ROCKNUM are supported"}}, }, }, { @@ -304,7 +304,7 @@ partiallySupported() { "WTEST", { - {3,{true, allow_values {"E", "P", "G", "EP", "PE", "EG", "GE", "PG", "GP", "PEG", "PGE", "EPG", "EGP", "GEP", "GPE"}, + {3,{true, allow_values {"E", "P", "G", "EP", "PE", "EG", "GE", "PG", "GP", "PEG", "PGE", "EPG", "EGP", "GEP", "GPE"}, "WTEST(TEST): only the E (economic) and P (physical) and G (group) reason is currently supported"}}, // REASON }, }, @@ -548,7 +548,7 @@ partiallySupported() }, }, { - "EHYSTR", + "EHYSTR", { {3,{false, allow_values {1.0}, "EHYSTR(HYSTREL): Killough’s option not supported and should be defaulted"}}, // curvature_param_killough_wetting {12,{true, allow_values {0}, "EHYSTR(HYTHRESH): Killough’s option not supported and should be defaulted"}}, // threshold_saturation @@ -615,7 +615,7 @@ partiallySupported() }, }, { - "PLYMAX", + "PLYMAX", { {2,{false, allow_values {}, "PLYMAX(SALTCON): option is ignored since BRINE and POLYMER combination is not implemented in OPM Flow"}}, // MAX_SALT_CONCENTRATION }, diff --git a/opm/simulators/utils/UnsupportedFlowKeywords.cpp b/opm/simulators/utils/UnsupportedFlowKeywords.cpp index af83de83c1..c3771e9a4c 100644 --- a/opm/simulators/utils/UnsupportedFlowKeywords.cpp +++ b/opm/simulators/utils/UnsupportedFlowKeywords.cpp @@ -735,7 +735,7 @@ const KeywordValidation::UnsupportedKeywords& unsupportedKeywords() {"WTHPMAX", {true, std::nullopt}}, {"ZIPPY2", {false, std::nullopt}}, {"ZIPP2OFF", {false, std::nullopt}}, - {"ZMFVD", {false, std::nullopt}}, + {"ZMFVD", {false, std::nullopt}}, }; return unsupported_keywords; diff --git a/opm/simulators/utils/initDamarisXmlFile.cpp b/opm/simulators/utils/initDamarisXmlFile.cpp index dcb5b4bb75..33bec0b0d8 100644 --- a/opm/simulators/utils/initDamarisXmlFile.cpp +++ b/opm/simulators/utils/initDamarisXmlFile.cpp @@ -27,9 +27,9 @@ namespace Opm::DamarisOutput The entries in the map below will be filled by corresponding Damaris Keywords. - + N.B. Ensure all text items that are to be replaced are quoted with double quotes - e.g. unit="_REPLACE_UNIT_" + e.g. unit="_REPLACE_UNIT_" *not* unit=_REPLACE_UNIT_ */ std::string initDamarisXmlFile() @@ -49,30 +49,30 @@ std::string initDamarisXmlFile() - + - - + + - - + + _MORE_VARIABLES_REGEX_ - + - + - + @@ -89,45 +89,45 @@ std::string initDamarisXmlFile() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -144,7 +144,7 @@ std::string initDamarisXmlFile() - @@ -155,7 +155,7 @@ std::string initDamarisXmlFile() - + diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index d2d7db90a4..8c28201224 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -509,7 +509,7 @@ void Opm::ensureOutputDirExists(const std::string& cmdline_output_dir) } void Opm::prepareResultOutputDirectory(const std::string& baseName, - const std::filesystem::path& outputDir) + const std::filesystem::path& outputDir) { namespace fs = std::filesystem; @@ -617,7 +617,7 @@ Opm::setupLogging(Parallel::Communication& comm, } // Cleans up the result output directory, we only do this on process 0 - if (comm.rank() == 0) { + if (comm.rank() == 0) { prepareResultOutputDirectory(baseName, output_dir); } //... and the other processes need to wait for this to be finished. diff --git a/opm/simulators/utils/satfunc/OilPhaseConsistencyChecks.hpp b/opm/simulators/utils/satfunc/OilPhaseConsistencyChecks.hpp index eeea3f7756..074d333f9f 100644 --- a/opm/simulators/utils/satfunc/OilPhaseConsistencyChecks.hpp +++ b/opm/simulators/utils/satfunc/OilPhaseConsistencyChecks.hpp @@ -383,7 +383,7 @@ namespace Opm::Satfunc::PhaseChecks::Oil { /// Minimum (connate) saturation. Scalar swu_{}; - + /// Run check against a set of saturation function end-points. /// /// \param[in] endPoints Set of saturation function end-points. diff --git a/opm/simulators/utils/satfunc/RelpermDiagnostics.cpp b/opm/simulators/utils/satfunc/RelpermDiagnostics.cpp index 77cca9c789..399f0c5255 100644 --- a/opm/simulators/utils/satfunc/RelpermDiagnostics.cpp +++ b/opm/simulators/utils/satfunc/RelpermDiagnostics.cpp @@ -899,7 +899,7 @@ namespace Opm { #if HAVE_DUNE_ALUGRID #if HAVE_MPI INSTANCE_DIAGNOSIS(Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridMPIComm>) -#else +#else INSTANCE_DIAGNOSIS(Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, Dune::ALUGridNoComm>) #endif //HAVE_MPI #endif //HAVE_DUNE_ALUGRID diff --git a/opm/simulators/wells/ALQState.hpp b/opm/simulators/wells/ALQState.hpp index 36f454718b..b31e27a12a 100644 --- a/opm/simulators/wells/ALQState.hpp +++ b/opm/simulators/wells/ALQState.hpp @@ -63,6 +63,3 @@ private: } #endif - - - diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 558262c544..60feb4ed64 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -357,7 +357,7 @@ template class WellContributions; int compressedIndexForInteriorLGR(const std::string& lgr_tag, const Connection& conn) const override { return simulator_.vanguard().compressedIndexForInteriorLGR(lgr_tag, conn); - } + } // using the solution x to recover the solution xw for wells and applying // xw to update Well State diff --git a/opm/simulators/wells/BlackoilWellModelConstraints.cpp b/opm/simulators/wells/BlackoilWellModelConstraints.cpp index d28bbda7b2..4ec89cc128 100644 --- a/opm/simulators/wells/BlackoilWellModelConstraints.cpp +++ b/opm/simulators/wells/BlackoilWellModelConstraints.cpp @@ -684,9 +684,9 @@ updateGroupIndividualControl(const Group& group, if (changed_this.first != Group::ProductionCMode::NONE) { std::optional worst_offending_well = std::nullopt; - changed = this->actionOnBrokenConstraints(group, reportStepIdx, + changed = this->actionOnBrokenConstraints(group, reportStepIdx, controls.group_limit_action, - changed_this.first, well_state, + changed_this.first, well_state, worst_offending_well, group_state, deferred_logger); @@ -703,7 +703,7 @@ updateGroupIndividualControl(const Group& group, wellModel_.groupState(), well_state); } else if (worst_offending_well) { - closed_offending_wells.insert_or_assign(group.name(), + closed_offending_wells.insert_or_assign(group.name(), std::make_pair(Group::ProductionCMode2String(changed_this.first), *worst_offending_well)); } } diff --git a/opm/simulators/wells/BlackoilWellModelGasLift_impl.hpp b/opm/simulators/wells/BlackoilWellModelGasLift_impl.hpp index 9c69ebb1aa..7b05b9cd6b 100644 --- a/opm/simulators/wells/BlackoilWellModelGasLift_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModelGasLift_impl.hpp @@ -203,7 +203,7 @@ gasLiftOptimizationStage1(const Simulator& simulator, num_rates_to_sync = groups_to_sync.size(); } { - OPM_TIMEBLOCK(WaitForGasLiftSyncGroups); + OPM_TIMEBLOCK(WaitForGasLiftSyncGroups); num_rates_to_sync = comm.sum(num_rates_to_sync); } if (num_rates_to_sync > 0) { diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 421eae2ea8..0fa8dfb5d3 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -384,10 +384,10 @@ initializeWellPerfData() for (const auto& connection : well.getConnections()) { - + const int active_index = well.is_lgr_well() ? compressedIndexForInteriorLGR(well.get_lgr_well_tag().value(), connection) - : this->compressedIndexForInterior(connection.global_index()); + : this->compressedIndexForInterior(connection.global_index()); const auto connIsOpen = connection.state() == Connection::State::OPEN; @@ -794,7 +794,7 @@ checkGroupHigherConstraints(const Group& group, deferred_logger); if (is_changed) { const auto group_limit_action = group.productionControls(summaryState_).group_limit_action; - std::optional worst_offending_well = std::nullopt; + std::optional worst_offending_well = std::nullopt; changed = BlackoilWellModelConstraints(*this). actionOnBrokenConstraints(group, reportStepIdx, group_limit_action, Group::ProductionCMode::FLD, @@ -1335,7 +1335,7 @@ updateAndCommunicateGroupData(const int reportStepIdx, const Phase all[] = { Phase::WATER, Phase::OIL, Phase::GAS }; for (Phase phase : all) { if (this->groupState().has_injection_control(gr_name, phase)) { - if (this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP || + if (this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP || this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::REIN) { OPM_TIMEBLOCK(extraIterationsAfterNupcol); const bool is_vrep = this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP; @@ -1949,9 +1949,9 @@ getCellsForConnections(const Well& well) const for (const auto& connection : connectionSet) { int compressed_idx = well.is_lgr_well() - ? compressedIndexForInteriorLGR(well.get_lgr_well_tag().value(), connection) - : this->compressedIndexForInterior(connection.global_index()); - + ? compressedIndexForInteriorLGR(well.get_lgr_well_tag().value(), connection) + : this->compressedIndexForInterior(connection.global_index()); + if (compressed_idx >= 0) { // Ignore connections in inactive/remote cells. wellCells.push_back(compressed_idx); } diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index d879852435..f6c8ac31c9 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -509,7 +509,7 @@ protected: const Scalar gasDensity) const; Schedule& schedule_; - + const SummaryState& summaryState_; const EclipseState& eclState_; const Parallel::Communication& comm_; diff --git a/opm/simulators/wells/BlackoilWellModelNldd.hpp b/opm/simulators/wells/BlackoilWellModelNldd.hpp index a1cba8095e..3a9ca2b334 100644 --- a/opm/simulators/wells/BlackoilWellModelNldd.hpp +++ b/opm/simulators/wells/BlackoilWellModelNldd.hpp @@ -122,15 +122,15 @@ public: const int domainIdx); // Get number of wells on this rank - int numLocalWells() const + int numLocalWells() const { - return wellModel_.numLocalWells(); + return wellModel_.numLocalWells(); } // Get number of wells on this rank - int numLocalWellsEnd() const + int numLocalWellsEnd() const { - return wellModel_.numLocalWellsEnd(); + return wellModel_.numLocalWellsEnd(); } private: diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 63956d4643..0f97b65d28 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1267,7 +1267,7 @@ namespace Opm { OPM_TIMEFUNCTION(); const int iterationIdx = simulator_.model().newtonMethod().numIterations(); const int reportStepIdx = simulator_.episodeIndex(); - this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, + this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, param_.nupcol_group_rate_tolerance_, /*update_wellgrouptarget*/ true, local_deferredLogger); // We need to call updateWellControls before we update the network as // network updates are only done on thp controlled wells. @@ -1359,7 +1359,7 @@ namespace Opm { bool fld_none = false; if (cmode_tmp == Group::ProductionCMode::FLD || cmode_tmp == Group::ProductionCMode::NONE) { fld_none = true; - // Target is set for an ancestor group. Target for autochoke group to be + // Target is set for an ancestor group. Target for autochoke group to be // derived via group guide rates const Scalar efficiencyFactor = 1.0; const Group& parentGroup = this->schedule().getGroup(group.parent(), reportStepIdx); @@ -2028,7 +2028,7 @@ namespace Opm { const auto episode_idx = simulator_.episodeIndex(); const auto follow_on_well = econ_production_limits.followonWell(); if (!this->schedule().hasWell(follow_on_well, episode_idx)) { - const auto msg = fmt::format("Well {} was closed. But the given follow on well {} does not exist." + const auto msg = fmt::format("Well {} was closed. But the given follow on well {} does not exist." "The simulator continues without opening a follow on well.", wname, follow_on_well); local_deferredLogger.warning(msg); diff --git a/opm/simulators/wells/GasLiftGroupInfo.cpp b/opm/simulators/wells/GasLiftGroupInfo.cpp index 4cd34fd35c..30385ce830 100644 --- a/opm/simulators/wells/GasLiftGroupInfo.cpp +++ b/opm/simulators/wells/GasLiftGroupInfo.cpp @@ -548,16 +548,16 @@ getProducerWellRates_(const Well* well, int well_index) Scalar gas_rate = gas_pot; if (controls.hasControl(Well::ProducerCMode::ORAT) && oil_rate > static_cast(controls.oil_rate)) { - water_rate *= (static_cast(controls.oil_rate) / oil_rate); + water_rate *= (static_cast(controls.oil_rate) / oil_rate); oil_rate = static_cast(controls.oil_rate); } - + if (controls.hasControl(Well::ProducerCMode::GRAT)) { gas_rate = std::min(static_cast(controls.gas_rate), gas_rate); } - + if (controls.hasControl(Well::ProducerCMode::WRAT) && water_rate > static_cast(controls.water_rate)) { - oil_rate *= (static_cast(controls.water_rate) / water_rate); + oil_rate *= (static_cast(controls.water_rate) / water_rate); water_rate = static_cast(controls.water_rate); } if (controls.hasControl(Well::ProducerCMode::LRAT)) { @@ -675,7 +675,7 @@ initializeGroupRatesRecursive_(const Group& group) if (gas_target && gas_rate > *gas_target) gas_rate = *gas_target; if (water_target && water_rate > *water_target) { - oil_rate *= (*water_target/water_rate); + oil_rate *= (*water_target/water_rate); water_rate = *water_target; } if (liquid_target) { diff --git a/opm/simulators/wells/GasLiftSingleWellGeneric.cpp b/opm/simulators/wells/GasLiftSingleWellGeneric.cpp index db786cf1ed..50bf46fdde 100644 --- a/opm/simulators/wells/GasLiftSingleWellGeneric.cpp +++ b/opm/simulators/wells/GasLiftSingleWellGeneric.cpp @@ -770,7 +770,7 @@ getRateWithLimit_(Rate rate_type, const BasicRates& rates) const displayDebugMessage_(msg); rate2 *= target/new_rate; new_rate = target; - target_type = rate_type; + target_type = rate_type; } } if (((rate_type == Rate::oil) || (rate_type == Rate::water))) { @@ -1003,7 +1003,7 @@ getLimitedRatesFromRates_(const BasicRates& rates) const bool oil_is_limited = oil_limiting_target.has_value(); auto [gas_rate, gas_is_limited] = getGasRateWithLimit_(rates); auto [water_rate, water_limiting_target] = getWaterRateWithLimit2_(rates); - + bool water_is_limited = water_limiting_target.has_value(); return LimitedRates {oil_rate, gas_rate, diff --git a/opm/simulators/wells/GlobalWellInfo.hpp b/opm/simulators/wells/GlobalWellInfo.hpp index a5e76dfb94..c47947257e 100644 --- a/opm/simulators/wells/GlobalWellInfo.hpp +++ b/opm/simulators/wells/GlobalWellInfo.hpp @@ -99,4 +99,3 @@ private: } #endif - diff --git a/opm/simulators/wells/GroupState.cpp b/opm/simulators/wells/GroupState.cpp index 2d4e6f4e40..391ec9a8e1 100644 --- a/opm/simulators/wells/GroupState.cpp +++ b/opm/simulators/wells/GroupState.cpp @@ -135,14 +135,14 @@ GroupState::network_leaf_node_production_rates(const std::string& gname) template void GroupState:: -GroupState::update_well_group_thp(const std::string& gname, const double& thp) +GroupState::update_well_group_thp(const std::string& gname, const double& thp) { this->group_thp[gname] = thp; } template Scalar GroupState:: -GroupState::well_group_thp(const std::string& gname) const +GroupState::well_group_thp(const std::string& gname) const { auto group_iter = this->group_thp.find(gname); if (group_iter == this->group_thp.end()) diff --git a/opm/simulators/wells/GuideRateHandler.cpp b/opm/simulators/wells/GuideRateHandler.cpp index 934417015e..eeb159b394 100644 --- a/opm/simulators/wells/GuideRateHandler.cpp +++ b/opm/simulators/wells/GuideRateHandler.cpp @@ -788,4 +788,3 @@ template class GuideRateHandler; #endif } // namespace Opm - diff --git a/opm/simulators/wells/MultisegmentWellAssemble.cpp b/opm/simulators/wells/MultisegmentWellAssemble.cpp index 0cbff10965..43d432430f 100644 --- a/opm/simulators/wells/MultisegmentWellAssemble.cpp +++ b/opm/simulators/wells/MultisegmentWellAssemble.cpp @@ -215,8 +215,8 @@ assembleAccelerationTerm(const int seg_target, // seg_upwind: upwind segment to seg // acceleration term shold be // * velocity head for seg_target if seg = seg_target - // * negative velocity head for seg if seg != seg_target - + // * negative velocity head for seg if seg != seg_target + /* This method is called in MultisegmentWellEval::assembleAccelerationPressureLoss. It does *not* need communication. @@ -232,7 +232,7 @@ assembleAccelerationTerm(const int seg_target, if constexpr (has_gfrac_variable) { eqns.D()[seg_target][seg_upwind][SPres][GFrac] -= accelerationTerm.derivative(GFrac + Indices::numEq); } -} +} template void MultisegmentWellAssemble:: diff --git a/opm/simulators/wells/MultisegmentWellEquations.cpp b/opm/simulators/wells/MultisegmentWellEquations.cpp index 16be0a0f67..6c819782ca 100644 --- a/opm/simulators/wells/MultisegmentWellEquations.cpp +++ b/opm/simulators/wells/MultisegmentWellEquations.cpp @@ -441,7 +441,7 @@ void MultisegmentWellEquations:: sumDistributed(Parallel::Communication comm) { // accumulate resWell_ and duneD_ in parallel to get effects of all perforations (might be distributed) - // we need to do this for all segments in the residual and on the diagonal of D + // we need to do this for all segments in the residual and on the diagonal of D for (int seg = 0; seg < well_.numberOfSegments(); ++seg) Opm::wellhelpers::sumDistributedWellEntries(duneD_[seg][seg], resWell_[seg], comm); } diff --git a/opm/simulators/wells/MultisegmentWellEval.cpp b/opm/simulators/wells/MultisegmentWellEval.cpp index 58ec821e32..1c4a634444 100644 --- a/opm/simulators/wells/MultisegmentWellEval.cpp +++ b/opm/simulators/wells/MultisegmentWellEval.cpp @@ -87,7 +87,7 @@ getWellConvergence(const WellState& well_state, const Scalar relaxed_inner_tolerance_flow_ms_well, const Scalar tolerance_pressure_ms_wells, const Scalar relaxed_inner_tolerance_pressure_ms_well, - const bool relax_tolerance, + const bool relax_tolerance, const bool well_is_stopped) const { assert(int(B_avg.size()) == baseif_.numConservationQuantities()); @@ -163,7 +163,7 @@ getWellConvergence(const WellState& well_state, tolerance_wells, max_residual_allowed}, std::abs(linSys_.residual()[0][SPres]), - well_is_stopped, + well_is_stopped, report, deferred_logger); @@ -211,7 +211,7 @@ assembleAccelerationPressureLoss(const int seg, const Scalar seg_area = segment_set[seg].crossArea(); const EvalWell signed_velocity_head = segments_.accelerationPressureLossContribution(seg, seg_area); segments.pressure_drop_accel[seg] = signed_velocity_head.value(); - + const int seg_upwind = segments_.upwinding_segment(seg); // acceleration term is *subtracted* from pressure equation MultisegmentWellAssemble(baseif_). @@ -231,7 +231,7 @@ assembleAccelerationPressureLoss(const int seg, const EvalWell signed_velocity_head_inlet = segments_.accelerationPressureLossContribution(inlet, inlet_area); segments.pressure_drop_accel[seg] -= signed_velocity_head_inlet.value(); - const int inlet_upwind = segments_.upwinding_segment(inlet); + const int inlet_upwind = segments_.upwinding_segment(inlet); MultisegmentWellAssemble(baseif_). assembleAccelerationTerm(seg, inlet, inlet_upwind, -signed_velocity_head_inlet, linSys_); if (inlet != inlet_upwind) {// special treatment for reverse flow diff --git a/opm/simulators/wells/MultisegmentWellEval.hpp b/opm/simulators/wells/MultisegmentWellEval.hpp index 43ab1f24d5..5e5c3409f7 100644 --- a/opm/simulators/wells/MultisegmentWellEval.hpp +++ b/opm/simulators/wells/MultisegmentWellEval.hpp @@ -110,7 +110,7 @@ protected: const Scalar relaxed_inner_tolerance_flow_ms_well, const Scalar tolerance_pressure_ms_wells, const Scalar relaxed_inner_tolerance_pressure_ms_well, - const bool relax_tolerance, + const bool relax_tolerance, const bool well_is_stopped) const; std::pair > diff --git a/opm/simulators/wells/MultisegmentWellGeneric.cpp b/opm/simulators/wells/MultisegmentWellGeneric.cpp index 9780eb44b8..2212e07893 100644 --- a/opm/simulators/wells/MultisegmentWellGeneric.cpp +++ b/opm/simulators/wells/MultisegmentWellGeneric.cpp @@ -162,7 +162,7 @@ update_relaxation_factor(const std::vector& measure_history, Scalar& rel bool oscillate = (d1 < oscillaton_rel_tol) && (oscillaton_rel_tol < d2); if (!oscillate) return false; - + const Scalar min_relaxation_factor = 0.6; std::ostringstream sstr; if (relaxation_factor == min_relaxation_factor) { diff --git a/opm/simulators/wells/MultisegmentWellGeneric.hpp b/opm/simulators/wells/MultisegmentWellGeneric.hpp index 8173589a86..06fa7dc1a1 100644 --- a/opm/simulators/wells/MultisegmentWellGeneric.hpp +++ b/opm/simulators/wells/MultisegmentWellGeneric.hpp @@ -61,7 +61,7 @@ protected: WellSegmentCompPressureDrop compPressureDrop() const; /// Detect oscillation or stagnation based on the residual measure history - bool update_relaxation_factor(const std::vector& measure_history, Scalar& relaxation_factor, bool& regularize, DeferredLogger& deferred_logger) const; + bool update_relaxation_factor(const std::vector& measure_history, Scalar& relaxation_factor, bool& regularize, DeferredLogger& deferred_logger) const; bool repeatedStagnation(const std::vector& measure_history, bool& regularize, DeferredLogger& deferred_logger) const; bool accelerationalPressureLossConsidered() const; diff --git a/opm/simulators/wells/MultisegmentWellSegments.cpp b/opm/simulators/wells/MultisegmentWellSegments.cpp index dd195e39c3..3cf55a97f4 100644 --- a/opm/simulators/wells/MultisegmentWellSegments.cpp +++ b/opm/simulators/wells/MultisegmentWellSegments.cpp @@ -505,7 +505,7 @@ getSurfaceVolume(const EvalWell& temperature, template typename MultisegmentWellSegments::EvalWell MultisegmentWellSegments:: -getFrictionPressureLoss(const int seg, +getFrictionPressureLoss(const int seg, const bool extra_reverse_flow_derivatives /*false*/) const { EvalWell mass_rate = mass_rates_[seg]; @@ -594,10 +594,10 @@ pressureDropSpiralICD(const int seg, EvalWell density = densities_[seg_upwind]; EvalWell mass_rate = mass_rates_[seg]; // In the reverse flow case, we don't have enough slots for all derivatives, e.g., - // upwind pressure and flow. We amend this by a second function call option, where + // upwind pressure and flow. We amend this by a second function call option, where // only these remaining derivatives are considered. - // For reference: the pressure equation assumes pressure/flow derivatives are given - // at segment node while fraction derivatives are given at upwind node. + // For reference: the pressure equation assumes pressure/flow derivatives are given + // at segment node while fraction derivatives are given at upwind node. if (seg != seg_upwind) { constexpr int nvar = PrimaryVariables::numWellEq; std::vector zero_mask(nvar, false); @@ -662,7 +662,7 @@ template typename MultisegmentWellSegments::EvalWell MultisegmentWellSegments:: pressureDropAutoICD(const int seg, - const UnitSystem& unit_system, + const UnitSystem& unit_system, const bool extra_reverse_flow_derivatives /*false*/) const { const auto& segment_set = well_.wellEcl().getSegments(); @@ -706,10 +706,10 @@ pressureDropAutoICD(const int seg, EvalWell density = densities_[seg_upwind]; EvalWell mass_rate = mass_rates_[seg]; // In the reverse flow case, we don't have enough slots for all derivatives, e.g., - // upwind pressure and flow. We amend this by a second function call option, where + // upwind pressure and flow. We amend this by a second function call option, where // only these remaining derivatives are considered. - // For reference: the pressure equation assumes pressure/flow derivatives are given - // at segment node while fraction derivatives are given at upwind node. + // For reference: the pressure equation assumes pressure/flow derivatives are given + // at segment node while fraction derivatives are given at upwind node. if (seg != seg_upwind) { constexpr int nvar = PrimaryVariables::numWellEq; std::vector zero_mask(nvar, false); @@ -787,10 +787,10 @@ pressureDropValve(const int seg, EvalWell visc = viscosities_[seg_upwind]; EvalWell density = densities_[seg_upwind]; // In the reverse flow case, we don't have enough slots for all derivatives, e.g., - // upwind pressure and flow. We amend this by a second function call optioin, where + // upwind pressure and flow. We amend this by a second function call optioin, where // only these remaining derivatives are considered. - // For reference: the pressure equation assumes pressure/flow derivatives are given - // at segment node while fraction derivatives are given at upwind node. + // For reference: the pressure equation assumes pressure/flow derivatives are given + // at segment node while fraction derivatives are given at upwind node. if (seg != seg_upwind) { if (!extra_reverse_flow_derivatives) { constexpr int WQTotal = Indices::numEq + PrimaryVariables::WQTotal; @@ -840,11 +840,11 @@ accelerationPressureLossContribution(const int seg, const Scalar area, const bool extra_reverse_flow_derivatives /*false*/) const { - // Compute the *signed* velocity head for given segment (sign is positive for flow towards surface, i.e., negative rate) + // Compute the *signed* velocity head for given segment (sign is positive for flow towards surface, i.e., negative rate) // Optionally return derivatives for reversed flow case EvalWell mass_rate = mass_rates_[seg]; const int seg_upwind = upwinding_segments_[seg]; - EvalWell density = densities_[seg_upwind]; + EvalWell density = densities_[seg_upwind]; if (seg != seg_upwind) { if (!extra_reverse_flow_derivatives) { constexpr int WQTotal = Indices::numEq + PrimaryVariables::WQTotal; @@ -865,7 +865,7 @@ accelerationPressureLossContribution(const int seg, } const Scalar sign = mass_rate > 0 ? -1.0 : 1.0; return sign * mswellhelpers::velocityHead(area, mass_rate, density); -} +} template void diff --git a/opm/simulators/wells/MultisegmentWellSegments.hpp b/opm/simulators/wells/MultisegmentWellSegments.hpp index 3018d332b8..f32a648f67 100644 --- a/opm/simulators/wells/MultisegmentWellSegments.hpp +++ b/opm/simulators/wells/MultisegmentWellSegments.hpp @@ -75,7 +75,7 @@ public: const int pvt_region_index, const int seg_idx) const; - EvalWell getFrictionPressureLoss(const int seg, + EvalWell getFrictionPressureLoss(const int seg, const bool extra_reverse_flow_derivatives = false) const; // pressure drop for Spiral ICD segment (WSEGSICD) @@ -88,7 +88,7 @@ public: const bool extra_reverse_flow_derivatives = false) const; // pressure drop for sub-critical valve (WSEGVALV) - EvalWell pressureDropValve(const int seg, + EvalWell pressureDropValve(const int seg, const SummaryState& st, const bool extra_reverse_flow_derivatives = false) const; diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 81980baff4..236e9f4bdf 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -215,7 +215,7 @@ namespace Opm this->param_.relaxed_tolerance_flow_well_, this->param_.tolerance_pressure_ms_wells_, this->param_.relaxed_tolerance_pressure_ms_well_, - relax_tolerance, + relax_tolerance, this->wellIsStopped()); } @@ -534,8 +534,8 @@ namespace Opm DeferredLogger& deferred_logger) const { // Create a copy of the well. - // TODO: check if we can avoid taking multiple copies. Call from updateWellPotentials - // is allready a copy, but not from other calls. + // TODO: check if we can avoid taking multiple copies. Call from updateWellPotentials + // is allready a copy, but not from other calls. MultisegmentWell well_copy(*this); well_copy.debug_cost_counter_ = 0; @@ -543,8 +543,8 @@ namespace Opm WellStateType well_state_copy = well_state; const auto& group_state = simulator.problem().wellModel().groupState(); auto& ws = well_state_copy.well(this->index_of_well_); - - // get current controls + + // get current controls const auto& summary_state = simulator.vanguard().summaryState(); auto inj_controls = well_copy.well_ecl_.isInjector() ? well_copy.well_ecl_.injectionControls(summary_state) @@ -552,10 +552,10 @@ namespace Opm auto prod_controls = well_copy.well_ecl_.isProducer() ? well_copy.well_ecl_.productionControls(summary_state) : Well::ProductionControls(0); - + // prepare/modify well state and control well_copy.onlyKeepBHPandTHPcontrols(summary_state, well_state_copy, inj_controls, prod_controls); - + well_copy.scaleSegmentPressuresWithBhp(well_state_copy); // initialize rates from previous potentials @@ -1319,7 +1319,7 @@ namespace Opm // the well index associated with the connection const Scalar trans_mult = simulator.problem().template wellTransMultiplier(int_quantities, cell_idx); const auto& wellstate_nupcol = simulator.problem().wellModel().nupcolWellState().well(this->index_of_well_); - const std::vector tw_perf = this->wellIndex(local_perf_index, int_quantities, trans_mult, wellstate_nupcol); + const std::vector tw_perf = this->wellIndex(local_perf_index, int_quantities, trans_mult, wellstate_nupcol); std::vector ipr_a_perf(this->ipr_a_.size()); std::vector ipr_b_perf(this->ipr_b_.size()); for (int comp_idx = 0; comp_idx < this->num_conservation_quantities_; ++comp_idx) { @@ -1366,9 +1366,9 @@ namespace Opm DeferredLogger& deferred_logger) { // Compute IPR based on *converged* well-equation: - // For a component rate r the derivative dr/dbhp is obtained by + // For a component rate r the derivative dr/dbhp is obtained by // dr/dbhp = - (partial r/partial x) * inv(partial Eq/partial x) * (partial Eq/partial bhp_target) - // where Eq(x)=0 is the well equation setup with bhp control and primary variables x + // where Eq(x)=0 is the well equation setup with bhp control and primary variables x // We shouldn't have zero rates at this stage, but check bool zero_rates; @@ -1382,7 +1382,7 @@ namespace Opm const auto msg = fmt::format("updateIPRImplicit: Well {} has zero rate, IPRs might be problematic", this->name()); deferred_logger.debug(msg); /* - // could revert to standard approach here: + // could revert to standard approach here: updateIPR(simulator, deferred_logger); for (int comp_idx = 0; comp_idx < this->num_conservation_quantities_; ++comp_idx){ const int idx = this->activeCompToActivePhaseIdx(comp_idx); @@ -1396,7 +1396,7 @@ namespace Opm std::fill(ws.implicit_ipr_a.begin(), ws.implicit_ipr_a.end(), 0.); std::fill(ws.implicit_ipr_b.begin(), ws.implicit_ipr_b.end(), 0.); - //WellState well_state_copy = well_state; + //WellState well_state_copy = well_state; auto inj_controls = Well::InjectionControls(0); auto prod_controls = Well::ProductionControls(0); prod_controls.addControl(Well::ProducerCMode::BHP); @@ -1418,14 +1418,14 @@ namespace Opm const EvalWell comp_rate = this->primary_variables_.getQs(comp_idx); const int idx = FluidSystem::activeCompToActivePhaseIdx(comp_idx); for (size_t pvIdx = 0; pvIdx < num_eq; ++pvIdx) { - // well primary variable derivatives in EvalWell start at position Indices::numEq + // well primary variable derivatives in EvalWell start at position Indices::numEq ws.implicit_ipr_b[idx] -= x_well[0][pvIdx]*comp_rate.derivative(pvIdx+Indices::numEq); } ws.implicit_ipr_a[idx] = ws.implicit_ipr_b[idx]*ws.bhp - comp_rate.value(); } // reset cmode ws.production_cmode = cmode; - } + } template void @@ -1612,8 +1612,8 @@ namespace Opm const Well::ProductionControls& prod_controls, WellStateType& well_state, const GroupState& group_state, - DeferredLogger& deferred_logger, - const bool fixed_control /*false*/, + DeferredLogger& deferred_logger, + const bool fixed_control /*false*/, const bool fixed_status /*false*/) { const int max_iter_number = this->param_.max_inner_iter_ms_wells_; @@ -1638,8 +1638,8 @@ namespace Opm const auto& summary_state = simulator.vanguard().summaryState(); // Always take a few (more than one) iterations after a switch before allowing a new switch - // The optimal number here is subject to further investigation, but it has been observerved - // that unless this number is >1, we may get stuck in a cycle + // The optimal number here is subject to further investigation, but it has been observerved + // that unless this number is >1, we may get stuck in a cycle const int min_its_after_switch = 3; // We also want to restrict the number of status switches to avoid oscillation between STOP<->OPEN const int max_status_switch = this->param_.max_well_status_switch_inner_iter_; @@ -1767,7 +1767,7 @@ namespace Opm deferred_logger.debug(message, OpmLog::defaultDebugVerbosityLevel + ((it == 0) && (switch_count == 0))); } else { this->wellStatus_ = well_status_orig; - this->operability_status_ = operability_orig; + this->operability_status_ = operability_orig; const std::string message = fmt::format(" Well {} did not converge in {} inner iterations (" "{} switches, {} status changes).", this->name(), it, switch_count, status_switch_count); deferred_logger.debug(message); @@ -1811,7 +1811,7 @@ namespace Opm const bool allow_cf = this->getAllowCrossFlow() || openCrossFlowAvoidSingularity(simulator); const int nseg = this->numberOfSegments(); - + const Scalar rhow = FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) ? FluidSystem::referenceDensity( FluidSystem::waterPhaseIdx, Base::pvtRegionIdx() ) : 0.0; const unsigned watCompIdx = FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) ? diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index 4417f60935..e5cecf240c 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -208,7 +208,7 @@ namespace Opm const Well::ProductionControls& prod_controls, WellStateType& well_state, const GroupState& group_state, - DeferredLogger& deferred_logger, + DeferredLogger& deferred_logger, const bool fixed_control = false, const bool fixed_status = false) override; @@ -320,7 +320,7 @@ namespace Opm bool computeWellPotentialsImplicit(const Simulator& ebos_simulator, const WellStateType& well_state, std::vector& well_potentials, - DeferredLogger& deferred_logger) const; + DeferredLogger& deferred_logger) const; Scalar getRefDensity() const override; diff --git a/opm/simulators/wells/StandardWellEquations.hpp b/opm/simulators/wells/StandardWellEquations.hpp index 05ec7eeb02..39f1d1bf16 100644 --- a/opm/simulators/wells/StandardWellEquations.hpp +++ b/opm/simulators/wells/StandardWellEquations.hpp @@ -89,7 +89,7 @@ public: //! \brief Apply inverted D matrix to rhs and store in vector. void solve(const BVectorWell& rhs_well, BVectorWell& x_well) const; - + //! \brief Invert D matrix. void invert(); diff --git a/opm/simulators/wells/StandardWellEval.cpp b/opm/simulators/wells/StandardWellEval.cpp index 084940ad9f..f856b381d9 100644 --- a/opm/simulators/wells/StandardWellEval.cpp +++ b/opm/simulators/wells/StandardWellEval.cpp @@ -101,7 +101,7 @@ getWellConvergence(const WellState& well_state, const Scalar tol_wells, const Scalar relaxed_tolerance_flow, const bool relax_tolerance, - const bool well_is_stopped, + const bool well_is_stopped, std::vector& res, DeferredLogger& deferred_logger) const { @@ -152,7 +152,7 @@ getWellConvergence(const WellState& well_state, checkConvergenceControlEq(well_state, {1.e3, 1.e4, 1.e-4, 1.e-6, maxResidualAllowed}, std::abs(this->linSys_.residual()[0][Bhp]), - well_is_stopped, + well_is_stopped, report, deferred_logger); diff --git a/opm/simulators/wells/StandardWellEval.hpp b/opm/simulators/wells/StandardWellEval.hpp index f5c2372b8b..9985065157 100644 --- a/opm/simulators/wells/StandardWellEval.hpp +++ b/opm/simulators/wells/StandardWellEval.hpp @@ -84,7 +84,7 @@ protected: const Scalar tol_wells, const Scalar relaxed_tolerance_flow, const bool relax_tolerance, - const bool well_is_stopped, + const bool well_is_stopped, std::vector& res, DeferredLogger& deferred_logger) const; diff --git a/opm/simulators/wells/VFPHelpers.cpp b/opm/simulators/wells/VFPHelpers.cpp index 794821277c..1ad3abae9d 100644 --- a/opm/simulators/wells/VFPHelpers.cpp +++ b/opm/simulators/wells/VFPHelpers.cpp @@ -364,7 +364,7 @@ template Scalar VFPHelpers:: findTHP(const std::vector& bhp_array, const std::vector& thp_array, - Scalar bhp, + Scalar bhp, const bool find_largest) { int nthp = thp_array.size(); @@ -434,12 +434,12 @@ findTHP(const std::vector& bhp_array, } //bhp_array not sorted, raw search. else { - //Here we're into damage prevention territory, and there may be any number of + //Here we're into damage prevention territory, and there may be any number of //solutions (including zero). The well is currently not controlled by THP, and - //since we're doing severe extrapolaton we would also like, if possible, to prevent - //it from switcing to THP. Accordingly, if there are multiple solutions, we return - //the value for the intersection corresponding to the largest (smallest) THP-value - //for producers (injectors). + //since we're doing severe extrapolaton we would also like, if possible, to prevent + //it from switcing to THP. Accordingly, if there are multiple solutions, we return + //the value for the intersection corresponding to the largest (smallest) THP-value + //for producers (injectors). //first check which extrapolations are valid const bool first_slope_positive = bhp_array[1] >= bhp_array[0]; @@ -555,10 +555,10 @@ intersectWithIPR(const VFPProdTable& table, const std::function& adjust_bhp) { // Given fixed thp, wfr, gfr and alq, this function finds a stable (-flo, bhp)-intersection - // between the ipr-line and bhp(flo) from table, if such an intersection exists. For multiple + // between the ipr-line and bhp(flo) from table, if such an intersection exists. For multiple // stable intersections, the one corresponding the largest flo is returned as long as this intersection // lies within the tabulated values. If the ipr-line lies above all (flo, bhp) points, the intersection - // is determined by extrapolation based on the last two points. + // is determined by extrapolation based on the last two points. // The adjust_bhp-function is used to adjust the vfp-table bhp-values to actual bhp-values due // to vfp/well ref-depth differences and/or WVFPDP-related pressure adjustments. @@ -601,9 +601,9 @@ intersectWithIPR(const VFPProdTable& table, flo0 = flo1; y0 = y1; } else if (y1 < 0 && y0 < y1 && flo_x < 0) { // at last interval - // If y0 < y1 < 0, there is a stable intersection above the largest flo-value by - // extrapolation. If no previous stable intersections were found, i.e., ipr-line lies - // above all (flo, bhp) points, then we return this intersection. Otherwise, we don't + // If y0 < y1 < 0, there is a stable intersection above the largest flo-value by + // extrapolation. If no previous stable intersections were found, i.e., ipr-line lies + // above all (flo, bhp) points, then we return this intersection. Otherwise, we don't // trust it (avoid vfp-extrapolation whenever possible) Scalar w = -y0/(y1-y0); // w > 1.0 flo_x = flo0 + w*(flo1 - flo0); diff --git a/opm/simulators/wells/VFPHelpers.hpp b/opm/simulators/wells/VFPHelpers.hpp index a5418284d6..b0dfae5720 100644 --- a/opm/simulators/wells/VFPHelpers.hpp +++ b/opm/simulators/wells/VFPHelpers.hpp @@ -189,7 +189,7 @@ public: */ static Scalar findTHP(const std::vector& bhp_array, const std::vector& thp_array, - Scalar bhp, + Scalar bhp, const bool find_largest = true); /** diff --git a/opm/simulators/wells/VFPProdProperties.hpp b/opm/simulators/wells/VFPProdProperties.hpp index 5636aec566..e0c0510d54 100644 --- a/opm/simulators/wells/VFPProdProperties.hpp +++ b/opm/simulators/wells/VFPProdProperties.hpp @@ -143,7 +143,7 @@ public: } /** - * Returns minimum bhp for given thp, wfr, gfr and alq + * Returns minimum bhp for given thp, wfr, gfr and alq */ Scalar minimumBHP(const int table_id, const Scalar thp, const Scalar wfr, const Scalar gfr, const Scalar alq) const; diff --git a/opm/simulators/wells/WellAssemble.cpp b/opm/simulators/wells/WellAssemble.cpp index 1624fc8083..545f8932fe 100644 --- a/opm/simulators/wells/WellAssemble.cpp +++ b/opm/simulators/wells/WellAssemble.cpp @@ -169,12 +169,12 @@ assembleControlEqProd(const WellState& well_state, }; - WellGroupControls(well_).getGroupProductionControl(group, + WellGroupControls(well_).getGroupProductionControl(group, well_state, group_state, schedule, summaryState, - bhp, + bhp, active_rates, rCoeff, efficiencyFactor, diff --git a/opm/simulators/wells/WellBhpThpCalculator.cpp b/opm/simulators/wells/WellBhpThpCalculator.cpp index 04c3e5e167..80b34f6aba 100644 --- a/opm/simulators/wells/WellBhpThpCalculator.cpp +++ b/opm/simulators/wells/WellBhpThpCalculator.cpp @@ -416,15 +416,15 @@ calculateMinimumBhpFromThp(const WellState& well_state, assert(well_.isProducer()); // only producers can go here for now const Scalar thp_limit = well_.getTHPConstraint(summaryState); - + const auto& controls = well.productionControls(summaryState); const auto& wfr = well_.vfpProperties()->getExplicitWFR(controls.vfp_table_number, well_.indexOfWell()); const auto& gfr = well_.vfpProperties()->getExplicitGFR(controls.vfp_table_number, well_.indexOfWell()); const Scalar bhp_min = well_.vfpProperties()->getProd()->minimumBHP(controls.vfp_table_number, - thp_limit, wfr, gfr, + thp_limit, wfr, gfr, well_.getALQ(well_state)); - + const Scalar vfp_ref_depth = well_.vfpProperties()->getProd()->getTable(controls.vfp_table_number).getDatumDepth(); const auto bhp_adjustment = getVfpBhpAdjustment(bhp_min, thp_limit); const Scalar dp_hydro = wellhelpers::computeHydrostaticCorrection(well_.refDepth(), vfp_ref_depth, @@ -898,7 +898,7 @@ isStableSolution(const WellState& well_state, const SummaryState& summaryState) const { assert(int(rates.size()) == 3); // the vfp related only supports three phases now. - assert(well_.isProducer()); // only valid for producers + assert(well_.isProducer()); // only valid for producers static constexpr int Water = IndexTraits::waterPhaseIdx; static constexpr int Oil = IndexTraits::oilPhaseIdx; @@ -925,7 +925,7 @@ isStableSolution(const WellState& well_state, } else { // maybe check if ipr is available const auto ipr = getFloIPR(well_state, well, summaryState); return bhp.dflo + 1.0 / ipr.second >= 0; - } + } } template @@ -935,8 +935,8 @@ estimateStableBhp(const WellState& well_state, const std::vector& rates, const Scalar rho, const SummaryState& summaryState) const -{ - // Given a *converged* well_state with ipr, estimate bhp of the stable solution +{ + // Given a *converged* well_state with ipr, estimate bhp of the stable solution const auto& controls = well.productionControls(summaryState); const Scalar thp = well_.getTHPConstraint(summaryState); const auto& table = well_.vfpProperties()->getProd()->getTable(controls.vfp_table_number); @@ -950,12 +950,12 @@ estimateStableBhp(const WellState& well_state, wfr = well_.vfpProperties()->getExplicitWFR(controls.vfp_table_number, well_.indexOfWell()); gfr = well_.vfpProperties()->getExplicitGFR(controls.vfp_table_number, well_.indexOfWell()); } else { - wfr = detail::getWFR(table, aqua, liquid, vapour); - gfr = detail::getGFR(table, aqua, liquid, vapour); + wfr = detail::getWFR(table, aqua, liquid, vapour); + gfr = detail::getGFR(table, aqua, liquid, vapour); } auto ipr = getFloIPR(well_state, well, summaryState); - + const Scalar vfp_ref_depth = well_.vfpProperties()->getProd()->getTable(controls.vfp_table_number).getDatumDepth(); const Scalar dp_hydro = wellhelpers::computeHydrostaticCorrection(well_.refDepth(), vfp_ref_depth, @@ -978,10 +978,10 @@ estimateStableBhp(const WellState& well_state, template std::pair WellBhpThpCalculator:: getFloIPR(const WellState& well_state, - const Well& well, - const SummaryState& summary_state) const + const Well& well, + const SummaryState& summary_state) const { - // Convert ipr_a's and ipr_b's to our particular choice of FLO + // Convert ipr_a's and ipr_b's to our particular choice of FLO const auto& controls = well.productionControls(summary_state); const auto& table = well_.vfpProperties()->getProd()->getTable(controls.vfp_table_number); const auto& ipr_a = well_state.well(well_.indexOfWell()).implicit_ipr_a; @@ -1000,8 +1000,8 @@ getFloIPR(const WellState& well_state, const Scalar& vapour_b = pu.phaseIsActive(IndexTraits::gasPhaseIdx) ? ipr_b[pu.canonicalToActivePhaseIdx(IndexTraits::gasPhaseIdx)] : 0.0; // The getFlo helper is indended to pick one or add two of the phase rates (depending on FLO-type), - // but we can equally use it to pick/add the corresponding ipr_a, ipr_b - return std::make_pair(detail::getFlo(table, aqua_a, liquid_a, vapour_a), + // but we can equally use it to pick/add the corresponding ipr_a, ipr_b + return std::make_pair(detail::getFlo(table, aqua_a, liquid_a, vapour_a), detail::getFlo(table, aqua_b, liquid_b, vapour_b)); } @@ -1053,7 +1053,7 @@ bruteForceBracketCommonTHP(const std::function& eq, { bool bracket_found = false; constexpr int sample_number = 1000; - constexpr Scalar interval = 1E5; + constexpr Scalar interval = 1E5; Scalar eq_low = eq(min_thp); for (int i = 0; i < sample_number + 1; ++i) { max_thp = min_thp + interval * i; diff --git a/opm/simulators/wells/WellBhpThpCalculator.hpp b/opm/simulators/wells/WellBhpThpCalculator.hpp index 816d030d26..c28f0ecf50 100644 --- a/opm/simulators/wells/WellBhpThpCalculator.hpp +++ b/opm/simulators/wells/WellBhpThpCalculator.hpp @@ -103,18 +103,18 @@ public: bool isStableSolution(const WellState& well_state, const Well& well, const std::vector& rates, - const SummaryState& summaryState) const; + const SummaryState& summaryState) const; std::optional estimateStableBhp (const WellState& well_state, const Well& well, const std::vector& rates, const Scalar rho, - const SummaryState& summaryState) const; + const SummaryState& summaryState) const; std::pair getFloIPR(const WellState& well_state, - const Well& well, + const Well& well, const SummaryState& summary_state) const; //! \brief Find limits using brute-force solver. diff --git a/opm/simulators/wells/WellConvergence.cpp b/opm/simulators/wells/WellConvergence.cpp index 420d1a86a8..2b2956853a 100644 --- a/opm/simulators/wells/WellConvergence.cpp +++ b/opm/simulators/wells/WellConvergence.cpp @@ -39,7 +39,7 @@ void WellConvergence:: checkConvergenceControlEq(const WellState& well_state, const Tolerances& tolerances, const Scalar well_control_residual, - const bool well_is_stopped, + const bool well_is_stopped, ConvergenceReport& report, DeferredLogger& deferred_logger) const { diff --git a/opm/simulators/wells/WellConvergence.hpp b/opm/simulators/wells/WellConvergence.hpp index 98cc722c56..9d5d605257 100644 --- a/opm/simulators/wells/WellConvergence.hpp +++ b/opm/simulators/wells/WellConvergence.hpp @@ -53,7 +53,7 @@ public: void checkConvergenceControlEq(const WellState& well_state, const Tolerances& tolerances, const Scalar well_control_residual, - const bool well_is_stopped, + const bool well_is_stopped, ConvergenceReport& report, DeferredLogger& deferred_logger) const; diff --git a/opm/simulators/wells/WellGroupHelpers.cpp b/opm/simulators/wells/WellGroupHelpers.cpp index 2ec33a4628..6a9cfac629 100644 --- a/opm/simulators/wells/WellGroupHelpers.cpp +++ b/opm/simulators/wells/WellGroupHelpers.cpp @@ -1301,8 +1301,8 @@ updateGroupControlledWells(const Schedule& schedule, auto deferred_logger = Opm::DeferredLogger(); const auto& control_group_target = tcalc.groupTarget(ctrl, deferred_logger); - // Calculates the guide rate of the parent group with control. - // It is allowed that the guide rate of this group is defaulted. The guide rate will be derived from the children groups + // Calculates the guide rate of the parent group with control. + // It is allowed that the guide rate of this group is defaulted. The guide rate will be derived from the children groups const auto& control_group_guide_rate = getGuideRate(control_group_name, schedule, well_state, @@ -1649,10 +1649,10 @@ getWellGroupTargetProducer(const std::string& name, const std::vector& resv_coeff, DeferredLogger& deferred_logger) { - // This function computes a wells group target. + // This function computes a wells group target. // 'parent' will be the name of 'group'. But if we recurse, 'name' and // 'parent' will stay fixed while 'group' will be higher up - // in the group tree. + // in the group tree. // Eficiencyfactor is the well efficiency factor for the first group the well is // part of. Later it is the accumulated factor including the group efficiency factor // of the child of group. @@ -1749,7 +1749,7 @@ getWellGroupTargetProducer(const std::string& name, if (guideRate->has(chain[ii]) && num_gr_ctrl > 0) { local_reduction_level = ii; } - } + } // Compute portion of target corresponding to current_rate_available Scalar target = orig_target; for (std::size_t ii = 0; ii < num_ancestors; ++ii) { @@ -1927,7 +1927,7 @@ checkGroupConstraintsInj(const std::string& name, scale = group_target_rate_available / current_well_rate_available; } return std::make_pair(current_well_rate_available > group_target_rate_available, scale); - } + } std::optional ctrl; if (!group.has_gpmaint_control(injectionPhase, currentGroupControl)) @@ -1987,13 +1987,13 @@ getWellGroupTargetInjector(const std::string& name, const std::vector& resv_coeff, DeferredLogger& deferred_logger) { - // This function computes a wells group target. + // This function computes a wells group target. // 'parent' will be the name of 'group'. But if we recurse, 'name' and // 'parent' will stay fixed while 'group' will be higher up - // in the group tree. + // in the group tree. // Eficiencyfactor is the well efficiency factor for the first group the well is // part of. Later it is the accumulated factor including the group efficiency factor - // of the child of group. + // of the child of group. auto currentGroupControl = group_state.injection_control(group.name(), injectionPhase); if (currentGroupControl == Group::InjectionCMode::FLD || currentGroupControl == Group::InjectionCMode::NONE) { // Return if we are not available for parent group. @@ -2089,7 +2089,7 @@ getWellGroupTargetInjector(const std::string& name, if (guideRate->has(chain[ii], injectionPhase) && num_gr_ctrl > 0) { local_reduction_level = ii; } - } + } // Compute portion of target corresponding to current_rate_available Scalar target = orig_target; diff --git a/opm/simulators/wells/WellGroupHelpers.hpp b/opm/simulators/wells/WellGroupHelpers.hpp index 9b3cbb641b..dce1ad4803 100644 --- a/opm/simulators/wells/WellGroupHelpers.hpp +++ b/opm/simulators/wells/WellGroupHelpers.hpp @@ -294,7 +294,7 @@ public: const Schedule& schedule, const int report_step); - + // check if well/group bottom is a sub well/group of the group top static bool isInGroupChainTopBot(const std::string& bottom, diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index 89d59d3dbe..e6cc5d37f0 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -256,8 +256,8 @@ public: const Well::InjectionControls& inj_controls, const Well::ProductionControls& prod_controls, const Scalar WQTotal, - DeferredLogger& deferred_logger, - const bool fixed_control = false, + DeferredLogger& deferred_logger, + const bool fixed_control = false, const bool fixed_status = false); virtual void updatePrimaryVariables(const Simulator& simulator, @@ -361,7 +361,7 @@ public: const WellProductionControls& prod_controls, WellStateType& well_state, const GroupState& group_state, - DeferredLogger& deferred_logger, + DeferredLogger& deferred_logger, const bool fixed_control = false, const bool fixed_status = false) = 0; protected: @@ -417,7 +417,7 @@ protected: virtual void updateIPRImplicit(const Simulator& simulator, WellStateType& well_state, - DeferredLogger& deferred_logger) = 0; + DeferredLogger& deferred_logger) = 0; bool iterateWellEquations(const Simulator& simulator, const double dt, @@ -444,18 +444,18 @@ protected: const double dt, const Scalar bhp, WellStateType& well_state, - DeferredLogger& deferred_logger); + DeferredLogger& deferred_logger); bool solveWellWithZeroRate(const Simulator& simulator, const double dt, WellStateType& well_state, - DeferredLogger& deferred_logger); + DeferredLogger& deferred_logger); bool solveWellForTesting(const Simulator& simulator, WellStateType& well_state, const GroupState& group_state, DeferredLogger& deferred_logger); - + template std::unique_ptr initializeGliftWellTest_(const Simulator& simulator, diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index ca669be674..8e678f9e73 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -935,7 +935,7 @@ onlyKeepBHPandTHPcontrols(const SummaryState& summary_state, ws.injection_cmode = Well::InjectorCMode::BHP; ws.bhp = inj_controls.bhp_limit; } - } + } } else { // producer prod_controls.clearControls(); prod_controls.addControl(Well::ProducerCMode::BHP); @@ -950,8 +950,8 @@ onlyKeepBHPandTHPcontrols(const SummaryState& summary_state, ws.production_cmode = Well::ProducerCMode::BHP; ws.bhp = prod_controls.bhp_limit; } - } - } + } + } } diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index a34ba1749b..06d9493607 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -278,8 +278,8 @@ namespace Opm const Well::InjectionControls& inj_controls, const Well::ProductionControls& prod_controls, const Scalar wqTotal, - DeferredLogger& deferred_logger, - const bool fixed_control, + DeferredLogger& deferred_logger, + const bool fixed_control, const bool fixed_status) { OPM_TIMEFUNCTION(); @@ -306,13 +306,13 @@ namespace Opm } else { bool changed = false; if (!fixed_control) { - // Changing to group controls here may lead to inconsistencies in the group handling which in turn + // Changing to group controls here may lead to inconsistencies in the group handling which in turn // may result in excessive back and forth switching. However, we currently allow this by default. // The switch check_group_constraints_inner_well_iterations_ is a temporary solution. - + const bool hasGroupControl = this->isInjector() ? inj_controls.hasControl(Well::InjectorCMode::GRUP) : prod_controls.hasControl(Well::ProducerCMode::GRUP); - bool isGroupControl = ws.production_cmode == Well::ProducerCMode::GRUP || ws.injection_cmode == Well::InjectorCMode::GRUP; + bool isGroupControl = ws.production_cmode == Well::ProducerCMode::GRUP || ws.injection_cmode == Well::InjectorCMode::GRUP; if (! (isGroupControl && !this->param_.check_group_constraints_inner_well_iterations_)) { changed = this->checkIndividualConstraints(ws, summary_state, deferred_logger, inj_controls, prod_controls); } @@ -414,8 +414,8 @@ namespace Opm const auto report_step = simulator.episodeIndex(); const auto& glo = schedule.glo(report_step); if (glo.active()) { - gliftBeginTimeStepWellTestUpdateALQ(simulator, - well_state_copy, + gliftBeginTimeStepWellTestUpdateALQ(simulator, + well_state_copy, group_state, ecl_well_map, deferred_logger); @@ -946,9 +946,9 @@ namespace Opm if (converged) { const bool zero_target = this->wellUnderZeroRateTarget(simulator, well_state, deferred_logger); if (this->wellIsStopped() && !zero_target && nonzero_rate_original) { - // Well had non-zero rate, but was stopped during local well-solve. We re-open the well + // Well had non-zero rate, but was stopped during local well-solve. We re-open the well // for the next global iteration, but if the zero rate persists, it will be stopped. - // This logic is introduced to prevent/ameliorate stopped/revived oscillations + // This logic is introduced to prevent/ameliorate stopped/revived oscillations this->operability_status_.resetOperability(); this->openWell(); deferred_logger.debug(" " + this->name() + " is re-opened after being stopped during local solve"); @@ -1109,9 +1109,9 @@ namespace Opm if (!gl_well.use_glo()) { msg = fmt::format( "GLIFT WTEST: Well {} : Gas lift optimization deactivated. Setting ALQ to WLIFTOPT item 3 = {}", - well_name, + well_name, unit_system.from_si(UnitSystem::measure::gas_surface_rate, well_state.well(well_name).alq_state.get())); - + } else { msg = fmt::format( @@ -2132,7 +2132,7 @@ namespace Opm template template - std::unique_ptr + std::unique_ptr WellInterface:: initializeGliftWellTest_(const Simulator& simulator, WellStateType& well_state, @@ -2159,17 +2159,17 @@ namespace Opm // Return GasLiftSingleWell object to use the wellTestALQ() function std::set sync_groups; const auto& summary_state = simulator.vanguard().summaryState(); - return std::make_unique(*this, - simulator, + return std::make_unique(*this, + simulator, summary_state, - deferred_logger, - well_state, + deferred_logger, + well_state, group_state, - group_info, - sync_groups, - comm, + group_info, + sync_groups, + comm, false); - + } } // namespace Opm diff --git a/python/README.md b/python/README.md index f24462fba3..9a20634c0e 100644 --- a/python/README.md +++ b/python/README.md @@ -59,4 +59,4 @@ poro = poro *.95 sim.set_porosity(poro) sim.step() sim.step_cleanup() -``` \ No newline at end of file +``` diff --git a/python/docker/test_wheels/dockerfiles/common/setup_apt.sh b/python/docker/test_wheels/dockerfiles/common/setup_apt.sh index 83d1057c3f..3260a98dd9 100755 --- a/python/docker/test_wheels/dockerfiles/common/setup_apt.sh +++ b/python/docker/test_wheels/dockerfiles/common/setup_apt.sh @@ -24,4 +24,3 @@ apt-get install -y --no-install-recommends \ tk-dev libffi-dev liblzma-dev rm -rf /var/lib/apt/lists/* - diff --git a/python/docker/test_wheels/scripts/src/opm_wheels/config_reader.py b/python/docker/test_wheels/scripts/src/opm_wheels/config_reader.py index afcb1aabb7..9e505138f0 100644 --- a/python/docker/test_wheels/scripts/src/opm_wheels/config_reader.py +++ b/python/docker/test_wheels/scripts/src/opm_wheels/config_reader.py @@ -21,7 +21,7 @@ def get_config_path() -> Path: config_path = repo_root / "python/docker/python_versions.json" if config_path.exists(): return config_path - + raise FileNotFoundError( "Could not locate python_versions.json. Either run from within " "opm-simulators repository or set OPM_SIMULATORS_ROOT environment variable." @@ -53,4 +53,4 @@ def get_default_versions() -> List[str]: def get_python_version_objects() -> List[PythonVersion]: """Get PythonVersion objects for all default versions.""" default_versions = get_default_versions() - return [PythonVersion.from_str(version) for version in default_versions] \ No newline at end of file + return [PythonVersion.from_str(version) for version in default_versions] diff --git a/python/simulators/CMakeLists.txt b/python/simulators/CMakeLists.txt index 937d6dcda5..ceea5a4efa 100644 --- a/python/simulators/CMakeLists.txt +++ b/python/simulators/CMakeLists.txt @@ -162,5 +162,3 @@ configure_file(${PROJECT_SOURCE_DIR}/python/setup.py.in ${PROJECT_BINARY_DIR}/python/setup.py.tmp @ONLY) file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/python/setup.py INPUT ${PROJECT_BINARY_DIR}/python/setup.py.tmp) - - diff --git a/python/simulators/PyBlackOilSimulator.cpp b/python/simulators/PyBlackOilSimulator.cpp index 1131372581..848fb0f9e0 100644 --- a/python/simulators/PyBlackOilSimulator.cpp +++ b/python/simulators/PyBlackOilSimulator.cpp @@ -106,4 +106,3 @@ PYBIND11_MODULE(BlackOil, m) } } // namespace Opm::Pybind - diff --git a/python/simulators/PyGasWaterSimulator.cpp b/python/simulators/PyGasWaterSimulator.cpp index 0251787ac6..2102df7858 100644 --- a/python/simulators/PyGasWaterSimulator.cpp +++ b/python/simulators/PyGasWaterSimulator.cpp @@ -133,4 +133,3 @@ PYBIND11_MODULE(GasWater, m) } } // namespace Opm::Pybind - diff --git a/python/simulators/PyOnePhaseSimulator.cpp b/python/simulators/PyOnePhaseSimulator.cpp index 51c09bacb7..32d3131c02 100644 --- a/python/simulators/PyOnePhaseSimulator.cpp +++ b/python/simulators/PyOnePhaseSimulator.cpp @@ -28,7 +28,7 @@ #include namespace Opm::Properties { - + //! The indices required by the model template struct Indices diff --git a/python/test/pytest_common.py b/python/test/pytest_common.py index 7a8f14be7d..0de03dd69b 100644 --- a/python/test/pytest_common.py +++ b/python/test/pytest_common.py @@ -76,4 +76,3 @@ def create_onephase_simulator(*args, **kwargs): kwargs['args'].append(flag_to_add) return OnePhaseSimulator(*args, **kwargs) - diff --git a/python/test/test_basic.py b/python/test/test_basic.py index aa13c098af..a890409daa 100755 --- a/python/test/test_basic.py +++ b/python/test/test_basic.py @@ -33,7 +33,7 @@ class TestBasic(unittest.TestCase): self.assertAlmostEqual(dt, 86400., places=7, msg='value of timestep') vol = sim.get_cell_volumes() self.assertEqual(len(vol), 300, 'length of volume vector') - # NOTE: The volume should be 1000 ft x 1000 ft x 20 ft * 0.3 (porosity) + # NOTE: The volume should be 1000 ft x 1000 ft x 20 ft * 0.3 (porosity) # = 600000 ft^3 = 566336.93 m^3 self.assertAlmostEqual(vol[0], 566336.93, places=2, msg='value of volume') poro = sim.get_porosity() @@ -44,7 +44,7 @@ class TestBasic(unittest.TestCase): sim.step() poro2 = sim.get_porosity() self.assertAlmostEqual(poro2[0], 0.285, places=7, msg='value of porosity 2') - + def test_02_onephase(self): with pushd(self.data_dir_op): sim = create_onephase_simulator(args=['--linear-solver=ilu0'], filename="SPE1CASE1_WATER.DATA") @@ -85,6 +85,3 @@ class TestBasic(unittest.TestCase): sim.step() poro2 = sim.get_porosity() self.assertAlmostEqual(poro2[0], 0.285, places=7, msg='value of porosity 2') - - - diff --git a/python/test/test_throw.py b/python/test/test_throw.py index 779bb3a83e..e8ef4f8e47 100644 --- a/python/test/test_throw.py +++ b/python/test/test_throw.py @@ -16,4 +16,3 @@ class TestBasic(unittest.TestCase): # has not been initialized with self.assertRaises(RuntimeError): sim.get_dt() - diff --git a/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp b/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp index f53b579962..4e30406d46 100644 --- a/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp +++ b/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(TestProject) auto xGPU = Opm::gpuistl::GpuVector(xCPU); auto gpuComm = std::make_shared>>(ownerOverlapCopy); - + auto GpuOwnerOverlapCopy = Opm::gpuistl::GpuOwnerOverlapCopy>(gpuComm); diff --git a/tests/models/test_tasklets.cpp b/tests/models/test_tasklets.cpp index 3fea8c2633..1171585068 100644 --- a/tests/models/test_tasklets.cpp +++ b/tests/models/test_tasklets.cpp @@ -98,4 +98,3 @@ int main() return 0; } - diff --git a/tests/not-unit/test_ad.cpp b/tests/not-unit/test_ad.cpp index e19c43ca86..a53e927026 100644 --- a/tests/not-unit/test_ad.cpp +++ b/tests/not-unit/test_ad.cpp @@ -74,4 +74,3 @@ catch (const std::exception &e) { std::cerr << "Program threw an exception: " << e.what() << "\n"; throw; } - diff --git a/tests/run-init-regressionTest.sh b/tests/run-init-regressionTest.sh index d72e6fa3f5..acb1e422f2 100755 --- a/tests/run-init-regressionTest.sh +++ b/tests/run-init-regressionTest.sh @@ -33,7 +33,7 @@ do t) REL_TOL=${OPTARG} ;; c) COMPARE_ECL_COMMAND=${OPTARG} ;; e) EXE_NAME=${OPTARG} ;; - d) ;; # Ignored + d) ;; # Ignored h) ;; # Ignored# esac done diff --git a/tests/run-parallel-unitTest.sh b/tests/run-parallel-unitTest.sh index 51192a2552..fae3835507 100755 --- a/tests/run-parallel-unitTest.sh +++ b/tests/run-parallel-unitTest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # This executes a unit test in parallel. if test $# -eq 0 diff --git a/tests/run-vtu-test.sh b/tests/run-vtu-test.sh index eaee9f5116..6225bec82a 100755 --- a/tests/run-vtu-test.sh +++ b/tests/run-vtu-test.sh @@ -199,8 +199,8 @@ case "$TEST_TYPE" in fi cat > "paramfile-$RND.ini" <, Vector, bz>& bridge, Matrix Dune::BlockVector> diff --git a/tests/test_dilu.cpp b/tests/test_dilu.cpp index d5a3e9b9c0..22f572adc6 100644 --- a/tests/test_dilu.cpp +++ b/tests/test_dilu.cpp @@ -257,7 +257,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrectNoZeros, T, NumericTypes) // x_k+1 = x_k + z Vector new_x = x; new_x += z; - + Dune::MultithreadDILU seqdilu(A); seqdilu.apply(x, b); @@ -362,7 +362,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrect1, T, NumericTypes) // x_k+1 = x_k + z Vector new_x = x; new_x += z; - + Dune::MultithreadDILU seqdilu(A); seqdilu.apply(x, b); @@ -461,7 +461,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrect2, T, NumericTypes) // x_k+1 = x_k + z Vector new_x = x; new_x += z; - + Dune::MultithreadDILU seqdilu(A); seqdilu.apply(x, b); @@ -765,7 +765,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrect3, T, NumericTypes) // x_k+1 = x_k + z Vector new_x = x; new_x += z; - + Dune::MultithreadDILU seqdilu(A); seqdilu.apply(x, b); diff --git a/tests/test_equil.cpp b/tests/test_equil.cpp index 334e4b6964..ac3e9582de 100644 --- a/tests/test_equil.cpp +++ b/tests/test_equil.cpp @@ -565,7 +565,7 @@ BOOST_AUTO_TEST_CASE(DeckAllDead) Opm::GridManager gm(eclipseState.getInputGrid()); const UnstructuredGrid& grid = *(gm.c_grid()); EquilFixture::Initializer comp(*simulator->problem().materialLawManager(), - eclipseState, + eclipseState, simulator->vanguard().grid(), simulator->vanguard().gridView(), simulator->vanguard().cartesianMapper(), 10.0); @@ -644,7 +644,7 @@ BOOST_AUTO_TEST_CASE(DeckWithCapillary) const UnstructuredGrid& grid = *(gm.c_grid()); EquilFixture::Initializer comp(*simulator->problem().materialLawManager(), - eclipseState, + eclipseState, simulator->vanguard().grid(), simulator->vanguard().gridView(), simulator->vanguard().cartesianMapper(), 10.0); @@ -963,13 +963,13 @@ BOOST_AUTO_TEST_CASE(DeckWithHumidWetGas) const int first = 0, last = grid.number_of_cells - 1; const double reltol = 1.0e-2; - BOOST_CHECK_CLOSE(pressures[FluidSystem::waterPhaseIdx][first], 1.480599988e7, reltol); + BOOST_CHECK_CLOSE(pressures[FluidSystem::waterPhaseIdx][first], 1.480599988e7, reltol); BOOST_CHECK_CLOSE(pressures[FluidSystem::waterPhaseIdx][last], 1.549297524e7, reltol); BOOST_CHECK_CLOSE(pressures[FluidSystem::oilPhaseIdx][first], 1.489599988e7, reltol); BOOST_CHECK_CLOSE(pressures[FluidSystem::oilPhaseIdx][last], 1.550297524e7, reltol); const auto& sats = comp.saturation(); - std::vector s_opm[3]; + std::vector s_opm[3]; s_opm[FluidSystem::waterPhaseIdx] = { 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.35838026, 0.64069098, 0.9154626, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; s_opm[FluidSystem::oilPhaseIdx] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02738364, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; s_opm[FluidSystem::gasPhaseIdx] = { 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.64161973, 0.359309012, 0.057153701, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -982,7 +982,7 @@ BOOST_AUTO_TEST_CASE(DeckWithHumidWetGas) } const auto& rv = comp.rv(); - const std::vector rv_opm { + const std::vector rv_opm { 0.00024837999651755729, 0.00024869285236692635, 0.00024900604366769004, 0.00024931957094322978, 0.00024963343471801471, 0.00024994763551760586, 0.00025026217386865733, 0.00025057705029892072, 0.00025089226533724643, 0.00025120780158539152, 0.00025105, 0.00025105, @@ -990,7 +990,7 @@ BOOST_AUTO_TEST_CASE(DeckWithHumidWetGas) 0.00025105, 0.00025105, 0.00025105, 0.00025105}; const auto& rvw = comp.rvw(); - const std::vector rvw_opm { + const std::vector rvw_opm { 0.00024837999651755729, 0.00024869285236692635, 0.00024900604366769004, 0.00024931957094322978, 0.00024963343471801471, 0.00024994763551760586, 0.00025026217386865733, 0.00025057705029892072, 0.00025089226533724643, 0.00025120780158539152, 0.00025236969680655122, 0.00025384953117447344, @@ -1220,13 +1220,13 @@ BOOST_AUTO_TEST_CASE(DeckWithRSVDAndRVVDAndRVWVD) const int first = 0, last = grid.number_of_cells - 1; const double reltol = 1.0e-2; - BOOST_CHECK_CLOSE(pressures[FluidSystem::waterPhaseIdx][first], 1.483359963e7, reltol); + BOOST_CHECK_CLOSE(pressures[FluidSystem::waterPhaseIdx][first], 1.483359963e7, reltol); BOOST_CHECK_CLOSE(pressures[FluidSystem::waterPhaseIdx][last], 1.549297524e7, reltol); BOOST_CHECK_CLOSE(pressures[FluidSystem::oilPhaseIdx][first], 1.492359963e7, reltol); BOOST_CHECK_CLOSE(pressures[FluidSystem::oilPhaseIdx][last], 1.550297524e7, reltol); const auto& sats = comp.saturation(); - std::vector s_opm[3]; + std::vector s_opm[3]; s_opm[FluidSystem::waterPhaseIdx] = { 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.32527877578987319, 0.62976875867666171, 0.918795223850500588, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; s_opm[FluidSystem::oilPhaseIdx] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.054786199472198836, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; s_opm[FluidSystem::gasPhaseIdx] = { 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.674721224210102681, 0.37023124132333829, 0.026418562022795279, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1242,13 +1242,13 @@ BOOST_AUTO_TEST_CASE(DeckWithRSVDAndRVVDAndRVWVD) const auto& rs = comp.rs(); const std::vector rs_opm { // opm 74.617998198796087,74.652774471604374, 74.687905898686935, 74.723393674854691, - 74.759238999357947, 74.795443075905553, 74.832007112684167, 74.892422092838459, - 74.986801564438935, 75.088917653469338, 52.5, 57.5, + 74.759238999357947, 74.795443075905553, 74.832007112684167, 74.892422092838459, + 74.986801564438935, 75.088917653469338, 52.5, 57.5, 62.5, 67.5, 72.5, 76.528193441026076, 76.774856836636729, 77.021525099679991, 77.268198230347295, 77.514876228830232}; const auto& rv = comp.rv(); - const std::vector rv_opm { + const std::vector rv_opm { 2.5000000000000002e-06, 7.5000000000000002e-06, 1.2500000000000001e-05, 1.7500000000000002e-05, 2.2500000000000001e-05, 2.7500000000000004e-05, 3.2500000000000004e-05, 3.7500000000000003e-05, 4.2500000000000003e-05, 0.00025116322680309166, 5.2500000000000002e-05, 5.7500000000000002e-05, @@ -1256,7 +1256,7 @@ BOOST_AUTO_TEST_CASE(DeckWithRSVDAndRVVDAndRVWVD) 8.25e-05, 8.7500000000000013e-05, 9.2500000000000012e-05, 9.7499999999999998e-05}; const auto& rvw = comp.rvw(); - const std::vector rvw_opm { + const std::vector rvw_opm { 0.00024920798919277656, 0.00024941664682962629, 0.00024962743539212165, 0.00024984036204912818, 0.00025005543399614773, 0.00025027265845543336, 0.000250492042676105, 0.00025071359393426718, 0.00025093731953312241, 0.00025116322680309166, 0.00025236969680655122, 0.00025384953117447344, diff --git a/tests/test_extractMatrix.cpp b/tests/test_extractMatrix.cpp index 1cfe8dbdbe..29ee8fe408 100644 --- a/tests/test_extractMatrix.cpp +++ b/tests/test_extractMatrix.cpp @@ -34,7 +34,7 @@ using V = Dune::BlockVector>; M build3x3BlockMatrix() { // Build matrix with this pattern: - // ( x ) + // ( x ) // ( x ) // ( x x ) M res(3, 3, 4, M::row_wise); diff --git a/tests/test_ghostlastmatrixadapter.cpp b/tests/test_ghostlastmatrixadapter.cpp index 686623aa3b..7ce57068c7 100644 --- a/tests/test_ghostlastmatrixadapter.cpp +++ b/tests/test_ghostlastmatrixadapter.cpp @@ -297,7 +297,7 @@ int main(int argc, char** argv) auto fullPreconditioner = Opm::PreconditionerFactory::create(op, prm, weights, comm); Dune::BiCGSTABSolver amgBiCGSTAB(op, sp, *fullPreconditioner, 10e-8, 300, (ccomm.rank()==0) ? 2 : 0); - + using PreconditionerOperatorType = Opm::GhostLastMatrixAdapter; auto ghostOperator = std::make_unique(mat, comm); auto ghostPreconditioner = Opm::PreconditionerFactory::create(*ghostOperator, prm, weights, comm); @@ -328,4 +328,4 @@ int main(int argc, char** argv) std::cout << "Ghost preconditioner took " << timeGhost << std::endl; } return 0; -} \ No newline at end of file +} diff --git a/tests/test_glift1.cpp b/tests/test_glift1.cpp index fa1a96dc43..63b115c255 100644 --- a/tests/test_glift1.cpp +++ b/tests/test_glift1.cpp @@ -211,4 +211,3 @@ BOOST_AUTO_TEST_CASE(G1) BOOST_CHECK_CLOSE(state->alq(), 0.0, 1e-8); BOOST_CHECK(!state->increase().has_value()); } - diff --git a/tests/test_milu.cpp b/tests/test_milu.cpp index 83a9e2d0a9..53159c6e75 100644 --- a/tests/test_milu.cpp +++ b/tests/test_milu.cpp @@ -26,7 +26,7 @@ template void test_milu0(M& A) { auto ILU = A; - + std::shared_ptr> diagonal = nullptr; diagonal.reset(new std::vector()); @@ -47,7 +47,7 @@ void test_milu0(M& A) A.mv(e, x1); // Compute L*U*e; // t=Ue - + for ( auto irow = ILU.begin(), iend = ILU.end(); irow != iend; ++irow) { auto i = irow.index(); @@ -65,7 +65,7 @@ void test_milu0(M& A) col->umv(e[0], t[i]); } } - + for ( auto irow = ILU.begin(), iend = ILU.end(); irow != iend; ++irow) { auto i = irow.index(); @@ -154,9 +154,9 @@ void setupLaplacian(Dune::BCRSMatrix& A, int N) for (typename Dune::BCRSMatrix::RowIterator i = A.begin(); i != A.end(); ++i) { int x = i.index()%N; // x coordinate in the 2d field int y = i.index()/N; // y coordinate in the 2d field - + i->operator[](i.index())=diagonal; - + if(y>0) i->operator[](i.index()-N)=bone; diff --git a/tests/test_outputdir.cpp b/tests/test_outputdir.cpp index d0bf0d466b..ce267d6560 100644 --- a/tests/test_outputdir.cpp +++ b/tests/test_outputdir.cpp @@ -105,7 +105,7 @@ BOOST_FIXTURE_TEST_CASE(WithOutputDir, Fixture) const std::string output_dbg_path = (Case.second / "INPUT.DBG"); if (createFaultyFileWithDirectory) { std::filesystem::create_directories(Case.second); - // Create file with faulty content + // Create file with faulty content std::string dummy = R"(dummy)"; std::ofstream of(output_dbg_path); of << dummy << std::endl; @@ -120,7 +120,7 @@ BOOST_FIXTURE_TEST_CASE(WithOutputDir, Fixture) Opm::Main main(3, const_cast(no_param), false); BOOST_CHECK_EQUAL(main.justInitialize(), EXIT_SUCCESS); - // Check if the files have been created at the right spot + // Check if the files have been created at the right spot BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.PRT")); BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.DBG")); BOOST_CHECK(!std::filesystem::exists(Case.first / "INPUT.PRT")); @@ -128,7 +128,7 @@ BOOST_FIXTURE_TEST_CASE(WithOutputDir, Fixture) BOOST_CHECK(std::filesystem::exists(Case.second / "INPUT.PRT")); BOOST_CHECK(std::filesystem::exists(output_dbg_path)); - // Check if the file with the faulty content has been removed and replaced by a valid one + // Check if the file with the faulty content has been removed and replaced by a valid one std::ifstream file(output_dbg_path); std::string line; std::getline(file, line); @@ -146,7 +146,7 @@ BOOST_FIXTURE_TEST_CASE(NoOutputDir, Fixture) const std::string input_file_path = (Case / "INPUT.DATA"); const std::string output_dbg_path = (Case / "INPUT.DBG"); - // Create file with faulty content + // Create file with faulty content std::string dummy = R"(dummy)"; std::ofstream of(output_dbg_path); of << dummy << std::endl; @@ -159,13 +159,13 @@ BOOST_FIXTURE_TEST_CASE(NoOutputDir, Fixture) Opm::Main main(2, const_cast(no_param), false); BOOST_CHECK_EQUAL(main.justInitialize(), EXIT_SUCCESS); - // Check if the files have been created at the right spot + // Check if the files have been created at the right spot BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.PRT")); BOOST_CHECK(!std::filesystem::exists(input_path / "INPUT.DBG")); BOOST_CHECK(std::filesystem::exists(Case/ "INPUT.PRT")); BOOST_CHECK(std::filesystem::exists(output_dbg_path)); - // Check if the file with the faulty content has been removed and replaced by a valid one + // Check if the file with the faulty content has been removed and replaced by a valid one std::ifstream file(output_dbg_path); std::string line; std::getline(file, line); diff --git a/tests/test_partitionCells.cpp b/tests/test_partitionCells.cpp index 3dfb6ec8ba..bc1f571890 100644 --- a/tests/test_partitionCells.cpp +++ b/tests/test_partitionCells.cpp @@ -78,7 +78,7 @@ namespace { return wells; } - Dune::CpGrid createTestGrid(const std::array& dims, + Dune::CpGrid createTestGrid(const std::array& dims, const std::array& size) { Dune::CpGrid grid; grid.createCartesian(dims, size); diff --git a/tests/test_stoppedwells.cpp b/tests/test_stoppedwells.cpp index 3859397a08..92d5383e0b 100644 --- a/tests/test_stoppedwells.cpp +++ b/tests/test_stoppedwells.cpp @@ -1,6 +1,6 @@ /* Copyright 2014 IRIS - + This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify diff --git a/tests/test_tuning_TSINIT_NEXTSTEP.cpp b/tests/test_tuning_TSINIT_NEXTSTEP.cpp index 8ad9849787..2bba3c1e74 100644 --- a/tests/test_tuning_TSINIT_NEXTSTEP.cpp +++ b/tests/test_tuning_TSINIT_NEXTSTEP.cpp @@ -23,27 +23,26 @@ BOOST_AUTO_TEST_CASE(CheckTSINITAndNEXTSTEP) Opm::EclIO::ESmry smry(case_name, false); smry.loadData({"TIME"}); const auto& time = smry.get("TIME"); - + // First time step 1 day BOOST_CHECK_CLOSE(time[0], 1.0, TOLERANCE); for (size_t i=0; i 15.1); // Persistent NEXTSTEP=0.5 if (is_close(time[i], 31.0)) BOOST_CHECK_CLOSE(time[i+1], 31.5, TOLERANCE); if (is_close(time[i], 45.0)) BOOST_CHECK_CLOSE(time[i+1], 45.5, TOLERANCE); // Non-persistent NEXTSTEP=1.0 if (is_close(time[i], 60.0)) BOOST_CHECK_CLOSE(time[i+1], 61.0, TOLERANCE); - if (is_close(time[i], 74.0)) BOOST_CHECK(time[i+1] > 75.1); + if (is_close(time[i], 74.0)) BOOST_CHECK(time[i+1] > 75.1); // TSINIT=0.5 if (is_close(time[i], 91.0)) BOOST_CHECK_CLOSE(time[i+1], 91.5, TOLERANCE); if (is_close(time[i], 105.0)) BOOST_CHECK(time[i+1] > 105.6); - } + } } - diff --git a/tests/test_vfpproperties.cpp b/tests/test_vfpproperties.cpp index 6de407e7f8..d6c167129d 100644 --- a/tests/test_vfpproperties.cpp +++ b/tests/test_vfpproperties.cpp @@ -753,5 +753,3 @@ const double reference[] = { }; BOOST_AUTO_TEST_SUITE_END() // Integration tests// - - diff --git a/tests/test_wellmodel.cpp b/tests/test_wellmodel.cpp index 95014a5589..157f9fe824 100644 --- a/tests/test_wellmodel.cpp +++ b/tests/test_wellmodel.cpp @@ -193,6 +193,6 @@ BOOST_AUTO_TEST_CASE(TestBehavoir) { BOOST_CHECK_EQUAL(well->name(), "INJE1"); BOOST_CHECK(well->isInjector()); BOOST_CHECK(StandardWell::Indices::numEq == 3); - BOOST_CHECK(well->numStaticWellEq== 4); + BOOST_CHECK(well->numStaticWellEq== 4); } } diff --git a/tests/test_wellprodindexcalculator.cpp b/tests/test_wellprodindexcalculator.cpp index c363ef20cc..7798109a0a 100644 --- a/tests/test_wellprodindexcalculator.cpp +++ b/tests/test_wellprodindexcalculator.cpp @@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(logarithmic_skin421_DifferentCF) 1.5 * 1.0 * expectCF, (8.0 / 3.0) * 2.0 * expectCF, }; - + const auto connPI = connectionProdIndStandard(wpiCalc, connMobility); BOOST_CHECK_CLOSE(connPI[0], expectPI[0], 1.0e-10); BOOST_CHECK_CLOSE(connPI[1], expectPI[1], 1.0e-10);