GRINS-0.7.0
scalar_ode.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_SCALAR_ODE_H
27 #define GRINS_SCALAR_ODE_H
28 
29 // GRINS
30 #include "grins_config.h"
31 #include "grins/assembly_context.h"
32 #include "grins/cached_values.h"
34 
35 // libMesh
36 #include "libmesh/fem_system.h"
37 #include "libmesh/getpot.h"
38 
39 // C++
40 #include <string>
41 
42 namespace GRINS
43 {
44 
46  /*
47  This physics class allows ODEs specified in ParsedFEMFunction
48  config file arguments to be solved.
49  */
50  class ScalarODE : public Physics
51  {
52  public:
53 
54  ScalarODE( const std::string& physics_name, const GetPot& input );
55 
57 
59 
62  virtual void init_variables( libMesh::FEMSystem* system );
63 
65  virtual void set_time_evolving_vars( libMesh::FEMSystem* system );
66 
68  virtual void init_context( AssemblyContext& context );
69 
70  // residual and jacobian calculations
71 
72  // User-specified ODE(s)
73  virtual void nonlocal_time_derivative ( bool compute_jacobian,
74  AssemblyContext& context,
75  CachedValues& cache );
76 
77  // User-specified constraint equation
78  virtual void nonlocal_constraint ( bool compute_jacobian,
79  AssemblyContext& context,
80  CachedValues& cache );
81 
82  // User-specified (or default "s'") mass term
83  virtual void nonlocal_mass_residual ( bool compute_jacobian,
84  AssemblyContext& context,
85  CachedValues& cache );
86 
88 
89  private:
90 
91  // ParsedFEMFunctions evaluating the mass, time derivative, and
92  // constraint components of an ODE.
93  libMesh::UniquePtr<libMesh::FEMFunctionBase<libMesh::Number> >
97 
98  // Number of components of the scalar solution variable; defaults
99  // to 1.
100  libMesh::Number _order;
101 
102  // Perturbation to use for finite differencing of functions
103  libMesh::Number _epsilon;
104 
105  VariableIndex _scalar_ode_var; /* Index for turbine speed scalar */
106 
107  std::string _scalar_ode_var_name;
108 
109  const GetPot & _input;
110 
111  ScalarODE();
112 
114  void read_input_options( const GetPot& input );
115  };
116 
117 } // end namespace block
118 
119 #endif // GRINS_SCALAR_ODE_H
Physics class for arbitrary scalar-valued ODEs.
Definition: scalar_ode.h:50
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:42
const GetPot & _input
Definition: scalar_ode.h:109
std::string _scalar_ode_var_name
Definition: scalar_ode.h:107
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:107
libMesh::Number _order
Definition: scalar_ode.h:100
libMesh::UniquePtr< libMesh::FEMFunctionBase< libMesh::Number > > mass_residual_function
Definition: scalar_ode.h:94
void read_input_options(const GetPot &input)
Read options from GetPot input file.
Definition: scalar_ode.C:98
virtual void init_context(AssemblyContext &context)
Prepare the context for evaluations.
Definition: scalar_ode.C:109
GRINS namespace.
libMesh::Number _epsilon
Definition: scalar_ode.h:103
virtual void nonlocal_mass_residual(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Mass matrix part(s) for scalar variables.
Definition: scalar_ode.C:163
virtual void nonlocal_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for scalar variables.
Definition: scalar_ode.C:209
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets scalar variable(s) to be time-evolving.
Definition: scalar_ode.C:58
libMesh::UniquePtr< libMesh::FEMFunctionBase< libMesh::Number > > time_deriv_function
Definition: scalar_ode.h:94
virtual void init_variables(libMesh::FEMSystem *system)
Initialization of variables.
Definition: scalar_ode.C:51
virtual void nonlocal_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for scalar variables.
Definition: scalar_ode.C:117
VariableIndex scalar_ode_var() const
Definition: scalar_ode.h:87
VariableIndex _scalar_ode_var
Definition: scalar_ode.h:105
libMesh::UniquePtr< libMesh::FEMFunctionBase< libMesh::Number > > constraint_function
Definition: scalar_ode.h:94

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