GRINS-0.8.0
error_estimator_options.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 // This class
27 
28 // GRINS
29 #include "grins/common.h"
31 
32 // libMesh
33 #include "libmesh/getpot.h"
34 
35 namespace GRINS
36 {
38  : _estimator_type("none"),
39  _patch_reuse(false),
40  _n_adjoint_h_refinements(1),
41  _n_adjoint_p_refinements(0),
42  _compute_qoi_error_estimate(false)
43  {
44  this->check_dup_input_style(input);
45 
46  if( this->is_old_style(input) )
47  this->parse_old_style(input);
48  else
49  this->parse_new_style(input);
50  }
51 
52  void ErrorEstimatorOptions::check_dup_input_style( const GetPot& input ) const
53  {
54  if( input.have_section("MeshAdaptivity") &&
55  input.have_section("Strategies/ErrorEstimation") )
56  libmesh_error_msg("ERROR: Cannot use both old and new style of options for ErrorEstimator!");
57  }
58 
59  bool ErrorEstimatorOptions::is_old_style( const GetPot& input ) const
60  {
61  return input.have_section("MeshAdaptivity");
62  }
63 
64  void ErrorEstimatorOptions::parse_old_style(const GetPot& input)
65  {
66  {
67  std::string warning = "WARNING: Using [MeshAdaptivity/<options>] is a DEPRECATED\n";
68  warning += " style of input for ErrorEstimator options. Please\n";
69  warning += " update to use the [Strategies/ErrorEstimation/<options> style.\n";
70  grins_warning(warning);
71  }
72 
73  _estimator_type = input("MeshAdaptivity/estimator_type", "none");
74  _patch_reuse = input("MeshAdaptivity/patch_reuse", false);
75  _n_adjoint_h_refinements = input("MeshAdaptivity/n_adjoint_h_refinements", 1);
76  _n_adjoint_p_refinements = input("MeshAdaptivity/n_adjoint_p_refinements", 0);
77  _compute_qoi_error_estimate = input("MeshAdaptivity/compute_qoi_error_estimate", false);
78  }
79 
80  void ErrorEstimatorOptions::parse_new_style(const GetPot& input)
81  {
82  _estimator_type = input("Strategies/ErrorEstimation/estimator_type", "none");
83  _patch_reuse = input("Strategies/ErrorEstimation/patch_reuse", false);
84  _n_adjoint_h_refinements = input("Strategies/ErrorEstimation/n_adjoint_h_refinements", 1);
85  _n_adjoint_p_refinements = input("Strategies/ErrorEstimation/n_adjoint_p_refinements", 0);
86  _compute_qoi_error_estimate = input("Strategies/ErrorEstimation/compute_qoi_error_estimate", false);
87  }
88 
90  {
91  bool requires_adjoint = false;
94  requires_adjoint = true;
95 
96  return requires_adjoint;
97  }
98 } // end namespace GRINS
void parse_new_style(const GetPot &input)
void check_dup_input_style(const GetPot &input) const
ErrorEstimatorOptions(const GetPot &input)
static std::string adjoint_residual_error_estimator()
bool is_old_style(const GetPot &input) const
#define grins_warning(message)
Definition: common.h:34
GRINS namespace.
void parse_old_style(const GetPot &input)

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1