GRINS-0.7.0
solver_parsing.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 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 // These functions
26 #include "grins/solver_names.h"
27 #include "grins/solver_parsing.h"
29 
30 // GRINS
31 #include "grins/common.h"
32 
33 // libMesh
34 #include "libmesh/getpot.h"
35 
36 namespace GRINS
37 {
38  std::string SolverParsing::solver_type(const GetPot& input)
39  {
41  MeshAdaptivityOptions mesh_adaptivity_options(input);
42  bool mesh_adaptive = mesh_adaptivity_options.is_mesh_adaptive();
43 
44  bool transient = SolverParsing::is_transient(input);
45 
46  std::string solver_type = input("SolverOptions/solver_type", "DIE!");
47 
48  if(transient && !mesh_adaptive)
49  {
50  solver_type = SolverNames::unsteady_solver();
51  }
52  else if( !transient && !mesh_adaptive )
53  {
54  solver_type = SolverNames::steady_solver();
55  }
56  else if( !transient && mesh_adaptive )
57  {
59  }
60  else if( transient && mesh_adaptive )
61  {
63  }
64  else
65  {
66  libmesh_error_msg("Unsupported combination of solver options!");
67  }
68 
69  return solver_type;
70  }
71 
72  bool SolverParsing::is_transient( const GetPot& input )
73  {
74  // Can't specify both old and new version
76  "unsteady-solver/transient",
77  "SolverOptions/TimeStepping/solver_type");
78 
79  bool transient = false;
80 
81  if( input.have_variable("unsteady-solver/transient") )
82  {
83  transient = input("unsteady-solver/transient",false);
84 
85  std::string warning = "WARNING: unsteady-solver/transient is DEPRECATED!\n";
86  warning += " Please use SolverOptions/TimeStepping/solver_type to specify time stepping solver.\n";
87  grins_warning(warning);
88  }
89 
90  // In the new version, we set the solver type so we just need to
91  // check if the variable is present. Solver class will figure
92  // out the type.
93  if( input.have_variable("SolverOptions/TimeStepping/solver_type") )
94  transient = true;
95 
96  return transient;
97  }
98 
99  void SolverParsing::dup_solver_option_check( const GetPot& input,
100  const std::string& option1,
101  const std::string& option2 )
102  {
103  // Can't specify both old and new version
104  if( input.have_variable(option1) && input.have_variable(option2) )
105  {
106  libmesh_error_msg("ERROR: Cannot specify both "+option1+" and "+option2);
107  }
108  }
109 
110 } // end namespace GRINS
static std::string solver_type(const GetPot &input)
static bool is_transient(const GetPot &input)
#define grins_warning(message)
Definition: common.h:34
GRINS namespace.
static const std::string unsteady_solver()
Definition: solver_names.h:37
Container for mesh adaptivity options.
static const std::string steady_mesh_adaptive_solver()
Definition: solver_names.h:40
static const std::string unsteady_mesh_adaptive_solver()
Definition: solver_names.h:43
static const std::string steady_solver()
Definition: solver_names.h:34
static void dup_solver_option_check(const GetPot &input, const std::string &option1, const std::string &option2)

Generated on Thu Jun 2 2016 21:52:28 for GRINS-0.7.0 by  doxygen 1.8.10