GRINS-0.7.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-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 
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/grins_solver.h"
36 #include "grins/qoi_base.h"
37 #include "grins/visualization.h"
38 #include "grins/physics_naming.h"
42 
43 // libMesh
44 #include "libmesh/error_estimator.h"
45 #include "libmesh/getpot.h"
46 #include "libmesh/mesh.h"
47 
48 // GRVY
49 #ifdef GRINS_HAVE_GRVY
50 #include "grvy.h"
51 #endif
52 
53 // libMesh forward declarations
54 class GetPot;
55 
56 namespace GRINS
57 {
58  // Forward declarations
59  class SimulationBuilder;
60  class MultiphysicsSystem;
61 
62  class Simulation
63  {
64  public:
65 
66  Simulation( const GetPot& input,
67  SimulationBuilder& sim_builder,
68  const libMesh::Parallel::Communicator &comm
69  LIBMESH_CAN_DEFAULT_TO_COMMWORLD );
70 
71  Simulation( const GetPot& input,
72  GetPot& command_line, /* Has to be non-const for search() */
73  SimulationBuilder& sim_builder,
74  const libMesh::Parallel::Communicator &comm
75  LIBMESH_CAN_DEFAULT_TO_COMMWORLD );
76 
77  virtual ~Simulation(){};
78 
79  void run();
80 
81  void print_sim_info();
82 
83  SharedPtr<libMesh::EquationSystems> get_equation_system();
85 
87 
88  libMesh::Number get_qoi_value( unsigned int qoi_index ) const;
89 
90  const std::string& get_multiphysics_system_name() const;
91 
92 #ifdef GRINS_USE_GRVY_TIMERS
93  void attach_grvy_timer( GRVY::GRVY_Timer_Class* grvy_timer );
94 #endif
95 
96  protected:
97 
98  void read_restart( const GetPot& input );
99 
101  void init_multiphysics_system( const GetPot& input );
102 
104  void init_qois( const GetPot& input, SimulationBuilder& sim_builder );
105 
107  void init_params( const GetPot& input, SimulationBuilder& sim_builder );
108 
110  void init_restart( const GetPot& input, SimulationBuilder& sim_builder,
111  const libMesh::Parallel::Communicator &comm );
112 
114  void check_for_unused_vars( const GetPot& input, bool warning_only );
115 
117  bool check_for_adjoint_solve( const GetPot& input ) const;
118 
120  void init_adjoint_solve( const GetPot& input, bool output_adjoint );
121 
122  void build_error_estimator(const GetPot& input);
123 
124  SharedPtr<libMesh::UnstructuredMesh> _mesh;
125 
126  SharedPtr<libMesh::EquationSystems> _equation_system;
127 
128  SharedPtr<GRINS::Solver> _solver;
129 
131  std::string _system_name;
132 
133  // This needs to be a standard pointer, as _equation_system will own and destroy the object.
135 
136  SharedPtr<GRINS::Visualization> _vis;
137 
138  SharedPtr<PostProcessedQuantities<libMesh::Real> > _postprocessing;
139 
140  // Screen display options
147 
148  // Visualization options
154 
155  unsigned int _timesteps_per_vis;
157 
159  SharedPtr<libMesh::ErrorEstimator> _error_estimator;
160 
162 
164 
165  // Cache whether or not we do an adjoint solve
167 
169 
170  private:
171 
172  Simulation();
173 
174  };
175 
176  inline
177  const MultiphysicsSystem*
179  {
180  return this->_multiphysics_system;
181  }
182 
183  inline
186  {
187  return this->_multiphysics_system;
188  }
189 
190  inline
191  const std::string& Simulation::get_multiphysics_system_name() const
192  {
193  return this->_system_name;
194  }
195 }
196 #endif // GRINS_SIMULATION_H
void read_restart(const GetPot &input)
Definition: simulation.C:453
SharedPtr< libMesh::EquationSystems > get_equation_system()
Definition: simulation.C:442
void init_multiphysics_system(const GetPot &input)
Helper function.
Definition: simulation.C:142
ParameterManager _forward_parameters
Definition: simulation.h:163
Simple class to hold and initialize a ParameterVector.
void init_params(const GetPot &input, SimulationBuilder &sim_builder)
Helper function.
Definition: simulation.C:196
unsigned int _timesteps_per_vis
Definition: simulation.h:155
SharedPtr< PostProcessedQuantities< libMesh::Real > > _postprocessing
Definition: simulation.h:138
GRINS namespace.
void build_error_estimator(const GetPot &input)
Definition: simulation.C:540
SharedPtr< libMesh::ErrorEstimator > _error_estimator
Definition: simulation.h:159
bool _print_equation_system_info
Definition: simulation.h:143
libMesh::Number get_qoi_value(unsigned int qoi_index) const
Definition: simulation.C:447
MultiphysicsSystem * get_multiphysics_system()
Definition: simulation.h:185
SharedPtr< GRINS::Solver > _solver
Definition: simulation.h:128
const std::string & get_multiphysics_system_name() const
Definition: simulation.h:191
Container for ErrorEstimator options.
void init_adjoint_solve(const GetPot &input, bool output_adjoint)
Helper function.
Definition: simulation.C:495
void init_qois(const GetPot &input, SimulationBuilder &sim_builder)
Helper function.
Definition: simulation.C:173
Interface with libMesh for solving Multiphysics problems.
ParameterManager _adjoint_parameters
Definition: simulation.h:161
bool _output_residual_sensitivities
Definition: simulation.h:152
bool _output_solution_sensitivities
Definition: simulation.h:153
ErrorEstimatorOptions _error_estimator_options
Definition: simulation.h:158
void check_for_unused_vars(const GetPot &input, bool warning_only)
Helper function.
Definition: simulation.C:265
void init_restart(const GetPot &input, SimulationBuilder &sim_builder, const libMesh::Parallel::Communicator &comm)
Helper function.
Definition: simulation.C:249
SharedPtr< libMesh::UnstructuredMesh > _mesh
Definition: simulation.h:124
GRINS::MultiphysicsSystem * _multiphysics_system
Definition: simulation.h:134
unsigned int _timesteps_per_perflog
Definition: simulation.h:156
SharedPtr< GRINS::Visualization > _vis
Definition: simulation.h:136
virtual ~Simulation()
Definition: simulation.h:77
void print_sim_info()
Definition: simulation.C:431
bool check_for_adjoint_solve(const GetPot &input) const
Helper function.
Definition: simulation.C:518
std::string _system_name
GRINS::Multiphysics system name.
Definition: simulation.h:131
SharedPtr< libMesh::EquationSystems > _equation_system
Definition: simulation.h:126

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