From b94507bdc60512c7250fa3fce970c944e006c9fd Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 25 Oct 2006 19:55:54 +0000 Subject: [PATCH] Implement a few more improvements. git-svn-id: https://svn.dealii.org/trunk@14092 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-21/Makefile | 2 +- deal.II/examples/step-21/doc/intro.dox | 2 +- deal.II/examples/step-21/step-21.cc | 100 ++++++++++++++++++++----- 3 files changed, 85 insertions(+), 19 deletions(-) diff --git a/deal.II/examples/step-21/Makefile b/deal.II/examples/step-21/Makefile index 4aee8cd9cc..26266ada33 100644 --- a/deal.II/examples/step-21/Makefile +++ b/deal.II/examples/step-21/Makefile @@ -14,7 +14,7 @@ target = $(basename $(shell echo step-*.cc)) # run-time checking of parameters and internal states is performed, so # you should set this value to `on' while you develop your program, # and to `off' when running production computations. -debug-mode = on +debug-mode = off # As third field, we need to give the path to the top-level deal.II diff --git a/deal.II/examples/step-21/doc/intro.dox b/deal.II/examples/step-21/doc/intro.dox index 41b27efc19..2737f54d97 100644 --- a/deal.II/examples/step-21/doc/intro.dox +++ b/deal.II/examples/step-21/doc/intro.dox @@ -13,7 +13,7 @@ program (besides the somewhat strange time-dependence of step-18).

The two phase flow problem

Modeling of two phase flow in porous media is important for both -environmental remediation and the management of petroleum +environmental remediation and the management of petroleum and groundwater reservoirs. Practical situations involving two phase flow include the dispersal of a nonaqueous phase liquid in an aquifer, or the joint movement of a mixture of fluids such as oil and water in a diff --git a/deal.II/examples/step-21/step-21.cc b/deal.II/examples/step-21/step-21.cc index 4dbe61102b..44023a8aa9 100644 --- a/deal.II/examples/step-21/step-21.cc +++ b/deal.II/examples/step-21/step-21.cc @@ -52,6 +52,7 @@ // previous programs: using namespace dealii; + // @sect3{The ``TwoPhaseFlowProblem'' class template} @@ -68,7 +69,9 @@ class TwoPhaseFlowProblem void solve (); void compute_errors () const; void output_results (const unsigned int timestep_number) const; - + double get_maximal_velocity () const; + void project_back_saturation (); + Vector evaluate_solution (const Point &point) const; const unsigned int degree; @@ -311,13 +314,12 @@ KInverse::value_list (const std::vector > &points, double mobility_inverse (const double S, const double vis) -{ +{ return 1.0 /(1.0/vis * S * S + (1-S) * (1-S)); } double f_saturation(const double S, const double vis) { - return S*S /( S * S +vis * (1-S) * (1-S)); } @@ -851,7 +853,8 @@ void TwoPhaseFlowProblem::solve () cg.solve (schur_complement, solution.block(1), schur_rhs, preconditioner); - std::cout << solver_control.last_step() + std::cout << " " + << solver_control.last_step() << " CG Schur complement iterations to obtain convergence for pressure." << std::endl; } @@ -1037,23 +1040,20 @@ void TwoPhaseFlowProblem::solve () } SolverControl solver_control (system_matrix.block(2,2).m(), - 1e-12*system_rhs.block(2).l2_norm()); + 1e-8*system_rhs.block(2).l2_norm()); SolverCG<> cg (solver_control); cg.solve (system_matrix.block(2,2), solution.block(2), system_rhs.block(2), PreconditionIdentity()); - std::cout << solver_control.last_step() + std::cout << " " + << solver_control.last_step() << " CG iterations to obtain convergence for saturation." << std::endl; } old_solution = solution; - - - - } // @sect4{TwoPhaseFlow::compute_errors} @@ -1177,12 +1177,66 @@ void TwoPhaseFlowProblem::output_results data_out.build_patches (degree+1); std::ostringstream filename; - filename << "solution-"<< timestep_number; + filename << "solution-"<< timestep_number << ".vtk"; std::ofstream output (filename.str().c_str()); - data_out.write_gnuplot (output); + data_out.write_vtk (output); +} + - //data_out.write_vtk (output); + +template +void +TwoPhaseFlowProblem::project_back_saturation () +{ + for (unsigned int i=0; i 1) + solution.block(dim)(i) = 1; + + for (unsigned int i=0; i::run () unsigned int timestep_number = 1; - for ( double time = time_step; time <=1; time+=time_step, timestep_number++) + for ( double time = time_step; time <= 50; time+=time_step, timestep_number++) { - std::cout<< "Timestep_number = "<< timestep_number<