From 4349e79103a8c524106402657e7b63121181e209 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Wed, 9 Mar 2016 15:28:05 -0500 Subject: [PATCH 1/2] update inclusion benchmark - change output directories for global and adaptive - include velocity and pressure dofs in error output line - include option to turn on averaging --- benchmark/inclusion/adaptive.prm | 6 ++++-- benchmark/inclusion/global.prm.base | 4 +++- benchmark/inclusion/inclusion.cc | 7 +++++-- benchmark/inclusion/run.sh | 11 +++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/benchmark/inclusion/adaptive.prm b/benchmark/inclusion/adaptive.prm index 5ab4abfce24..a01844bb41b 100644 --- a/benchmark/inclusion/adaptive.prm +++ b/benchmark/inclusion/adaptive.prm @@ -8,7 +8,7 @@ set Dimension = 2 set Start time = 0 set End time = 0 -set Output directory = output +set Output directory = output/adaptive set Pressure normalization = volume set Nonlinear solver scheme = Stokes only @@ -42,6 +42,8 @@ subsection Material model subsection Inclusion set Viscosity jump = 1e3 end + + set Material averaging = none end @@ -73,7 +75,7 @@ end subsection Mesh refinement set Initial adaptive refinement = 13 - set Initial global refinement = 3 + set Initial global refinement = 4 set Strategy = velocity#viscosity set Run postprocessors on initial refinement = true diff --git a/benchmark/inclusion/global.prm.base b/benchmark/inclusion/global.prm.base index daa068b4a7f..a728fe73254 100644 --- a/benchmark/inclusion/global.prm.base +++ b/benchmark/inclusion/global.prm.base @@ -8,7 +8,7 @@ set Dimension = 2 set Start time = 0 set End time = 0 -set Output directory = output +set Output directory = output/global set Pressure normalization = volume set Nonlinear solver scheme = Stokes only @@ -42,6 +42,8 @@ subsection Material model subsection Inclusion set Viscosity jump = 1e3 end + + set Material averaging = none end diff --git a/benchmark/inclusion/inclusion.cc b/benchmark/inclusion/inclusion.cc index b606d3e4285..4415b415a43 100644 --- a/benchmark/inclusion/inclusion.cc +++ b/benchmark/inclusion/inclusion.cc @@ -513,13 +513,16 @@ namespace aspect VectorTools::L2_norm, &comp_p); + unsigned int n = this->get_solution().block(0).size() + + this->get_solution().block(1).size(); std::ostringstream os; - os << std::scientific << cellwise_errors_u.l1_norm() + os << n << "; " + << std::scientific << cellwise_errors_u.l1_norm() << ", " << cellwise_errors_p.l1_norm() << ", " << cellwise_errors_ul2.l2_norm() << ", " << cellwise_errors_pl2.l2_norm(); - return std::make_pair("Errors u_L1, p_L1, u_L2, p_L2:", os.str()); + return std::make_pair("DoFs; Errors u_L1, p_L1, u_L2, p_L2:", os.str()); } } diff --git a/benchmark/inclusion/run.sh b/benchmark/inclusion/run.sh index ab4893bd01d..e1de1afe4eb 100755 --- a/benchmark/inclusion/run.sh +++ b/benchmark/inclusion/run.sh @@ -1,17 +1,20 @@ #!/bin/bash # global refinement: -for r in "3" "4" "5" "6" "7" "8" +echo "--Global Refinement--" +for r in "4" "5" "6" "7" "8" "9" do echo "ref $r:" cp global.prm.base temp.prm -echo "subsection Mesh refinement" >>temp.prm +echo "set Output directory = output/global/ref$r" >> temp.prm +echo "subsection Mesh refinement" >> temp.prm echo "set Initial global refinement = $r" >> temp.prm echo "end" >> temp.prm -./aspect temp.prm | grep Error +./aspect temp.prm | grep DoFs rm -f temp.prm done # adaptive refinement: -./aspect adaptive.prm | egrep "freedom|Error" +echo "--Adaptive Refinement--" +./aspect adaptive.prm | grep DoFs From 7dde43a96272b757f379051bc208fed15977ee27 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Wed, 4 May 2016 17:26:32 -0400 Subject: [PATCH 2/2] Fix DoF output and add averaging - Modify inclusion.cc to output correct number of DoF's if the direct solver is used - Modify run.sh to loop through different averaging schemes (none, arithmetic, geometric) --- .../{adaptive.prm => adaptive.prm.base} | 4 -- benchmark/inclusion/global.prm.base | 6 +-- benchmark/inclusion/inclusion.cc | 7 ++- benchmark/inclusion/run.sh | 46 +++++++++++++------ 4 files changed, 37 insertions(+), 26 deletions(-) rename benchmark/inclusion/{adaptive.prm => adaptive.prm.base} (95%) diff --git a/benchmark/inclusion/adaptive.prm b/benchmark/inclusion/adaptive.prm.base similarity index 95% rename from benchmark/inclusion/adaptive.prm rename to benchmark/inclusion/adaptive.prm.base index a01844bb41b..d4cb8ed4a68 100644 --- a/benchmark/inclusion/adaptive.prm +++ b/benchmark/inclusion/adaptive.prm.base @@ -8,8 +8,6 @@ set Dimension = 2 set Start time = 0 set End time = 0 -set Output directory = output/adaptive - set Pressure normalization = volume set Nonlinear solver scheme = Stokes only @@ -42,8 +40,6 @@ subsection Material model subsection Inclusion set Viscosity jump = 1e3 end - - set Material averaging = none end diff --git a/benchmark/inclusion/global.prm.base b/benchmark/inclusion/global.prm.base index a728fe73254..55fa4af756c 100644 --- a/benchmark/inclusion/global.prm.base +++ b/benchmark/inclusion/global.prm.base @@ -8,8 +8,6 @@ set Dimension = 2 set Start time = 0 set End time = 0 -set Output directory = output/global - set Pressure normalization = volume set Nonlinear solver scheme = Stokes only @@ -42,8 +40,6 @@ subsection Material model subsection Inclusion set Viscosity jump = 1e3 end - - set Material averaging = none end @@ -75,10 +71,10 @@ end subsection Mesh refinement set Initial adaptive refinement = 0 - set Initial global refinement = 0 end + ############### Parameters describing what to do with the solution subsection Postprocess diff --git a/benchmark/inclusion/inclusion.cc b/benchmark/inclusion/inclusion.cc index 4415b415a43..d1ad13a6117 100644 --- a/benchmark/inclusion/inclusion.cc +++ b/benchmark/inclusion/inclusion.cc @@ -513,8 +513,11 @@ namespace aspect VectorTools::L2_norm, &comp_p); - unsigned int n = this->get_solution().block(0).size() + - this->get_solution().block(1).size(); + unsigned int n = this->get_solution().block(this->introspection().block_indices.velocities).size(); + + if(this->introspection().block_indices.velocities != this->introspection().block_indices.pressure) + n += this->get_solution().block(this->introspection().block_indices.pressure).size(); + std::ostringstream os; os << n << "; " << std::scientific << cellwise_errors_u.l1_norm() diff --git a/benchmark/inclusion/run.sh b/benchmark/inclusion/run.sh index e1de1afe4eb..9540aea9f3d 100755 --- a/benchmark/inclusion/run.sh +++ b/benchmark/inclusion/run.sh @@ -1,20 +1,36 @@ #!/bin/bash -# global refinement: -echo "--Global Refinement--" -for r in "4" "5" "6" "7" "8" "9" +# averaging scheme: +for avg in "none" "arithmetic average" "geometric average" do -echo "ref $r:" -cp global.prm.base temp.prm -echo "set Output directory = output/global/ref$r" >> temp.prm -echo "subsection Mesh refinement" >> temp.prm -echo "set Initial global refinement = $r" >> temp.prm -echo "end" >> temp.prm -./aspect temp.prm | grep DoFs -rm -f temp.prm -done + echo "----Averaging scheme: $avg----" + + # global refinement: + echo "----Global refinement----" + for r in "4" "5" "6" "7" "8" "9" + do + echo "ref $r:" + cp global.prm.base temp.prm + echo "set Output directory = output/${avg// /_}/global/ref$r" >> temp.prm + echo "subsection Material model" >> temp.prm + echo "set Material averaging = $avg" >> temp.prm + echo "end" >> temp.prm + echo "subsection Mesh refinement" >> temp.prm + echo "set Initial global refinement = $r" >> temp.prm + echo "end" >> temp.prm + ./aspect temp.prm | grep DoFs + rm -f temp.prm + done -# adaptive refinement: -echo "--Adaptive Refinement--" -./aspect adaptive.prm | grep DoFs + + # adaptive refinement: + echo "----Adaptive refinement----" + cp adaptive.prm.base temp.prm + echo "set Output directory = output/${avg// /_}/adaptive" >> temp.prm + echo "subsection Material model" >> temp.prm + echo "set Material averaging = $avg" >> temp.prm + echo "end" >> temp.prm + ./aspect temp.prm | grep DoFs + rm -f temp.prm +done