diff --git a/examples/cart_grid.c b/examples/cart_grid.c index 48a8e6d7..8bf8af8e 100644 --- a/examples/cart_grid.c +++ b/examples/cart_grid.c @@ -100,6 +100,7 @@ create_cart_grid(int nx, int ny, int nz) cfacepos = G->cell_facepos; ccentroids = G->cell_centroids; cvolumes = G->cell_volumes; + cfacepos[0] = 0; for (k=0; k::zero(sys_.writableMatrix()); VZero::zero(sys_.vector().writableResidual()); @@ -126,17 +126,16 @@ namespace Opm { rpt.norm_dx = VNorm::norm(sys_.vector().increment()); - // Begin line search. The line search should be moved to model + // Begin line search double residual=VNorm::norm(sys_.vector().residual()); int lin_it=0; - bool finished=rpt.norm_res::zero(sys_.writableMatrix()); VZero::zero(sys_.vector().writableResidual()); asm_.assemble(state, g, src, dt, sys_); residual = VNorm::norm(sys_.vector().residual()); - if (ctrl.verbose){ + if (ctrl.verbosity > 1){ std::cout << "Line search iteration " << std::scientific << lin_it << " norm :" << residual << " alpha " << alpha << '\n'; } }else{ - if (ctrl.verbose){ + if (ctrl.verbosity > 1){ std::cout << "Line search iteration " << std::scientific << lin_it - << " Saturation out of range, continue. Alpha " << alpha << '\n'; + << " Value out of range, continue search. alpha " << alpha << '\n'; } residual = 1e99; } @@ -171,7 +170,7 @@ namespace Opm { VNorm::norm(sys_.vector().residual()); rpt.nit++; - if (ctrl.verbose){ + if (ctrl.verbosity > 0){ std::cout << "Iteration " << std::scientific << rpt.nit << " norm :" << rpt.norm_res << " alpha " << alpha << std::endl; } diff --git a/src/SimpleFluid2pWrapper.hpp b/src/SimpleFluid2pWrapper.hpp index 54116dd5..7ca11d4f 100644 --- a/src/SimpleFluid2pWrapper.hpp +++ b/src/SimpleFluid2pWrapper.hpp @@ -36,7 +36,6 @@ #ifndef OPM_SimpleFluid2pWrapper_HPP_HEADER #define OPM_SimpleFluid2pWrapper_HPP_HEADER -#include #include namespace Opm { @@ -67,8 +66,6 @@ namespace Opm { private: ReservoirProperties& resprop_; - std::array mu_ ; - std::array rho_; }; } diff --git a/src/SinglePointUpwindTwoPhase.hpp b/src/SinglePointUpwindTwoPhase.hpp index ce41355a..fcb08722 100644 --- a/src/SinglePointUpwindTwoPhase.hpp +++ b/src/SinglePointUpwindTwoPhase.hpp @@ -361,11 +361,10 @@ namespace Opm { template - void + bool initIteration(const ReservoirState& state, const Grid& g , - JacobianSystem& sys, - bool& s_range ) { + JacobianSystem& sys) { double s[2], mob[2], dmob[2 * 2], pc, dpc; @@ -373,7 +372,7 @@ namespace Opm { sys.vector().solution(); const ::std::vector& sat = state.saturation(); - double max_alpha = 1; + bool in_range = true; for (int c = 0; c < g.number_of_cells; ++c) { store_.ds(c) = x[c]; // Store sat-change for accumulation(). @@ -384,14 +383,13 @@ namespace Opm { if ( s[0] < (s_min - 1e-5) || s[0] > (s_max + 1e-5) ) { if (s[0] < s_min){ - std::cout << "Warning: s out of range:" << s[0]-s_min << std::endl; + std::cout << "Warning: s out of range, s-s_min = " << s_min-s[0] << std::endl; } if (s[0] > s_max){ - std::cout << "Warning: s out of range:" << s[0]-s_max << std::endl; + std::cout << "Warning: s out of range, s-s_max = " << s[0]-s_max << std::endl; } - s_range = false; //line search fails + in_range = false; //line search fails } - s[0] = std::max(s_min, s[0]); s[0] = std::min(s_max, s[0]); s[1] = 1 - s[0]; @@ -406,6 +404,7 @@ namespace Opm { store_.pc(c) = pc; store_.dpc(c) = dpc; } + return in_range; } template f2hf_ ; spu_2p::ModelParameterStorage store_ ; };