GRINS-0.6.0
Public Member Functions | Private Attributes | List of all members
GRINS::PressurePinning Class Reference

Class to hold typical boundary condition methods. More...

#include <pressure_pinning.h>

Public Member Functions

 PressurePinning (const GetPot &input, const std::string &physics_name)
 
 ~PressurePinning ()
 
void pin_value (libMesh::DiffContext &context, const bool request_jacobian, const GRINS::VariableIndex var, const double penalty=1.0)
 The idea here is to pin a variable to a particular value if there is a null space - e.g. More...
 

Private Attributes

libMesh::Number _pin_value
 Value of pressure we wish to pin. More...
 
libMesh::Point _pin_location
 Location we want to pin the pressure. More...
 

Detailed Description

Class to hold typical boundary condition methods.

This class holds functions to apply generic versions of Dirichlet and Neumann boundary conditions.

Definition at line 51 of file pressure_pinning.h.

Constructor & Destructor Documentation

GRINS::PressurePinning::PressurePinning ( const GetPot &  input,
const std::string &  physics_name 
)

Definition at line 40 of file pressure_pinning.C.

References _pin_location, and _pin_value.

42  {
43  _pin_value = input("Physics/"+physics_name+"/pin_value", 0.0 );
44 
45  unsigned int pin_loc_dim = input.vector_variable_size("Physics/"+physics_name+"/pin_location");
46 
47  // If the user is specifying a pin_location, it had better be at least 2-dimensional
48  if( pin_loc_dim > 0 && pin_loc_dim < 2 )
49  {
50  std::cerr << "Error: pressure pin location must be at least 2 dimensional"
51  << std::endl;
52  libmesh_error();
53  }
54 
55  _pin_location(0) = input("Physics/"+physics_name+"/pin_location", 0.0, 0 );
56  _pin_location(1) = input("Physics/"+physics_name+"/pin_location", 0.0, 1 );
57 
58  if( pin_loc_dim == 3 )
59  _pin_location(2) = input("Physics/"+physics_name+"/pin_location", 0.0, 2 );
60 
61  return;
62  }
libMesh::Point _pin_location
Location we want to pin the pressure.
libMesh::Number _pin_value
Value of pressure we wish to pin.
GRINS::PressurePinning::~PressurePinning ( )

Definition at line 64 of file pressure_pinning.C.

65  {
66  return;
67  }

Member Function Documentation

void GRINS::PressurePinning::pin_value ( libMesh::DiffContext &  context,
const bool  request_jacobian,
const GRINS::VariableIndex  var,
const double  penalty = 1.0 
)

The idea here is to pin a variable to a particular value if there is a null space - e.g.

pressure for IncompressibleNavierStokes.

Todo:
pin_location needs to be const. Currently a libMesh restriction.
Todo:
What the hell is the c.get_elem_solution_derivative() all about?

Definition at line 69 of file pressure_pinning.C.

References _pin_location, and _pin_value.

73  {
75  AssemblyContext &c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
76 
77  if (c.get_elem().contains_point(_pin_location))
78  {
79  libMesh::DenseSubVector<libMesh::Number> &F_var = c.get_elem_residual(var); // residual
80  libMesh::DenseSubMatrix<libMesh::Number> &K_var = c.get_elem_jacobian(var, var); // jacobian
81 
82  // The number of local degrees of freedom in p variable.
83  const unsigned int n_var_dofs = c.get_dof_indices(var).size();
84 
85  libMesh::Number var_value = c.point_value(var, _pin_location);
86 
87  libMesh::FEType fe_type = c.get_element_fe(var)->get_fe_type();
88 
89  libMesh::Point point_loc_in_masterelem =
90  libMesh::FEInterface::inverse_map(c.get_dim(), fe_type, &c.get_elem(), _pin_location);
91 
92  std::vector<libMesh::Real> phi(n_var_dofs);
93 
94  for (unsigned int i=0; i != n_var_dofs; i++)
95  phi[i] = libMesh::FEInterface::shape( c.get_dim(), fe_type, &c.get_elem(), i,
96  point_loc_in_masterelem );
97 
98  for (unsigned int i=0; i != n_var_dofs; i++)
99  {
100  F_var(i) += penalty*(var_value - _pin_value)*phi[i];
101 
103  if (request_jacobian && c.get_elem_solution_derivative())
104  {
105  libmesh_assert (c.get_elem_solution_derivative() == 1.0);
106 
107  for (unsigned int j=0; j != n_var_dofs; j++)
108  K_var(i,j) += penalty*phi[i]*phi[j];
109 
110  } // End if request_jacobian
111  } // End i loop
112  } // End if pin_location
113 
114  return;
115  }
libMesh::Point _pin_location
Location we want to pin the pressure.
libMesh::Number _pin_value
Value of pressure we wish to pin.

Member Data Documentation

libMesh::Point GRINS::PressurePinning::_pin_location
private

Location we want to pin the pressure.

Definition at line 72 of file pressure_pinning.h.

Referenced by pin_value(), and PressurePinning().

libMesh::Number GRINS::PressurePinning::_pin_value
private

Value of pressure we wish to pin.

Definition at line 69 of file pressure_pinning.h.

Referenced by pin_value(), and PressurePinning().


The documentation for this class was generated from the following files:

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