From: bangerth Date: Fri, 11 Oct 2013 13:02:00 +0000 (+0000) Subject: Rewire the reading of the obstacle: either say 'sphere' or 'read from file'. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=541f44bd8dae8dce5dbaf3fd9c0bfd5498113f0e;p=dealii-svn.git Rewire the reading of the obstacle: either say 'sphere' or 'read from file'. git-svn-id: https://svn.dealii.org/trunk@31202 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-42/doc/results.dox b/deal.II/examples/step-42/doc/results.dox index 70895f06da..59158fd480 100644 --- a/deal.II/examples/step-42/doc/results.dox +++ b/deal.II/examples/step-42/doc/results.dox @@ -137,7 +137,10 @@ The tables at the end of each cycle show information about computing time and the number of calls of different parts of the program like assembly or calculating the residual, for the most recent mesh refinement cycle. Some of the numbers above can be improved by transfering the solution from one mesh to -the next, an option we have not exercised here. +the next, an option we have not exercised here. Of course, you can also make +the program run faster, especially on the later refinement cycles, by just +using more processors: the accompanying paper shows good scaling to at least +1000 cores. In a typical run, you can observe that for every refinement step, the active set - the contact points - are iterated out at first. After that the Newton diff --git a/deal.II/examples/step-42/obstacle_file.pbm b/deal.II/examples/step-42/obstacle.pbm similarity index 100% rename from deal.II/examples/step-42/obstacle_file.pbm rename to deal.II/examples/step-42/obstacle.pbm diff --git a/deal.II/examples/step-42/p1_adaptive.prm b/deal.II/examples/step-42/p1_adaptive.prm index dd5f63c008..54bc9e9bd4 100644 --- a/deal.II/examples/step-42/p1_adaptive.prm +++ b/deal.II/examples/step-42/p1_adaptive.prm @@ -1,25 +1,6 @@ -# Listing of Parameters -# --------------------- - -# polynomial degree of the FE_Q finite element space, typically 1 or 2 set polynomial degree = 1 - -# number of initial global refinements before the first computation set number of initial refinements = 3 - -# number of adaptive cycles to run set number of cycles = 12 - -# refinement strategy for each cycle: -# global: one global refinement -# percentage: fixed percentage gets refined using kelly -# fix dofs: tries to achieve 2^initial_refinement*300 dofs after cycle 1 (only -# use 2 cycles!). Changes the coarse mesh! set refinement strategy = percentage - -# obstacle file to read, leave empty to use a sphere or 'obstacle_file.pbm' -set obstacle filename = - -# directory to put output files (graphical output and benchmark statistics, -# leave empty to put into current directory -set output directory = p1adaptive +set obstacle = sphere +set output directory = p1_adaptive diff --git a/deal.II/examples/step-42/p1_chinese.prm b/deal.II/examples/step-42/p1_chinese.prm index b1569bc495..c7a6d06155 100644 --- a/deal.II/examples/step-42/p1_chinese.prm +++ b/deal.II/examples/step-42/p1_chinese.prm @@ -1,25 +1,6 @@ -# Listing of Parameters -# --------------------- - -# polynomial degree of the FE_Q finite element space, typically 1 or 2 set polynomial degree = 1 - -# number of initial global refinements before the first computation set number of initial refinements = 3 - -# number of adaptive cycles to run set number of cycles = 12 - -# refinement strategy for each cycle: -# global: one global refinement -# percentage: fixed percentage gets refined using kelly -# fix dofs: tries to achieve 2^initial_refinement*300 dofs after cycle 1 (only -# use 2 cycles!). Changes the coarse mesh! set refinement strategy = percentage - -# obstacle file to read, leave empty to use a sphere or 'obstacle_file.pbm' -set obstacle filename = obstacle_file.pbm - -# directory to put output files (graphical output and benchmark statistics, -# leave empty to put into current directory -set output directory = p1adaptive +set obstacle = read from file +set output directory = p1_chinese diff --git a/deal.II/examples/step-42/p1_global.prm b/deal.II/examples/step-42/p1_global.prm index ead72fb52e..fd15bdbd9f 100644 --- a/deal.II/examples/step-42/p1_global.prm +++ b/deal.II/examples/step-42/p1_global.prm @@ -1,25 +1,6 @@ -# Listing of Parameters -# --------------------- - -# polynomial degree of the FE_Q finite element space, typically 1 or 2 set polynomial degree = 1 - -# number of initial global refinements before the first computation set number of initial refinements = 3 - -# number of adaptive cycles to run set number of cycles = 7 - -# refinement strategy for each cycle: -# global: one global refinement -# percentage: fixed percentage gets refined using kelly -# fix dofs: tries to achieve 2^initial_refinement*300 dofs after cycle 1 (only -# use 2 cycles!). Changes the coarse mesh! set refinement strategy = global - -# obstacle file to read, leave empty to use a sphere or 'obstacle_file.pbm' -set obstacle filename = - -# directory to put output files (graphical output and benchmark statistics, -# leave empty to put into current directory -set output directory = p1global +set obstacle = sphere +set output directory = p1_global diff --git a/deal.II/examples/step-42/p2_global.prm b/deal.II/examples/step-42/p2_global.prm index f721e417e3..652d079b81 100644 --- a/deal.II/examples/step-42/p2_global.prm +++ b/deal.II/examples/step-42/p2_global.prm @@ -1,25 +1,6 @@ -# Listing of Parameters -# --------------------- - -# polynomial degree of the FE_Q finite element space, typically 1 or 2 set polynomial degree = 2 - -# number of initial global refinements before the first computation set number of initial refinements = 3 - -# number of adaptive cycles to run set number of cycles = 6 - -# refinement strategy for each cycle: -# global: one global refinement -# percentage: fixed percentage gets refined using kelly -# fix dofs: tries to achieve 2^initial_refinement*300 dofs after cycle 1 (only -# use 2 cycles!). Changes the coarse mesh! set refinement strategy = global - -# obstacle file to read, leave empty to use a sphere or 'obstacle_file.pbm' -set obstacle filename = - -# directory to put output files (graphical output and benchmark statistics, -# leave empty to put into current directory -set output directory = p2global +set obstacle = sphere +set output directory = p2_global diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index ac33b1d081..b3f695b07b 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -468,6 +468,8 @@ namespace Step42 ny(0) { std::ifstream f(name.c_str()); + AssertThrow (f, ExcMessage (std::string("Can't read from file <") + + name + ">!")); std::string temp; f >> temp >> nx >> ny; @@ -787,9 +789,12 @@ namespace Step42 prm.declare_entry("number of cycles", "5", Patterns::Integer(), "Number of adaptive mesh refinement cycles to run."); - prm.declare_entry("obstacle filename", "", - Patterns::Anything(), - "Obstacle file to read, use 'obstacle_file.pbm' or leave empty to use a sphere."); + prm.declare_entry("obstacle", "sphere", + Patterns::Selection("sphere|read from file"), + "The name of the obstacle to use. This may either be 'sphere' if we should " + "use a spherical obstacle, or 'read from file' in which case the obstacle " + "will be read from a file named 'obstacle.pbm' that is supposed to be in " + "ASCII PBM format."); prm.declare_entry("output directory", "", Patterns::Anything(), "Directory for output files (graphical output and benchmark " @@ -838,10 +843,10 @@ namespace Step42 gamma), base_mesh (prm.get("base mesh")), - obstacle (prm.get("obstacle filename") != "" + obstacle (prm.get("obstacle") == "read from file" ? static_cast*> - (new EquationData::ChineseObstacle(prm.get("obstacle filename"), (base_mesh == "box" ? 1.0 : 0.5))) + (new EquationData::ChineseObstacle("obstacle.pbm", (base_mesh == "box" ? 1.0 : 0.5))) : static_cast*> (new EquationData::SphereObstacle(base_mesh == "box" ? 1.0 : 0.5))),