- Added the possibility to set the factor used to scale the prolongation

- Added the possibility to set the number of iterations A.M() make no sense for large matrices.
- Added the possibility to set the number of smoother steps to use.
- Added upscaling_relperm binaries for anisotropic criterion and for different smoothers:
  upscale_relperm: default criterion with ILU0 smoother
  upscale_relperm_aniso: Use settings for anisotropic problems with ILU0 smoother
  upscale_relperm_ssor: default criterion with SSOR smoother
  upscale_relperm_aniso_ssor: default criterion with SSOR smoother
  upscale_relperm_bgs: default criterion with Block Gauss-Seidel smoother
  upscale_relperm_aniso_bgs: default criterion with block Gauss-Seidel smoother
This commit is contained in:
Markus Blatt 2012-09-25 14:31:58 +02:00
parent 341133ba52
commit cd6ff80fd2
4 changed files with 63 additions and 7 deletions

View File

@ -85,9 +85,12 @@ namespace Dune
double perm_threshold, double perm_threshold,
double z_tolerance = 0.0, double z_tolerance = 0.0,
double residual_tolerance = 1e-8, double residual_tolerance = 1e-8,
int linsolver_maxit = 0,
double linsolver_prolongate_factor =1.6,
int linsolver_verbosity = 0, int linsolver_verbosity = 0,
int linsolver_type = 1, int linsolver_type = 1,
bool twodim_hack = false); bool twodim_hack = false,
int linsolver_smooth_steps=2);
/// Access the grid. /// Access the grid.
const GridType& grid() const; const GridType& grid() const;
@ -135,8 +138,11 @@ namespace Dune
BoundaryConditionType bctype_; BoundaryConditionType bctype_;
bool twodim_hack_; bool twodim_hack_;
double residual_tolerance_; double residual_tolerance_;
int linsolver_maxit_;
double linsolver_prolongate_factor_;
int linsolver_verbosity_; int linsolver_verbosity_;
int linsolver_type_; int linsolver_type_;
int linsolver_smooth_steps_;
GridType grid_; GridType grid_;
GridInterface ginterf_; GridInterface ginterf_;

View File

@ -47,8 +47,11 @@ namespace Dune
: bctype_(Fixed), : bctype_(Fixed),
twodim_hack_(false), twodim_hack_(false),
residual_tolerance_(1e-8), residual_tolerance_(1e-8),
linsolver_maxit_(0),
linsolver_prolongate_factor_(1.6),
linsolver_verbosity_(0), linsolver_verbosity_(0),
linsolver_type_(1) linsolver_type_(1),
linsolver_smooth_steps_(2)
{ {
} }
@ -84,6 +87,9 @@ namespace Dune
residual_tolerance_ = param.getDefault("residual_tolerance", residual_tolerance_); residual_tolerance_ = param.getDefault("residual_tolerance", residual_tolerance_);
linsolver_verbosity_ = param.getDefault("linsolver_verbosity", linsolver_verbosity_); linsolver_verbosity_ = param.getDefault("linsolver_verbosity", linsolver_verbosity_);
linsolver_type_ = param.getDefault("linsolver_type", linsolver_type_); linsolver_type_ = param.getDefault("linsolver_type", linsolver_type_);
linsolver_maxit_ = param.getDefault("linsolver_max_iterations", linsolver_maxit_);
linsolver_prolongate_factor_ = param.getDefault("linsolver_prolongate_factor", linsolver_prolongate_factor_)
linsolver_smooth_steps_ = param.getDefault("linsolver_smooth_steps", linsolver_smooth_steps_);
// Ensure sufficient grid support for requested boundary // Ensure sufficient grid support for requested boundary
// condition type. // condition type.
@ -125,14 +131,20 @@ namespace Dune
double perm_threshold, double perm_threshold,
double z_tolerance, double z_tolerance,
double residual_tolerance, double residual_tolerance,
int linsolver_maxit,
double linsolver_prolongate_factor,
int linsolver_verbosity, int linsolver_verbosity,
int linsolver_type, int linsolver_type,
bool twodim_hack) bool twodim_hack,
int linsolver_smooth_steps)
{ {
bctype_ = bctype; bctype_ = bctype;
residual_tolerance_ = residual_tolerance; residual_tolerance_ = residual_tolerance;
linsolver_verbosity_ = linsolver_verbosity; linsolver_verbosity_ = linsolver_verbosity;
linsolver_type_ = linsolver_type; linsolver_type_ = linsolver_type;
linsolver_maxit_ = linsolver_maxit;
linsolver_prolongate_factor_ = linsolver_prolongate_factor;
linsolver_smooth_steps_ = linsolver_smooth_steps;
twodim_hack_ = twodim_hack; twodim_hack_ = twodim_hack;
// Faking some parameters depending on bc type. // Faking some parameters depending on bc type.
@ -231,7 +243,9 @@ namespace Dune
// Run pressure solver. // Run pressure solver.
bool same_matrix = (bctype_ != Fixed) && (pdd != 0); bool same_matrix = (bctype_ != Fixed) && (pdd != 0);
flow_solver_.solve(fluid, sat, bcond_, src, residual_tolerance_, flow_solver_.solve(fluid, sat, bcond_, src, residual_tolerance_,
linsolver_verbosity_, linsolver_type_, same_matrix); linsolver_maxit_, linsolver_prolongate_factor_,
linsolver_verbosity_,
linsolver_type_, same_matrix, linsolver_smooth_steps_);
double max_mod = flow_solver_.postProcessFluxes(); double max_mod = flow_solver_.postProcessFluxes();
std::cout << "Max mod = " << max_mod << std::endl; std::cout << "Max mod = " << max_mod << std::endl;
@ -291,8 +305,8 @@ namespace Dune
if (canon_bid - 1 == 2*flow_dir) { if (canon_bid - 1 == 2*flow_dir) {
++num_side1; ++num_side1;
if (flow_dir == pdrop_dir && flux > 0.0) { if (flow_dir == pdrop_dir && flux > 0.0) {
std::cerr << "Flow may be in wrong direction at bid: " << f->boundaryId() std::cerr << "Flow may be in wrong direction at bid: " << f->boundaryId()<<" (canonical: "<<canon_bid
<< " Magnitude: " << std::fabs(flux) << std::endl; << ") Magnitude: " << std::fabs(flux) << std::endl;
// THROW("Detected outflow at entry face: " << face); // THROW("Detected outflow at entry face: " << face);
} }
side1_flux += flux*norm_comp; side1_flux += flux*norm_comp;

View File

@ -13,6 +13,10 @@ upscale_cap \
upscale_cond \ upscale_cond \
upscale_perm \ upscale_perm \
upscale_relperm \ upscale_relperm \
upscale_relperm_ssor \
upscale_relperm_bgs \
upscale_relperm_aniso \
upscale_relperm_aniso_ssor \
upscale_relpermvisc upscale_relpermvisc
@ -36,6 +40,18 @@ upscale_perm_SOURCES = upscale_perm.cpp
upscale_relperm_SOURCES = upscale_relperm.cpp upscale_relperm_SOURCES = upscale_relperm.cpp
upscale_relperm_ssor_SOURCES = upscale_relperm.cpp
upscale_relperm_ssor_CXXFLAGS = -DSMOOTHER_ILU=0 $(AM_CPPFLAGS)
upscale_relperm_bgs_SOURCES = upscale_relperm.cpp
upscale_relperm_bgs_CXXFLAGS = -DSMOOTHER_ILU=0 -DSMOOTHER_BGS=1 $(AM_CPPFLAGS)
upscale_relperm_aniso_SOURCES = upscale_relperm.cpp
upscale_relperm_aniso_CXXFLAGS = -DANISOTROPIC_3D=1
upscale_relperm_aniso_ssor_SOURCES = upscale_relperm.cpp
upscale_relperm_aniso_ssor_CXXFLAGS = -DANISOTROPIC_3D=1 -DSMOOTHER_ILU=0 $(AM_CPPFLAGS)
upscale_relpermvisc_SOURCES = upscale_relpermvisc.cpp upscale_relpermvisc_SOURCES = upscale_relpermvisc.cpp
AM_CPPFLAGS += $(DUNEMPICPPFLAGS) $(BOOST_CPPFLAGS) $(SUPERLU_CPPFLAGS) AM_CPPFLAGS += $(DUNEMPICPPFLAGS) $(BOOST_CPPFLAGS) $(SUPERLU_CPPFLAGS)

View File

@ -176,6 +176,7 @@ void setVoigtValue(SinglePhaseUpscaler::permtensor_t& K, int voigt_idx, double v
int main(int varnum, char** vararg) int main(int varnum, char** vararg)
{ {
try{
// Variables used for timing/profiling: // Variables used for timing/profiling:
clock_t start, finish; clock_t start, finish;
double timeused = 0.0, timeused_tesselation = 0.0; double timeused = 0.0, timeused_tesselation = 0.0;
@ -223,7 +224,10 @@ int main(int varnum, char** vararg)
// give so small contributions near endpoints. // give so small contributions near endpoints.
options.insert(make_pair("linsolver_tolerance", "1e-12")); // residual tolerance for linear solver options.insert(make_pair("linsolver_tolerance", "1e-12")); // residual tolerance for linear solver
options.insert(make_pair("linsolver_verbosity", "0")); // verbosity level for linear solver options.insert(make_pair("linsolver_verbosity", "0")); // verbosity level for linear solver
options.insert(make_pair("linsolver_max_iterations", "0")); // Maximum number of iterations allow, specify 0 for default
options.insert(make_pair("linsolver_prolongate_factor", "1.6")); // Factor to scale the prolongate coarse grid correction,
options.insert(make_pair("linsolver_type", "1")); // type of linear solver: 0 = ILU/BiCGStab, 1 = AMG/CG options.insert(make_pair("linsolver_type", "1")); // type of linear solver: 0 = ILU/BiCGStab, 1 = AMG/CG
options.insert(make_pair("linsolver_smooth_steps", "2")); // Number of pre and postsmoothing steps for AMG
// Conversion factor, multiply mD numbers with this to get m² numbers // Conversion factor, multiply mD numbers with this to get m² numbers
const double milliDarcyToSqMetre = 9.869233e-16; const double milliDarcyToSqMetre = 9.869233e-16;
@ -663,11 +667,15 @@ int main(int varnum, char** vararg)
double linsolver_tolerance = atof(options["linsolver_tolerance"].c_str()); double linsolver_tolerance = atof(options["linsolver_tolerance"].c_str());
int linsolver_verbosity = atoi(options["linsolver_verbosity"].c_str()); int linsolver_verbosity = atoi(options["linsolver_verbosity"].c_str());
int linsolver_type = atoi(options["linsolver_type"].c_str()); int linsolver_type = atoi(options["linsolver_type"].c_str());
int linsolver_maxit = atoi(options["linsolver_max_iterations"].c_str());
int smooth_steps = atoi(options["linsolver_smooth_steps"].c_str());
double linsolver_prolongate_factor = atof(options["linsolver_prolongate_factor"].c_str());
bool twodim_hack = false; bool twodim_hack = false;
eclParser.convertToSI(); eclParser.convertToSI();
upscaler.init(eclParser, boundaryCondition, upscaler.init(eclParser, boundaryCondition,
Opm::unit::convert::from(minPerm, Opm::prefix::milli*Opm::unit::darcy), Opm::unit::convert::from(minPerm, Opm::prefix::milli*Opm::unit::darcy),
ztol, linsolver_tolerance, linsolver_verbosity, linsolver_type, twodim_hack); ztol, linsolver_tolerance, linsolver_maxit, linsolver_prolongate_factor,
linsolver_verbosity, linsolver_type, twodim_hack, smooth_steps);
finish = clock(); timeused_tesselation = (double(finish)-double(start))/CLOCKS_PER_SEC; finish = clock(); timeused_tesselation = (double(finish)-double(start))/CLOCKS_PER_SEC;
if (isMaster) cout << " (" << timeused_tesselation <<" secs)" << endl; if (isMaster) cout << " (" << timeused_tesselation <<" secs)" << endl;
@ -1469,6 +1477,18 @@ int main(int varnum, char** vararg)
outfile.close(); outfile.close();
} }
} }
}catch (Dune::Exception &e){
std::cerr << "Dune reported error: " << e << std::endl;
}
catch(std::exception &e2){
std::cerr<<"std::exception:"<<e2.what()<<std::endl;
}
catch(const char* s){
std::cout<<"const char* ("<<s<<") thrown"<<std::endl;
}
catch (...){
std::cerr << "Unknown exception thrown!" << std::endl;
}
#if USEMPI #if USEMPI
MPI_Finalize(); MPI_Finalize();