GRINS-0.8.0
variable_pinning.C
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 // This class
27 #include "grins/variable_pinning.h"
28 
29 // GRINS
30 #include "grins/common.h"
31 #include "grins/assembly_context.h"
32 #include "grins/physics_naming.h"
34 #include "grins/multiphysics_sys.h"
35 
36 namespace GRINS
37 {
38 
39  VariablePinning::VariablePinning( const GRINS::PhysicsName& physics_name, const GetPot& input )
40  : Physics(physics_name,input),
41  _var_pinning(input,physics_name),
42  _penalty(input("Physics/" + PhysicsNaming::variable_pinning() + "/penalty", 1e10)),
43  _pin_variable(false)
44  {
45  std::string pin_variable_str = "Physics/" +
46  PhysicsNaming::variable_pinning() + "/pin_variable";
47  if (input.have_variable(pin_variable_str))
48  {
49  _variablename_to_pin = input(pin_variable_str, std::string());
50  _pin_variable = true;
51  }
52  }
53 
55  {
56  if( _pin_variable )
57  {
59  system.variable_number(_variablename_to_pin);
60  _var_pinning.check_pin_location(system.get_mesh());
61  }
62  else
63  {
64  // Commenting out pin_variable makes testing easier but never
65  // makes sense in a real run.
66  libMesh::out <<
67  "Warning! VariablePinning physics requested but not used!"
68  << std::endl;
69  }
70  }
71 
73  {
74  // We should prerequest all the data
75  // we will need to build the linear system
76  // or evaluate a quantity of interest.
77  if ( _pin_variable )
78  {
79  context.get_element_fe(_variable_to_pin)->get_JxW();
80  context.get_element_fe(_variable_to_pin)->get_phi();
81  }
82  }
83 
85  ( bool compute_jacobian,
86  AssemblyContext & context )
87  {
88  // Pin var = var_value at p_point
89  if( _pin_variable )
90  _var_pinning.pin_value( context, compute_jacobian, this->_variable_to_pin, this->_penalty );
91  }
92 
93 } // namespace GRINS
virtual void auxiliary_init(MultiphysicsSystem &system)
Initialize pinning helper object.
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:106
std::string _variablename_to_pin
GRINS namespace.
static PhysicsName variable_pinning()
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
void check_pin_location(const libMesh::MeshBase &mesh)
Check the mesh to ensure pin location is found.
std::string PhysicsName
Interface with libMesh for solving Multiphysics problems.
PressurePinning _var_pinning
unsigned int _variable_to_pin
virtual void element_constraint(bool compute_jacobian, AssemblyContext &context)
Time dependent part(s) of physics for element interiors.

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