|
31 | 31 | #include <dune/common/fmatrix.hh> |
32 | 32 | #include <dune/common/fvector.hh> |
33 | 33 |
|
| 34 | +#include <opm/common/OpmLog/OpmLog.hpp> |
| 35 | + |
34 | 36 | #include <opm/material/Constants.hpp> |
35 | 37 | #include <opm/material/common/Valgrind.hpp> |
36 | 38 | #include <opm/material/fluidstates/CompositionalFluidState.hpp> |
|
43 | 45 | #include <opm/models/ptflash/flashindices.hh> |
44 | 46 | #include <opm/models/ptflash/flashparameters.hh> |
45 | 47 |
|
| 48 | +#include <fmt/format.h> |
| 49 | + |
46 | 50 | #include <array> |
47 | | -#include <iostream> |
| 51 | +#include <iterator> |
48 | 52 | #include <string> |
49 | 53 |
|
50 | 54 | namespace Opm { |
@@ -189,31 +193,26 @@ public: |
189 | 193 | // Compute the phase compositions and densities |
190 | 194 | ///////////// |
191 | 195 | if (flashVerbosity >= 1) { |
192 | | - const int spatialIdx = elemCtx.globalSpaceIndex(dofIdx, timeIdx); |
193 | | - std::cout << " updating the intensive quantities for Cell " << spatialIdx << std::endl; |
| 196 | + OpmLog::debug(fmt::format("Updating the intensive quantities for cell {}", |
| 197 | + elemCtx.globalSpaceIndex(dofIdx, timeIdx))); |
194 | 198 | } |
195 | 199 | const auto& eos_type = problem.getEosType(); |
196 | 200 | FlashSolver::solve(fluidState_, flashTwoPhaseMethod, flashTolerance, eos_type, flashVerbosity); |
197 | 201 |
|
198 | 202 | if (flashVerbosity >= 5) { |
199 | | - // printing of flash result after solve |
200 | | - const int spatialIdx = elemCtx.globalSpaceIndex(dofIdx, timeIdx); |
201 | | - std::cout << " \n After flash solve for cell " << spatialIdx << std::endl; |
202 | | - ComponentVector x, y; |
203 | | - for (unsigned comp_idx = 0; comp_idx < numComponents; ++comp_idx) { |
204 | | - x[comp_idx] = fluidState_.moleFraction(FluidSystem::oilPhaseIdx, comp_idx); |
205 | | - y[comp_idx] = fluidState_.moleFraction(FluidSystem::gasPhaseIdx, comp_idx); |
206 | | - } |
207 | | - for (unsigned comp_idx = 0; comp_idx < numComponents; ++comp_idx) { |
208 | | - std::cout << " x for component: " << comp_idx << " is:" << std::endl; |
209 | | - std::cout << x[comp_idx] << std::endl; |
210 | | - |
211 | | - std::cout << " y for component: " << comp_idx << "is:" << std::endl; |
212 | | - std::cout << y[comp_idx] << std::endl; |
| 203 | + std::string phaseCompositions; |
| 204 | + for (unsigned compIdx = 0; compIdx < numComponents; ++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))); |
213 | 211 | } |
214 | | - const Evaluation& L = fluidState_.L(); |
215 | | - std::cout << " L is:" << std::endl; |
216 | | - std::cout << L << std::endl; |
| 212 | + OpmLog::debug(fmt::format("After the flash for cell {}: liquid fraction = {}\n{}", |
| 213 | + elemCtx.globalSpaceIndex(dofIdx, timeIdx), |
| 214 | + getValue(fluidState_.L()), |
| 215 | + phaseCompositions)); |
217 | 216 | } |
218 | 217 |
|
219 | 218 | // Update phases |
@@ -254,13 +253,16 @@ public: |
254 | 253 | fluidState_.setCompressFactor(FluidSystem::oilPhaseIdx, Z_L); |
255 | 254 | fluidState_.setCompressFactor(FluidSystem::gasPhaseIdx, Z_V); |
256 | 255 |
|
257 | | - // Print saturation |
258 | 256 | if (flashVerbosity >= 5) { |
259 | | - std::cout << "So = " << So << std::endl; |
260 | | - std::cout << "Sg = " << Sg << std::endl; |
261 | | - std::cout << "Vm_L = " << Vm_L << std::endl; |
262 | | - std::cout << "Vm_V = " << Vm_V << std::endl; |
263 | | - } |
| 257 | + OpmLog::debug(fmt::format("Flash phase properties for cell {}: " |
| 258 | + "oil saturation = {}, gas saturation = {}, " |
| 259 | + "oil molar volume = {}, gas molar volume = {}", |
| 260 | + elemCtx.globalSpaceIndex(dofIdx, timeIdx), |
| 261 | + getValue(So), |
| 262 | + getValue(Sg), |
| 263 | + getValue(Vm_L), |
| 264 | + getValue(Vm_V))); |
| 265 | + } |
264 | 266 |
|
265 | 267 | ///////////// |
266 | 268 | // Compute rel. perm and viscosity and densities |
|
0 commit comments