GRINS-0.6.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-2015 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 "boost/tr1/memory.hpp"
31 
32 // GRINS
33 #include "grins_config.h"
34 #include "grins/grins_solver.h"
35 #include "grins/qoi_base.h"
36 #include "grins/visualization.h"
38 #include "grins/nbc_container.h"
39 #include "grins/dbc_container.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  std::tr1::shared_ptr<libMesh::EquationSystems> get_equation_system();
84 
85  libMesh::Number get_qoi_value( unsigned int qoi_index ) const;
86 
87  const std::string& get_multiphysics_system_name() const;
88 
89 #ifdef GRINS_USE_GRVY_TIMERS
90  void attach_grvy_timer( GRVY::GRVY_Timer_Class* grvy_timer );
91 #endif
92 
93  protected:
94 
95  void read_restart( const GetPot& input );
96 
97  void attach_neumann_bc_funcs( std::map< GRINS::PhysicsName, GRINS::NBCContainer > neumann_bcs,
98  GRINS::MultiphysicsSystem* system );
99 
100  void attach_dirichlet_bc_funcs( std::multimap< GRINS::PhysicsName, GRINS::DBCContainer > dbc_map,
101  GRINS::MultiphysicsSystem* system );
102 
104  void init_multiphysics_system( const GetPot& input,
105  SimulationBuilder& sim_builder );
106 
108  void init_qois( const GetPot& input, SimulationBuilder& sim_builder );
109 
111  void init_params( const GetPot& input, SimulationBuilder& sim_builder );
112 
114  void init_restart( const GetPot& input, SimulationBuilder& sim_builder,
115  const libMesh::Parallel::Communicator &comm );
116 
118  void check_for_unused_vars( const GetPot& input, bool warning_only );
119 
121  bool check_for_adjoint_solve( const GetPot& input ) const;
122 
124  void init_adjoint_solve( const GetPot& input, bool output_adjoint );
125 
126  std::tr1::shared_ptr<libMesh::UnstructuredMesh> _mesh;
127 
128  std::tr1::shared_ptr<libMesh::EquationSystems> _equation_system;
129 
130  std::tr1::shared_ptr<GRINS::Solver> _solver;
131 
133  std::string _system_name;
134 
135  // This needs to be a standard pointer, as _equation_system will own and destroy the object.
137 
138  std::tr1::shared_ptr<GRINS::Visualization> _vis;
139 
140  std::tr1::shared_ptr<PostProcessedQuantities<libMesh::Real> > _postprocessing;
141 
142  // Screen display options
149 
150  // Visualization options
156 
157  unsigned int _timesteps_per_vis;
159 
160  std::tr1::shared_ptr<libMesh::ErrorEstimator> _error_estimator;
161 
163 
165 
166  // Cache whether or not we do an adjoint solve
168 
169  private:
170 
171  Simulation();
172 
173  };
174 
175  inline
176  const std::string& Simulation::get_multiphysics_system_name() const
177  {
178  return this->_system_name;
179  }
180 }
181 #endif // GRINS_SIMULATION_H
void init_multiphysics_system(const GetPot &input, SimulationBuilder &sim_builder)
Helper function.
Definition: simulation.C:145
void attach_neumann_bc_funcs(std::map< GRINS::PhysicsName, GRINS::NBCContainer > neumann_bcs, GRINS::MultiphysicsSystem *system)
Definition: simulation.C:473
void read_restart(const GetPot &input)
Definition: simulation.C:433
ParameterManager _forward_parameters
Definition: simulation.h:164
Simple class to hold and initialize a ParameterVector.
std::tr1::shared_ptr< PostProcessedQuantities< libMesh::Real > > _postprocessing
Definition: simulation.h:140
void init_params(const GetPot &input, SimulationBuilder &sim_builder)
Helper function.
Definition: simulation.C:204
unsigned int _timesteps_per_vis
Definition: simulation.h:157
GRINS namespace.
void attach_dirichlet_bc_funcs(std::multimap< GRINS::PhysicsName, GRINS::DBCContainer > dbc_map, GRINS::MultiphysicsSystem *system)
Definition: simulation.C:492
std::tr1::shared_ptr< libMesh::EquationSystems > _equation_system
Definition: simulation.h:128
virtual ~Simulation()
Definition: simulation.C:140
bool _print_equation_system_info
Definition: simulation.h:145
libMesh::Number get_qoi_value(unsigned int qoi_index) const
Definition: simulation.C:427
const std::string & get_multiphysics_system_name() const
Definition: simulation.h:176
std::tr1::shared_ptr< libMesh::EquationSystems > get_equation_system()
Definition: simulation.C:422
void init_adjoint_solve(const GetPot &input, bool output_adjoint)
Helper function.
Definition: simulation.C:506
std::tr1::shared_ptr< GRINS::Visualization > _vis
Definition: simulation.h:138
void init_qois(const GetPot &input, SimulationBuilder &sim_builder)
Helper function.
Definition: simulation.C:181
Interface with libMesh for solving Multiphysics problems.
ParameterManager _adjoint_parameters
Definition: simulation.h:162
bool _output_residual_sensitivities
Definition: simulation.h:154
bool _output_solution_sensitivities
Definition: simulation.h:155
std::tr1::shared_ptr< libMesh::UnstructuredMesh > _mesh
Definition: simulation.h:126
void check_for_unused_vars(const GetPot &input, bool warning_only)
Helper function.
Definition: simulation.C:273
std::tr1::shared_ptr< GRINS::Solver > _solver
Definition: simulation.h:130
void init_restart(const GetPot &input, SimulationBuilder &sim_builder, const libMesh::Parallel::Communicator &comm)
Helper function.
Definition: simulation.C:257
std::tr1::shared_ptr< libMesh::ErrorEstimator > _error_estimator
Definition: simulation.h:160
GRINS::MultiphysicsSystem * _multiphysics_system
Definition: simulation.h:136
unsigned int _timesteps_per_perflog
Definition: simulation.h:158
void print_sim_info()
Definition: simulation.C:411
bool check_for_adjoint_solve(const GetPot &input) const
Helper function.
Definition: simulation.C:529
std::string _system_name
GRINS::Multiphysics system name.
Definition: simulation.h:133

Generated on Mon Jun 22 2015 21:32:20 for GRINS-0.6.0 by  doxygen 1.8.9.1