GRINS-0.8.0
parameter_manager.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 
26 // This class
28 
29 // GRINS
30 #include "grins/composite_qoi.h"
31 #include "grins/multiphysics_sys.h"
32 #include "grins/solver_context.h"
33 
34 // libMesh
35 #include "libmesh/auto_ptr.h"
36 #include "libmesh/getpot.h"
37 #include "libmesh/parameter_multiaccessor.h"
38 
39 
40 namespace GRINS
41 {
43  ( const GetPot& input,
44  const std::string & parameters_varname,
45  MultiphysicsSystem & system,
46  CompositeQoI * qoi)
47  {
48  const unsigned int n_parameters =
49  input.vector_variable_size(parameters_varname);
50  libmesh_assert(n_parameters);
51 
52  this->parameter_name_list.resize(n_parameters);
53  this->parameter_vector.clear();
54  for (unsigned int i=0; i != n_parameters; ++i)
55  {
56  std::string param_name =
57  input(parameters_varname, std::string(), i);
58 
59  this->parameter_name_list[i] = param_name;
60 
63 
64  // We always have Physics solving for u
65  system.register_parameter(param_name, *next_param);
66 
67  // We don't always have QoIs when solving for du/dp
68  if (qoi)
69  qoi->register_parameter(param_name, *next_param);
70 
71  if (next_param->size() == 0)
72  {
73  std::cout << "No parameters named " << param_name <<
74  " found in active Physics or QoIs" << std::endl;
75  libmesh_error();
76  }
77 
78  this->parameter_vector.push_back
79  (libMesh::UniquePtr<libMesh::ParameterAccessor<libMesh::Number> >
80  (next_param));
81  }
82  }
83 
84 } // namespace GRINS
void register_parameter(const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
Each QoI will register its copy(s) of an independent variable.
GRINS namespace.
void register_parameter(const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer)
Each Physics will register its copy(s) of an independent variable.
Interface with libMesh for solving Multiphysics problems.
virtual void initialize(const GetPot &input, const std::string &parameters_varname, GRINS::MultiphysicsSystem &system, GRINS::CompositeQoI *qoi)

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