Skip to content

Commit 4079d26

Browse files
committed
Preserve flash diagnostics on non-root MPI ranks
Enable Flow's existing per-rank debug logging and merger whenever flash diagnostics are requested. Document where flash verbosity is written and apply the project formatting to the diagnostic output.
1 parent 4306831 commit 4079d26

4 files changed

Lines changed: 31 additions & 11 deletions

File tree

opm/models/ptflash/flashintensivequantities.hh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,17 @@ public:
202202
if (flashVerbosity >= 5) {
203203
std::string phaseCompositions;
204204
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
205-
fmt::format_to(std::back_inserter(phaseCompositions),
206-
" component {}: x = {}, y = {}\n",
207-
compIdx,
208-
getValue(fluidState_.moleFraction(FluidSystem::oilPhaseIdx, compIdx)),
209-
getValue(fluidState_.moleFraction(FluidSystem::gasPhaseIdx, compIdx)));
205+
fmt::format_to(
206+
std::back_inserter(phaseCompositions),
207+
" component {}: x = {}, y = {}\n",
208+
compIdx,
209+
getValue(fluidState_.moleFraction(FluidSystem::oilPhaseIdx, compIdx)),
210+
getValue(fluidState_.moleFraction(FluidSystem::gasPhaseIdx, compIdx)));
210211
}
211212
OpmLog::debug(fmt::format("After the flash for cell {}: liquid fraction = {}\n{}",
212213
elemCtx.globalSpaceIndex(dofIdx, timeIdx),
213-
getValue(fluidState_.L()), phaseCompositions));
214+
getValue(fluidState_.L()),
215+
phaseCompositions));
214216
}
215217

216218
// Update phases
@@ -256,7 +258,10 @@ public:
256258
"oil saturation = {}, gas saturation = {}, "
257259
"oil molar volume = {}, gas molar volume = {}",
258260
elemCtx.globalSpaceIndex(dofIdx, timeIdx),
259-
getValue(So), getValue(Sg), getValue(Vm_L), getValue(Vm_V)));
261+
getValue(So),
262+
getValue(Sg),
263+
getValue(Vm_L),
264+
getValue(Vm_V)));
260265
}
261266

262267
/////////////

opm/models/ptflash/flashmodel.hh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ public:
233233
Parameters::Register<Parameters::FlashTolerance<Scalar>>
234234
("The maximum tolerance for the flash solver to "
235235
"consider the solution converged");
236-
Parameters::Register<Parameters::FlashVerbosity>
237-
("Flash solver verbosity level");
236+
Parameters::Register<Parameters::FlashVerbosity>(
237+
"Flash solver verbosity level. Messages are written to the debug log and require "
238+
"--debug-verbosity-level to be at least 1");
238239
Parameters::Register<Parameters::FlashTwoPhaseMethod>
239240
("Method for solving vapor-liquid composition. Available options include: "
240241
"ssi, newton, ssi+newton");

opm/simulators/flow/FlowMain.hpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <opm/input/eclipse/EclipseState/IOConfig/IOConfig.hpp>
2727
#include <opm/input/eclipse/EclipseState/InitConfig/InitConfig.hpp>
2828

29+
#include <opm/models/ptflash/flashparameters.hh>
2930
#include <opm/models/utils/start.hh>
3031

3132
#include <opm/simulators/flow/Banners.hpp>
@@ -63,6 +64,19 @@ namespace Opm {
6364

6465
class Deck;
6566

67+
namespace detail
68+
{
69+
70+
inline bool allRanksDebugLoggingEnabled()
71+
{
72+
// FlashVerbosity is only registered by compositional models.
73+
return Parameters::Get<Parameters::EnableLoggingFalloutWarning>()
74+
|| (Parameters::IsSet<Parameters::FlashVerbosity>(false)
75+
&& (Parameters::Get<Parameters::FlashVerbosity>() > 0));
76+
}
77+
78+
} // namespace detail
79+
6680
// The FlowMain class is the standard fully implicit flow simulator.
6781
template <class TypeTag>
6882
class FlowMain
@@ -356,7 +370,7 @@ namespace Opm {
356370

357371
detail::mergeParallelLogFiles(eclState().getIOConfig().getOutputDir(),
358372
Parameters::Get<Parameters::EclDeckFileName>(),
359-
Parameters::Get<Parameters::EnableLoggingFalloutWarning>());
373+
detail::allRanksDebugLoggingEnabled());
360374
}
361375

362376
void setupModelSimulator()

opm/simulators/flow/Main.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class Main
319319
outputDir,
320320
Parameters::Get<Parameters::OutputMode>(),
321321
!Parameters::Get<Parameters::SchedRestart>(),
322-
Parameters::Get<Parameters::EnableLoggingFalloutWarning>(),
322+
detail::allRanksDebugLoggingEnabled(),
323323
Parameters::Get<Parameters::ParsingStrictness>(),
324324
Parameters::Get<Parameters::ActionParsingStrictness>(),
325325
Parameters::Get<Parameters::InputSkipMode>(),

0 commit comments

Comments
 (0)