GRINS-0.8.0
simulation.h
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 #ifndef GRINS_SIMULATION_H
27 #define GRINS_SIMULATION_H
28 
29 // C++
30 #include "grins/shared_ptr.h"
31 
32 // GRINS
33 #include "grins_config.h"
34 #include "grins/shared_ptr.h"
35 #include "grins/solver.h"
36 #include "grins/qoi_base.h"
37 #include "grins/visualization.h"
38 #include "grins/physics_naming.h"
42 #include "grins/qoi_output.h"
43 
44 // libMesh
45 #include "libmesh/error_estimator.h"
46 #include "libmesh/getpot.h"
47 #include "libmesh/mesh.h"
48 
49 // libMesh forward declarations
50 class GetPot;
51 
52 namespace GRINS
53 {
54  // Forward declarations
55  class SimulationBuilder;
56  class MultiphysicsSystem;
57 
58  class Simulation
59  {
60  public:
61 
62  Simulation( const GetPot& input,
63  SimulationBuilder& sim_builder,
64  const libMesh::Parallel::Communicator &comm
65  LIBMESH_CAN_DEFAULT_TO_COMMWORLD );
66 
67  Simulation( const GetPot& input,
68  GetPot& command_line, /* Has to be non-const for search() */
69  SimulationBuilder& sim_builder,
70  const libMesh::Parallel::Communicator &comm
71  LIBMESH_CAN_DEFAULT_TO_COMMWORLD );
72 
73  virtual ~Simulation(){};
74 
75  void run();
76 
77  void print_sim_info();
78 
79  SharedPtr<libMesh::EquationSystems> get_equation_system();
81 
83 
84  libMesh::Number get_qoi_value( unsigned int qoi_index ) const;
85 
86  const std::string& get_multiphysics_system_name() const;
87 
88  protected:
89 
90  void read_restart( const GetPot& input );
91 
93  void init_multiphysics_system( const GetPot& input );
94 
96  void init_qois( const GetPot& input, SimulationBuilder& sim_builder );
97 
99  void init_params( const GetPot& input, SimulationBuilder& sim_builder );
100 
102  void init_restart( const GetPot& input, SimulationBuilder& sim_builder,
103  const libMesh::Parallel::Communicator &comm );
104 
106  bool check_for_adjoint_solve( const GetPot& input ) const;
107 
109  void init_adjoint_solve( const GetPot& input, bool output_adjoint );
110 
111  void build_error_estimator(const GetPot& input);
112 
113  void build_solver(const GetPot& input);
114 
115  SharedPtr<libMesh::UnstructuredMesh> _mesh;
116 
117  SharedPtr<libMesh::EquationSystems> _equation_system;
118 
119  libMesh::UniquePtr<GRINS::Solver> _solver;
120 
122  std::string _system_name;
123 
124  // This needs to be a standard pointer, as _equation_system will own and destroy the object.
126 
127  SharedPtr<GRINS::Visualization> _vis;
128 
129  SharedPtr<PostProcessedQuantities<libMesh::Real> > _postprocessing;
130 
131  // Screen display options
138 
139  // QoI output options and functionality
140  SharedPtr<QoIOutput> _qoi_output;
141 
142  // Visualization options
148 
149  unsigned int _timesteps_per_vis;
151 
153  SharedPtr<libMesh::ErrorEstimator> _error_estimator;
154 
156 
158 
159  // Cache whether or not we do an adjoint solve
161 
163 
164  private:
165 
166  Simulation();
167 
168  };
169 
170  inline
171  const MultiphysicsSystem*
173  {
174  return this->_multiphysics_system;
175  }
176 
177  inline
180  {
181  return this->_multiphysics_system;
182  }
183 
184  inline
185  const std::string& Simulation::get_multiphysics_system_name() const
186  {
187  return this->_system_name;
188  }
189 }
190 #endif // GRINS_SIMULATION_H
void read_restart(const GetPot &input)
Definition: simulation.C:404
SharedPtr< libMesh::EquationSystems > get_equation_system()
Definition: simulation.C:393
void init_multiphysics_system(const GetPot &input)
Helper function.
Definition: simulation.C:142
ParameterManager _forward_parameters
Definition: simulation.h:157
Simple class to hold and initialize a ParameterVector.
void init_params(const GetPot &input, SimulationBuilder &sim_builder)
Helper function.
Definition: simulation.C:199
unsigned int _timesteps_per_vis
Definition: simulation.h:149
SharedPtr< PostProcessedQuantities< libMesh::Real > > _postprocessing
Definition: simulation.h:129
GRINS namespace.
bool _print_constraint_info
Definition: simulation.h:135
void build_error_estimator(const GetPot &input)
Definition: simulation.C:491
SharedPtr< QoIOutput > _qoi_output
Definition: simulation.h:140
SharedPtr< libMesh::ErrorEstimator > _error_estimator
Definition: simulation.h:153
bool _print_equation_system_info
Definition: simulation.h:134
libMesh::Number get_qoi_value(unsigned int qoi_index) const
Definition: simulation.C:398
MultiphysicsSystem * get_multiphysics_system()
Definition: simulation.h:179
const std::string & get_multiphysics_system_name() const
Definition: simulation.h:185
Container for ErrorEstimator options.
void init_adjoint_solve(const GetPot &input, bool output_adjoint)
Helper function.
Definition: simulation.C:446
libMesh::UniquePtr< GRINS::Solver > _solver
Definition: simulation.h:119
void init_qois(const GetPot &input, SimulationBuilder &sim_builder)
Helper function.
Definition: simulation.C:178
void build_solver(const GetPot &input)
Definition: simulation.C:503
Interface with libMesh for solving Multiphysics problems.
ParameterManager _adjoint_parameters
Definition: simulation.h:155
bool _output_residual_sensitivities
Definition: simulation.h:146
bool _output_solution_sensitivities
Definition: simulation.h:147
ErrorEstimatorOptions _error_estimator_options
Definition: simulation.h:152
void init_restart(const GetPot &input, SimulationBuilder &sim_builder, const libMesh::Parallel::Communicator &comm)
Helper function.
Definition: simulation.C:252
SharedPtr< libMesh::UnstructuredMesh > _mesh
Definition: simulation.h:115
GRINS::MultiphysicsSystem * _multiphysics_system
Definition: simulation.h:125
unsigned int _timesteps_per_perflog
Definition: simulation.h:150
SharedPtr< GRINS::Visualization > _vis
Definition: simulation.h:127
virtual ~Simulation()
Definition: simulation.h:73
void print_sim_info()
Definition: simulation.C:376
bool check_for_adjoint_solve(const GetPot &input) const
Helper function.
Definition: simulation.C:469
std::string _system_name
GRINS::Multiphysics system name.
Definition: simulation.h:122
SharedPtr< libMesh::EquationSystems > _equation_system
Definition: simulation.h:117

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