GRINS-0.6.0
physics.C
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 // This class
27 #include "grins/physics.h"
28 
29 // GRINS
30 #include "grins/bc_handling_base.h"
31 #include "grins/ic_handling_base.h"
32 
33 // libMesh
34 #include "libmesh/getpot.h"
35 #include "libmesh/elem.h"
36 
37 namespace GRINS
38 {
39  // Initialize static members
40  bool Physics::_is_steady = false;
41 
42  Physics::Physics( const std::string& physics_name,
43  const GetPot& input )
44  : ParameterUser(physics_name),
45  _physics_name( physics_name ),
46  _bc_handler(NULL),
47  _ic_handler(new ICHandlingBase(physics_name)),
48  _is_axisymmetric(false)
49  {
50  this->read_input_options(input);
51 
52  if( input( "Physics/is_axisymmetric", false ) )
53  {
54  _is_axisymmetric = true;
55  }
56 
57  return;
58  }
59 
61  {
62  // If a derived class created a bc_handler object, we kill it here.
63  if( _bc_handler ) delete _bc_handler;
64 
65  if( _ic_handler ) delete _ic_handler;
66 
67  return;
68  }
69 
70  void Physics::read_input_options( const GetPot& input )
71  {
72  int num_ids = input.vector_variable_size( "Physics/"+this->_physics_name+"/enabled_subdomains" );
73 
74  for( int i = 0; i < num_ids; i++ )
75  {
76  libMesh::subdomain_id_type dumvar = input( "Physics/"+this->_physics_name+"/enabled_subdomains", -1, i );
77  _enabled_subdomains.insert( dumvar );
78  }
79 
80  return;
81  }
82 
83  bool Physics::enabled_on_elem( const libMesh::Elem* elem )
84  {
85  // Check if enabled_subdomains flag has been set and if we're
86  // looking at a real element (rather than a nonlocal evaluation)
87  if( !elem || _enabled_subdomains.empty() )
88  return true;
89 
90  // Check if current physics is enabled on elem
91  if( _enabled_subdomains.find( elem->subdomain_id() ) == _enabled_subdomains.end() )
92  return false;
93 
94  return true;
95  }
96 
97  void Physics::set_is_steady( bool is_steady )
98  {
100  return;
101  }
102 
103  bool Physics::is_steady() const
104  {
105  return _is_steady;
106  }
107 
108  void Physics::set_time_evolving_vars( libMesh::FEMSystem* /*system*/ )
109  {
110  return;
111  }
112 
114  {
115  return;
116  }
117 
118  void Physics::init_bcs( libMesh::FEMSystem* system )
119  {
120  // Only need to init BC's if the physics actually created a handler
121  if( _bc_handler )
122  {
123  _bc_handler->init_bc_data( *system );
124  _bc_handler->init_dirichlet_bcs( system );
126  _bc_handler->init_periodic_bcs( system );
127  }
128 
129  return;
130  }
131 
132 
133  void Physics::init_ics( libMesh::FEMSystem* system,
135  {
136  if( _ic_handler )
137  {
138  _ic_handler->init_ic_data( *system, all_ics );
139  }
140 
141  return;
142  }
143 
145  {
146  _bc_handler->attach_neumann_bound_func( neumann_bcs );
147  return;
148  }
149 
151  {
152  _bc_handler->attach_dirichlet_bound_func( dirichlet_bc );
153  return;
154  }
155 
157  {
158  return;
159  }
160 
161  void Physics::register_postprocessing_vars( const GetPot& /*input*/,
162  PostProcessedQuantities<libMesh::Real>& /*postprocessing*/ )
163  {
164  return;
165  }
166 
168  CachedValues& )
169  {
170  return;
171  }
172 
174  CachedValues& /*cache*/ )
175  {
176  return;
177  }
178 
180  CachedValues& /*cache*/ )
181  {
182  return;
183  }
184 
186  CachedValues& /*cache*/ )
187  {
188  return;
189  }
190 
192  CachedValues& /*cache*/ )
193  {
194  return;
195  }
196 
198  CachedValues& /*cache*/ )
199  {
200  return;
201  }
202 
204  CachedValues& /*cache*/ )
205  {
206  return;
207  }
208 
210  CachedValues& /*cache*/ )
211  {
212  return;
213  }
214 
215  void Physics::element_time_derivative( bool /*compute_jacobian*/,
216  AssemblyContext& /*context*/,
217  CachedValues& /*cache*/ )
218  {
219  return;
220  }
221 
222  void Physics::side_time_derivative( bool /*compute_jacobian*/,
223  AssemblyContext& /*context*/,
224  CachedValues& /*cache*/ )
225  {
226  return;
227  }
228 
229  void Physics::nonlocal_time_derivative( bool /*compute_jacobian*/,
230  AssemblyContext& /*context*/,
231  CachedValues& /*cache*/ )
232  {
233  return;
234  }
235 
236  void Physics::element_constraint( bool /*compute_jacobian*/,
237  AssemblyContext& /*context*/,
238  CachedValues& /*cache*/ )
239  {
240  return;
241  }
242 
243  void Physics::side_constraint( bool /*compute_jacobian*/,
244  AssemblyContext& /*context*/,
245  CachedValues& /*cache*/ )
246  {
247  return;
248  }
249 
250  void Physics::nonlocal_constraint( bool /*compute_jacobian*/,
251  AssemblyContext& /*context*/,
252  CachedValues& /*cache*/ )
253  {
254  return;
255  }
256 
257  void Physics::mass_residual( bool /*compute_jacobian*/,
258  AssemblyContext& /*context*/,
259  CachedValues& /*cache*/ )
260  {
261  return;
262  }
263 
264  void Physics::nonlocal_mass_residual( bool /*compute_jacobian*/,
265  AssemblyContext& /*context*/,
266  CachedValues& /*cache*/ )
267  {
268  return;
269  }
270 
271  void Physics::compute_postprocessed_quantity( unsigned int /*quantity_index*/,
272  const AssemblyContext& /*context*/,
273  const libMesh::Point& /*point*/,
274  libMesh::Real& /*value*/ )
275  {
276  return;
277  }
278 
279 #ifdef GRINS_USE_GRVY_TIMERS
280  void Physics::attach_grvy_timer( GRVY::GRVY_Timer_Class* grvy_timer )
281  {
282  _timer = grvy_timer;
283  return;
284  }
285 #endif
286 
287 } // namespace GRINS
virtual void compute_postprocessed_quantity(unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
Definition: physics.C:271
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:258
bool is_steady() const
Returns whether or not this physics is being solved with a steady solver.
Definition: physics.C:103
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
Simple helper class to setup general Dirichlet boundary conditions.
Definition: dbc_container.h:49
virtual void register_postprocessing_vars(const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
Register name of postprocessed quantity with PostProcessedQuantities.
Definition: physics.C:161
void attach_dirichlet_bound_func(const GRINS::DBCContainer &dirichlet_bc)
virtual void nonlocal_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for scalar variables.
Definition: physics.C:229
virtual void compute_mass_residual_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:203
void attach_neumann_bound_func(GRINS::NBCContainer &neumann_bcs)
void attach_dirichlet_bound_func(const GRINS::DBCContainer &dirichlet_bc)
Definition: physics.C:150
virtual ~Physics()
Definition: physics.C:60
virtual void compute_element_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:167
virtual void element_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for element interiors.
Definition: physics.C:236
virtual void compute_side_constraint_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:191
GRINS namespace.
void init_bcs(libMesh::FEMSystem *system)
Definition: physics.C:118
Simple helper class to setup general Neumann boundary conditions.
Definition: nbc_container.h:41
virtual void read_input_options(const GetPot &input)
Read options from GetPot input file. By default, nothing is read.
Definition: physics.C:70
virtual void compute_element_constraint_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:185
virtual void compute_side_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:173
const PhysicsName _physics_name
Name of the physics object. Used for reading physics specific inputs.
Definition: physics.h:254
ParameterUser base class. Utility methods for subclasses.
virtual bool enabled_on_elem(const libMesh::Elem *elem)
Find if current physics is active on supplied element.
Definition: physics.C:83
virtual void side_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for boundaries of elements on the domain boundary.
Definition: physics.C:243
virtual void auxiliary_init(MultiphysicsSystem &system)
Any auxillary initialization a Physics class may need.
Definition: physics.C:113
Base class for reading and handling initial conditions for physics classes.
virtual void init_dirichlet_bcs(libMesh::FEMSystem *system) const
virtual void nonlocal_mass_residual(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Mass matrix part(s) for scalar variables.
Definition: physics.C:264
static bool _is_steady
Caches whether or not the solver that's being used is steady or not.
Definition: physics.h:266
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Set which variables are time evolving.
Definition: physics.C:108
Interface with libMesh for solving Multiphysics problems.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
Definition: physics.C:156
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for element interiors.
Definition: physics.C:215
virtual void init_periodic_bcs(libMesh::FEMSystem *system) const
virtual void init_dirichlet_bc_func_objs(libMesh::FEMSystem *system) const
virtual void side_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for boundaries of elements on the domain boundary.
Definition: physics.C:222
virtual void init_ic_data(const libMesh::FEMSystem &system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
Override this method to initialize any system-dependent data.
virtual void compute_nonlocal_mass_residual_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:209
void attach_neumann_bound_func(GRINS::NBCContainer &neumann_bcs)
Definition: physics.C:144
virtual void compute_nonlocal_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:179
virtual void init_bc_data(const libMesh::FEMSystem &system)
Override this method to initialize any system-dependent data.
virtual void compute_nonlocal_constraint_cache(const AssemblyContext &context, CachedValues &cache)
Definition: physics.C:197
bool _is_axisymmetric
Definition: physics.h:268
virtual void nonlocal_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for scalar variables.
Definition: physics.C:250
void init_ics(libMesh::FEMSystem *system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
Definition: physics.C:133
std::set< libMesh::subdomain_id_type > _enabled_subdomains
Subdomains on which the current Physics class is enabled.
Definition: physics.h:261
void set_is_steady(bool is_steady)
Sets whether this physics is to be solved with a steady solver or not.
Definition: physics.C:97
virtual void mass_residual(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part...
Definition: physics.C:257

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