Add some outputing information

This commit is contained in:
Kai Bao 2014-05-05 17:54:32 +02:00
parent fecc161d7e
commit cfc589b453
4 changed files with 81 additions and 5 deletions

View File

@ -18,6 +18,8 @@
*/
#include "config.h"
#define PAEANDEBUG 1
#include <opm/core/pressure/FlowBCManager.hpp>
#include <opm/core/grid.h>
@ -57,6 +59,9 @@
#include <iostream>
#include <vector>
#include <numeric>
#if PAEANDEBUG
#include <fstream>
#endif
namespace
@ -220,6 +225,21 @@ try
grav);
SimulatorReport episodeReport = simulator.run(simtimer, state, well_state);
#if PAEANDEBUG
std::cout << " output the pressure " << std::endl;
std::ofstream pressure_file("pressure.out");
std::ostream_iterator <double> pressure_iterator(pressure_file, "\n");
std::copy(state.pressure().begin(), state.pressure().end(), pressure_iterator);
pressure_file.close();
std::cout << " output the saturation " << std::endl;
std::ofstream saturation_file("saturation.out");
std::ostream_iterator <double> saturation_iterator(saturation_file, "\n");
std::copy(state.saturation().begin(), state.saturation().end(), saturation_iterator);
saturation_file.close();
std::cin.ignore();
#endif
++simtimer;
outputWriter.writeTimeStep(simtimer, state, well_state.basicWellState());

View File

@ -17,6 +17,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#define PAEANDEBUG 1
#include <opm/autodiff/FullyImplicitBlackoilSolver.hpp>
#include <opm/autodiff/AutoDiffBlock.hpp>
@ -40,6 +41,9 @@
#include <iostream>
#include <iomanip>
//#include <fstream>
#if PAEANDEBUG
#include <fstream>
#endif
// A debugging utility.
#define DUMP(foo) \
@ -269,9 +273,43 @@ namespace {
<< std::setw(18) << r0 << std::endl;
bool resTooLarge = r0 > atol;
while (resTooLarge && (it < maxit)) {
#if PAEANDEBUG
std::cout << " output the pressure before solveJacobianSystem " << std::endl;
std::ofstream pressure_prev_file("pressure_prev.out");
std::ostream_iterator <double> pressure_prev_iterator(pressure_prev_file, "\n");
std::copy(x.pressure().begin(), x.pressure().end(), pressure_prev_iterator);
pressure_prev_file.close();
std::cout << " output the saturation before solveJacobianSystem " << std::endl;
std::ofstream saturation_prev_file("saturation_prev.out");
std::ostream_iterator <double> saturation_prev_iterator(saturation_prev_file, "\n");
std::copy(x.saturation().begin(), x.saturation().end(), saturation_prev_iterator);
saturation_prev_file.close();
// std::cin.ignore();
#endif
const V dx = solveJacobianSystem();
#if PAEANDEBUG
std::cout << "output the increment for the Newton iteration " << std::endl;
std::ofstream filestream("dx.out");
filestream << dx;
filestream.close();
#endif
updateState(dx, x, xw);
#if PAEANDEBUG
std::cout << " output the pressure " << std::endl;
std::ofstream pressure_file("pressure.out");
std::ostream_iterator <double> pressure_iterator(pressure_file, "\n");
std::copy(x.pressure().begin(), x.pressure().end(), pressure_iterator);
pressure_file.close();
std::cout << " output the saturation " << std::endl;
std::ofstream saturation_file("saturation.out");
std::ostream_iterator <double> saturation_iterator(saturation_file, "\n");
std::copy(x.saturation().begin(), x.saturation().end(), saturation_iterator);
saturation_file.close();
std::cin.ignore();
#endif
assemble(pvdt, x, xw);
@ -1679,16 +1717,31 @@ namespace {
double globalNorm = 0;
std::vector<ADB>::const_iterator quantityIt = residual_.material_balance_eq.begin();
const std::vector<ADB>::const_iterator endQuantityIt = residual_.material_balance_eq.end();
#if PAEANDEBUG
std::cout << " Residuals ";
#endif
for (; quantityIt != endQuantityIt; ++quantityIt) {
const double quantityResid = (*quantityIt).value().matrix().norm();
// const double quantityResid = (*quantityIt).value().matrix().norm();
const double quantityResid = (*quantityIt).value().matrix().lpNorm();
if (!std::isfinite(quantityResid)) {
OPM_THROW(Opm::NumericalProblem,
"Encountered a non-finite residual");
}
globalNorm = std::max(globalNorm, quantityResid);
#if PAEANDEBUG
std::cout << " " << quantityResid;
#endif
}
globalNorm = std::max(globalNorm, residual_.well_flux_eq.value().matrix().norm());
// globalNorm = std::max(globalNorm, residual_.well_flux_eq.value().matrix().norm());
globalNorm = std::max(globalNorm, residual_.well_flux_eq.value().matrix().lpnorm());
#if PAEANDEBUG
std::cout << " " << residual_.well_flux_eq.value().matrix().norm();
#endif
globalNorm = std::max(globalNorm, residual_.well_eq.value().matrix().norm());
#if PAEANDEBUG
std::cout << " " << residual_.well_eq.value().matrix().norm() << std::endl;
std::cout << " globalNorm = " << globalNorm << std::endl;
#endif
return globalNorm;
}

View File

@ -70,8 +70,8 @@ namespace Opm
std::ofstream filestream3("r.out");
filestream3 << total_residual.value();
filestream3.close();
std::cout << " output the information for the first iteration " << std::endl;
std::cin.ignore();
std::cout << " output the information for the last iteration " << std::endl;
// std::cin.ignore();
#endif
if (!rep.converged) {
OPM_THROW(std::runtime_error,

View File

@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#define PAEANDEBUG 1
#include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoil.hpp>
#include <opm/core/utility/parameters/ParameterGroup.hpp>
@ -293,6 +293,9 @@ namespace Opm
// }
bool well_control_passed = !check_well_controls_;
#if PAEANDEBUG
std::cout << " well_control_passed " << well_control_passed << std::endl;
#endif
int well_control_iteration = 0;
do {
// Run solver.