GRINS-0.6.0
Public Member Functions | List of all members
GRINS::BoundaryConditions Class Reference

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

#include <boundary_conditions.h>

Public Member Functions

 BoundaryConditions ()
 
 ~BoundaryConditions ()
 
template<typename FEShape = libMesh::Real>
void apply_neumann (AssemblyContext &context, const VariableIndex var, const libMesh::Real sign, const typename libMesh::TensorTools::IncrementRank< FEShape >::type &value) const
 Applies Neumann boundary conditions for the constant case. More...
 
template<typename FEShape = libMesh::Real>
void apply_neumann_axisymmetric (AssemblyContext &context, const VariableIndex var, const libMesh::Real sign, const typename libMesh::TensorTools::IncrementRank< FEShape >::type &value) const
 Applies Neumann boundary conditions for the constant case. More...
 
template<typename FEShape = libMesh::Real>
void apply_neumann_normal (AssemblyContext &context, const VariableIndex var, const libMesh::Real sign, const FEShape &value) const
 Applies Neumann boundary conditions for the constant case. More...
 
template<typename FEShape = libMesh::Real>
void apply_neumann_normal_axisymmetric (AssemblyContext &context, const VariableIndex var, const libMesh::Real sign, const FEShape &value) const
 Applies Neumann boundary conditions for the constant case. More...
 
template<typename FEShape = libMesh::Real>
void apply_neumann (AssemblyContext &context, const CachedValues &cache, const bool request_jacobian, const VariableIndex var, const libMesh::Real sign, std::tr1::shared_ptr< NeumannFuncObj > neumann_func) const
 Applies Neumann boundary conditions using a user-supplied function. More...
 
template<typename FEShape = libMesh::Real>
void apply_neumann_axisymmetric (AssemblyContext &context, const CachedValues &cache, const bool request_jacobian, const VariableIndex var, const libMesh::Real sign, const std::tr1::shared_ptr< NeumannFuncObj > neumann_func) const
 Applies Neumann boundary conditions using a user-supplied function. More...
 
template<typename FEShape = libMesh::Real>
void apply_neumann_normal (AssemblyContext &context, const CachedValues &cache, const bool request_jacobian, const VariableIndex var, const libMesh::Real sign, std::tr1::shared_ptr< NeumannFuncObj > neumann_func) const
 Applies Neumann boundary conditions using a user-supplied function. More...
 
template<typename FEShape = libMesh::Real>
void apply_neumann_normal_axisymmetric (AssemblyContext &context, const CachedValues &cache, const bool request_jacobian, const VariableIndex var, const libMesh::Real sign, std::tr1::shared_ptr< NeumannFuncObj > neumann_func) const
 Applies Neumann boundary conditions using a user-supplied function. More...
 
template<typename FEShape = libMesh::Real>
void pin_value (AssemblyContext &context, const CachedValues &cache, const bool request_jacobian, const VariableIndex var, const double value, const libMesh::Point &pin_location, 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...
 

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 48 of file boundary_conditions.h.

Constructor & Destructor Documentation

GRINS::BoundaryConditions::BoundaryConditions ( )

Definition at line 43 of file boundary_conditions.C.

44  {
45  return;
46  }
GRINS::BoundaryConditions::~BoundaryConditions ( )

Definition at line 48 of file boundary_conditions.C.

49  {
50  return;
51  }

Member Function Documentation

template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann ( AssemblyContext context,
const VariableIndex  var,
const libMesh::Real  sign,
const typename libMesh::TensorTools::IncrementRank< FEShape >::type &  value 
) const

Applies Neumann boundary conditions for the constant case.

Definition at line 54 of file boundary_conditions.C.

Referenced by GRINS::HeatTransferBCHandling::user_apply_neumann_bcs().

58  {
59  libMesh::FEGenericBase<FEShape>* side_fe = NULL;
60  context.get_side_fe( var, side_fe );
61 
62  // The number of local degrees of freedom in each variable.
63  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
64 
65  // Element Jacobian * quadrature weight for side integration.
66  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
67 
68  // The var shape functions at side quadrature points.
69  const std::vector<std::vector<FEShape> >& var_phi_side = side_fe->get_phi();
70 
71  const std::vector<libMesh::Point> &normals = side_fe->get_normals();
72 
73  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
74 
75  unsigned int n_qpoints = context.get_side_qrule().n_points();
76  for (unsigned int qp=0; qp != n_qpoints; qp++)
77  {
78  for (unsigned int i=0; i != n_var_dofs; i++)
79  {
80  F_var(i) += sign*JxW_side[qp]*value*normals[qp]*var_phi_side[i][qp];
81  }
82  }
83 
84  return;
85  }
template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann ( AssemblyContext context,
const CachedValues cache,
const bool  request_jacobian,
const VariableIndex  var,
const libMesh::Real  sign,
std::tr1::shared_ptr< NeumannFuncObj neumann_func 
) const

Applies Neumann boundary conditions using a user-supplied function.

This function must also be aware of the Jacobian with respect to other variables.

Definition at line 201 of file boundary_conditions.C.

207  {
208  libMesh::FEGenericBase<libMesh::Real>* side_fe = NULL;
209  context.get_side_fe( var, side_fe );
210 
211  // The number of local degrees of freedom
212  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
213 
214  // Element Jacobian * quadrature weight for side integration.
215  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
216 
217  // The var shape functions at side quadrature points.
218  const std::vector<std::vector<libMesh::Real> >& var_phi_side =
219  side_fe->get_phi();
220 
221  const std::vector<libMesh::Point> &normals = side_fe->get_normals();
222 
223  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
224  libMesh::DenseSubMatrix<libMesh::Number> &K_var = context.get_elem_jacobian(var,var); // jacobian
225 
226  unsigned int n_qpoints = context.get_side_qrule().n_points();
227 
228  for (unsigned int qp=0; qp != n_qpoints; qp++)
229  {
230  const libMesh::Point bc_value = neumann_func->value( context, cache, qp );
231 
232  libMesh::Point jac_value;
233  if(request_jacobian)
234  {
235  jac_value = neumann_func->derivative( context, cache, qp );
236  }
237 
238  for (unsigned int i=0; i != n_var_dofs; i++)
239  {
240  F_var(i) += sign*JxW_side[qp]*bc_value*normals[qp]*var_phi_side[i][qp];
241 
242  if (request_jacobian)
243  {
244  for (unsigned int j=0; j != n_var_dofs; j++)
245  {
246  K_var(i,j) += sign*JxW_side[qp]*jac_value*normals[qp]*
247  var_phi_side[i][qp]*var_phi_side[j][qp];
248  }
249  }
250  }
251  } // End quadrature loop
252 
253  // Now must take care of the case that the boundary condition depends on variables
254  // other than var.
255  std::vector<VariableIndex> other_jac_vars = neumann_func->get_other_jac_vars();
256 
257  if( (other_jac_vars.size() > 0) && request_jacobian )
258  {
259  for( std::vector<VariableIndex>::const_iterator var2 = other_jac_vars.begin();
260  var2 != other_jac_vars.end();
261  var2++ )
262  {
263  libMesh::FEGenericBase<libMesh::Real>* side_fe2 = NULL;
264  context.get_side_fe( *var2, side_fe2 );
265 
266  libMesh::DenseSubMatrix<libMesh::Number> &K_var2 = context.get_elem_jacobian(var,*var2); // jacobian
267 
268  const unsigned int n_var2_dofs = context.get_dof_indices(*var2).size();
269  const std::vector<std::vector<libMesh::Real> >& var2_phi_side =
270  side_fe2->get_phi();
271 
272  for (unsigned int qp=0; qp != n_qpoints; qp++)
273  {
274  const libMesh::Point jac_value = neumann_func->derivative( context, cache, qp, *var2 );
275 
276  for (unsigned int i=0; i != n_var_dofs; i++)
277  {
278  for (unsigned int j=0; j != n_var2_dofs; j++)
279  {
280  K_var2(i,j) += sign*JxW_side[qp]*jac_value*normals[qp]*
281  var_phi_side[i][qp]*var2_phi_side[j][qp];
282  }
283  }
284  }
285  } // End loop over auxillary Jacobian variables
286  }
287  return;
288  }
template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann_axisymmetric ( AssemblyContext context,
const VariableIndex  var,
const libMesh::Real  sign,
const typename libMesh::TensorTools::IncrementRank< FEShape >::type &  value 
) const

Applies Neumann boundary conditions for the constant case.

Definition at line 160 of file boundary_conditions.C.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::user_apply_neumann_bcs(), and GRINS::HeatTransferBCHandling::user_apply_neumann_bcs().

164  {
165  libMesh::FEGenericBase<FEShape>* side_fe = NULL;
166  context.get_side_fe( var, side_fe );
167 
168  // The number of local degrees of freedom in each variable.
169  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
170 
171  // Element Jacobian * quadrature weight for side integration.
172  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
173 
174  // The var shape functions at side quadrature points.
175  const std::vector<std::vector<FEShape> >& var_phi_side =
176  side_fe->get_phi();
177 
178  // Physical location of the quadrature points
179  const std::vector<libMesh::Point>& var_qpoint =
180  side_fe->get_xyz();
181 
182  const std::vector<libMesh::Point> &normals = side_fe->get_normals();
183 
184  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
185 
186  unsigned int n_qpoints = context.get_side_qrule().n_points();
187  for (unsigned int qp=0; qp != n_qpoints; qp++)
188  {
189  const libMesh::Number r = var_qpoint[qp](0);
190 
191  for (unsigned int i=0; i != n_var_dofs; i++)
192  {
193  F_var(i) += sign*r*JxW_side[qp]*value*normals[qp]*var_phi_side[i][qp];
194  }
195  }
196 
197  return;
198  }
template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann_axisymmetric ( AssemblyContext context,
const CachedValues cache,
const bool  request_jacobian,
const VariableIndex  var,
const libMesh::Real  sign,
const std::tr1::shared_ptr< NeumannFuncObj neumann_func 
) const

Applies Neumann boundary conditions using a user-supplied function.

This function must also be aware of the Jacobian with respect to other variables.

Definition at line 472 of file boundary_conditions.C.

478  {
479  libMesh::FEGenericBase<libMesh::Real>* side_fe = NULL;
480  context.get_side_fe( var, side_fe );
481 
482  // The number of local degrees of freedom
483  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
484 
485  // Element Jacobian * quadrature weight for side integration.
486  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
487 
488  // The var shape functions at side quadrature points.
489  const std::vector<std::vector<libMesh::Real> >& var_phi_side =
490  side_fe->get_phi();
491 
492  // Physical location of the quadrature points
493  const std::vector<libMesh::Point>& var_qpoint =
494  side_fe->get_xyz();
495 
496  const std::vector<libMesh::Point> &normals = side_fe->get_normals();
497 
498  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
499  libMesh::DenseSubMatrix<libMesh::Number> &K_var = context.get_elem_jacobian(var,var); // jacobian
500 
501  unsigned int n_qpoints = context.get_side_qrule().n_points();
502 
503  for (unsigned int qp=0; qp != n_qpoints; qp++)
504  {
505  const libMesh::Point bc_value = neumann_func->value( context, cache, qp );
506  libMesh::Point jac_value;
507  if (request_jacobian)
508  {
509  jac_value = neumann_func->derivative( context, cache, qp );
510  }
511 
512  const libMesh::Number r = var_qpoint[qp](0);
513 
514  for (unsigned int i=0; i != n_var_dofs; i++)
515  {
516  F_var(i) += sign*r*JxW_side[qp]*bc_value*normals[qp]*var_phi_side[i][qp];
517 
518  if (request_jacobian)
519  {
520  for (unsigned int j=0; j != n_var_dofs; j++)
521  {
522  K_var(i,j) += sign*r*JxW_side[qp]*jac_value*normals[qp]*
523  var_phi_side[i][qp]*var_phi_side[j][qp];
524  }
525  }
526  }
527  } // End quadrature loop
528 
529  // Now must take care of the case that the boundary condition depends on variables
530  // other than var.
531  std::vector<VariableIndex> other_jac_vars = neumann_func->get_other_jac_vars();
532 
533  if( (other_jac_vars.size() > 0) && request_jacobian )
534  {
535  for( std::vector<VariableIndex>::const_iterator var2 = other_jac_vars.begin();
536  var2 != other_jac_vars.end();
537  var2++ )
538  {
539  libMesh::FEGenericBase<libMesh::Real>* side_fe2 = NULL;
540  context.get_side_fe( *var2, side_fe2 );
541 
542  libMesh::DenseSubMatrix<libMesh::Number> &K_var2 = context.get_elem_jacobian(var,*var2); // jacobian
543 
544  const unsigned int n_var2_dofs = context.get_dof_indices(*var2).size();
545  const std::vector<std::vector<libMesh::Real> >& var2_phi_side =
546  side_fe2->get_phi();
547 
548  for (unsigned int qp=0; qp != n_qpoints; qp++)
549  {
550  const libMesh::Number r = var_qpoint[qp](0);
551 
552  const libMesh::Point jac_value = neumann_func->derivative( context, cache, qp, *var2 );
553 
554  for (unsigned int i=0; i != n_var_dofs; i++)
555  {
556  for (unsigned int j=0; j != n_var2_dofs; j++)
557  {
558  K_var2(i,j) += sign*r*JxW_side[qp]*jac_value*normals[qp]*
559  var_phi_side[i][qp]*var2_phi_side[j][qp];
560  }
561  }
562  }
563  } // End loop over auxillary Jacobian variables
564  }
565  return;
566  }
template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann_normal ( AssemblyContext context,
const VariableIndex  var,
const libMesh::Real  sign,
const FEShape &  value 
) const

Applies Neumann boundary conditions for the constant case.

This method is for the case where Neumann boundary condition is not in terms of a flux vector, but rather only the normal component.

Definition at line 88 of file boundary_conditions.C.

Referenced by GRINS::SolidMechanicsBCHandling::user_apply_neumann_bcs().

92  {
93  libMesh::FEGenericBase<FEShape>* side_fe = NULL;
94  context.get_side_fe( var, side_fe );
95 
96  // The number of local degrees of freedom in each variable.
97  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
98 
99  // Element Jacobian * quadrature weight for side integration.
100  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
101 
102  // The var shape functions at side quadrature points.
103  const std::vector<std::vector<FEShape> >& var_phi_side = side_fe->get_phi();
104 
105  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
106 
107  unsigned int n_qpoints = context.get_side_qrule().n_points();
108  for (unsigned int qp=0; qp != n_qpoints; qp++)
109  {
110  for (unsigned int i=0; i != n_var_dofs; i++)
111  {
112  F_var(i) += sign*value*var_phi_side[i][qp]*JxW_side[qp];
113  }
114  }
115 
116  return;
117  }
template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann_normal ( AssemblyContext context,
const CachedValues cache,
const bool  request_jacobian,
const VariableIndex  var,
const libMesh::Real  sign,
std::tr1::shared_ptr< NeumannFuncObj neumann_func 
) const

Applies Neumann boundary conditions using a user-supplied function.

This method is for the case where Neumann boundary condition is not in terms of a flux vector, but rather only the normal component. This function must also be aware of the Jacobian with respect to other variables.

Definition at line 291 of file boundary_conditions.C.

297  {
298  libMesh::FEGenericBase<libMesh::Real>* side_fe = NULL;
299  context.get_side_fe( var, side_fe );
300 
301  // The number of local degrees of freedom
302  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
303 
304  // Element Jacobian * quadrature weight for side integration.
305  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
306 
307  // The var shape functions at side quadrature points.
308  const std::vector<std::vector<libMesh::Real> >& var_phi_side =
309  side_fe->get_phi();
310 
311  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
312  libMesh::DenseSubMatrix<libMesh::Number> &K_var = context.get_elem_jacobian(var,var); // jacobian
313 
314  unsigned int n_qpoints = context.get_side_qrule().n_points();
315 
316  for (unsigned int qp=0; qp != n_qpoints; qp++)
317  {
318  const libMesh::Real bc_value = neumann_func->normal_value( context, cache, qp );
319  libMesh::Real jac_value = 0.0;
320  if(request_jacobian)
321  {
322  jac_value = neumann_func->normal_derivative( context, cache, qp );
323  }
324 
325  for (unsigned int i=0; i != n_var_dofs; i++)
326  {
327  F_var(i) += sign*bc_value*var_phi_side[i][qp]*JxW_side[qp];
328 
329  if (request_jacobian)
330  {
331  for (unsigned int j=0; j != n_var_dofs; j++)
332  {
333  K_var(i,j) += sign*jac_value*
334  var_phi_side[i][qp]*var_phi_side[j][qp]*JxW_side[qp];
335  }
336  }
337  }
338  } // End quadrature loop
339 
340  // Now must take care of the case that the boundary condition depends on variables
341  // other than var.
342  std::vector<VariableIndex> other_jac_vars = neumann_func->get_other_jac_vars();
343 
344  if( (other_jac_vars.size() > 0) && request_jacobian )
345  {
346  for( std::vector<VariableIndex>::const_iterator var2 = other_jac_vars.begin();
347  var2 != other_jac_vars.end();
348  var2++ )
349  {
350  libMesh::FEGenericBase<libMesh::Real>* side_fe2 = NULL;
351  context.get_side_fe( *var2, side_fe2 );
352 
353  libMesh::DenseSubMatrix<libMesh::Number> &K_var2 = context.get_elem_jacobian(var,*var2); // jacobian
354 
355  const unsigned int n_var2_dofs = context.get_dof_indices(*var2).size();
356  const std::vector<std::vector<libMesh::Real> >& var2_phi_side =
357  side_fe2->get_phi();
358 
359  for (unsigned int qp=0; qp != n_qpoints; qp++)
360  {
361  const libMesh::Real jac_value = neumann_func->normal_derivative( context, cache, qp, *var2 );
362 
363  for (unsigned int i=0; i != n_var_dofs; i++)
364  {
365  for (unsigned int j=0; j != n_var2_dofs; j++)
366  {
367  K_var2(i,j) += sign*jac_value*
368  var_phi_side[i][qp]*var2_phi_side[j][qp]*JxW_side[qp];
369  }
370  }
371  }
372  } // End loop over auxillary Jacobian variables
373  }
374  return;
375  }
template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann_normal_axisymmetric ( AssemblyContext context,
const VariableIndex  var,
const libMesh::Real  sign,
const FEShape &  value 
) const

Applies Neumann boundary conditions for the constant case.

This method is for the case where Neumann boundary condition is not in terms of a flux vector, but rather only the normal component.

Definition at line 120 of file boundary_conditions.C.

124  {
125  libMesh::FEGenericBase<FEShape>* side_fe = NULL;
126  context.get_side_fe( var, side_fe );
127 
128  // The number of local degrees of freedom in each variable.
129  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
130 
131  // Element Jacobian * quadrature weight for side integration.
132  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
133 
134  // The var shape functions at side quadrature points.
135  const std::vector<std::vector<FEShape> >& var_phi_side =
136  side_fe->get_phi();
137 
138  // Physical location of the quadrature points
139  const std::vector<libMesh::Point>& var_qpoint =
140  side_fe->get_xyz();
141 
142  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
143 
144  unsigned int n_qpoints = context.get_side_qrule().n_points();
145 
146  for (unsigned int qp=0; qp != n_qpoints; qp++)
147  {
148  const libMesh::Number r = var_qpoint[qp](0);
149 
150  for (unsigned int i=0; i != n_var_dofs; i++)
151  {
152  F_var(i) += sign*r*value*var_phi_side[i][qp]*JxW_side[qp];
153  }
154  }
155 
156  return;
157  }
template<typename FEShape >
void GRINS::BoundaryConditions::apply_neumann_normal_axisymmetric ( AssemblyContext context,
const CachedValues cache,
const bool  request_jacobian,
const VariableIndex  var,
const libMesh::Real  sign,
std::tr1::shared_ptr< NeumannFuncObj neumann_func 
) const

Applies Neumann boundary conditions using a user-supplied function.

This method is for the case where Neumann boundary condition is not in terms of a flux vector, but rather only the normal component. This function must also be aware of the Jacobian with respect to other variables.

Definition at line 378 of file boundary_conditions.C.

384  {
385  libMesh::FEGenericBase<libMesh::Real>* side_fe = NULL;
386  context.get_side_fe( var, side_fe );
387 
388  // The number of local degrees of freedom
389  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
390 
391  // Element Jacobian * quadrature weight for side integration.
392  const std::vector<libMesh::Real> &JxW_side = side_fe->get_JxW();
393 
394  // The var shape functions at side quadrature points.
395  const std::vector<std::vector<libMesh::Real> >& var_phi_side = side_fe->get_phi();
396 
397  // Physical location of the quadrature points
398  const std::vector<libMesh::Point>& var_qpoint = side_fe->get_xyz();
399 
400  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
401  libMesh::DenseSubMatrix<libMesh::Number> &K_var = context.get_elem_jacobian(var,var); // jacobian
402 
403  unsigned int n_qpoints = context.get_side_qrule().n_points();
404 
405  for (unsigned int qp=0; qp != n_qpoints; qp++)
406  {
407  const libMesh::Real bc_value = neumann_func->normal_value( context, cache, qp );
408  libMesh::Real jac_value = 0.0;
409  if(request_jacobian)
410  {
411  jac_value = neumann_func->normal_derivative( context, cache, qp );
412  }
413 
414  const libMesh::Number r = var_qpoint[qp](0);
415 
416  for (unsigned int i=0; i != n_var_dofs; i++)
417  {
418  F_var(i) += sign*r*bc_value*var_phi_side[i][qp]*JxW_side[qp];
419 
420  if (request_jacobian)
421  {
422  for (unsigned int j=0; j != n_var_dofs; j++)
423  {
424  K_var(i,j) += sign*r*jac_value*
425  var_phi_side[i][qp]*var_phi_side[j][qp]*JxW_side[qp];
426  }
427  }
428  }
429  } // End quadrature loop
430 
431  // Now must take care of the case that the boundary condition depends on variables
432  // other than var.
433  std::vector<VariableIndex> other_jac_vars = neumann_func->get_other_jac_vars();
434 
435  if( (other_jac_vars.size() > 0) && request_jacobian )
436  {
437  for( std::vector<VariableIndex>::const_iterator var2 = other_jac_vars.begin();
438  var2 != other_jac_vars.end();
439  var2++ )
440  {
441  libMesh::FEGenericBase<libMesh::Real>* side_fe2 = NULL;
442  context.get_side_fe( *var2, side_fe2 );
443 
444  libMesh::DenseSubMatrix<libMesh::Number> &K_var2 = context.get_elem_jacobian(var,*var2); // jacobian
445 
446  const unsigned int n_var2_dofs = context.get_dof_indices(*var2).size();
447  const std::vector<std::vector<libMesh::Real> >& var2_phi_side =
448  side_fe2->get_phi();
449 
450  for (unsigned int qp=0; qp != n_qpoints; qp++)
451  {
452  const libMesh::Real jac_value = neumann_func->normal_derivative( context, cache, qp, *var2 );
453 
454  const libMesh::Number r = var_qpoint[qp](0);
455 
456  for (unsigned int i=0; i != n_var_dofs; i++)
457  {
458  for (unsigned int j=0; j != n_var2_dofs; j++)
459  {
460  K_var2(i,j) += sign*r*jac_value*
461  var_phi_side[i][qp]*var2_phi_side[j][qp]*JxW_side[qp];
462  }
463  }
464  }
465  } // End loop over auxillary Jacobian variables
466  }
467  return;
468  }
template<typename FEShape >
void GRINS::BoundaryConditions::pin_value ( AssemblyContext context,
const CachedValues cache,
const bool  request_jacobian,
const VariableIndex  var,
const double  value,
const libMesh::Point &  pin_location,
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:
What the hell is the context.get_elem_solution_derivative() all about?

Definition at line 569 of file boundary_conditions.C.

576  {
577  if (context.get_elem().contains_point(pin_location))
578  {
579  libMesh::FEGenericBase<libMesh::Real>* elem_fe = NULL;
580  context.get_element_fe( var, elem_fe );
581 
582  libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var); // residual
583  libMesh::DenseSubMatrix<libMesh::Number> &K_var = context.get_elem_jacobian(var,var); // jacobian
584 
585  // The number of local degrees of freedom in p variable.
586  const unsigned int n_var_dofs = context.get_dof_indices(var).size();
587 
588  libMesh::Number var_value = context.point_value(var, pin_location);
589 
590  libMesh::FEType fe_type = elem_fe->get_fe_type();
591 
592  libMesh::Point point_loc_in_masterelem =
593  libMesh::FEInterface::inverse_map(context.get_dim(), fe_type, &context.get_elem(), pin_location);
594 
595  std::vector<libMesh::Real> phi(n_var_dofs);
596 
597  for (unsigned int i=0; i != n_var_dofs; i++)
598  {
599  phi[i] = libMesh::FEInterface::shape( context.get_dim(), fe_type, &context.get_elem(), i,
600  point_loc_in_masterelem );
601  }
602 
603  for (unsigned int i=0; i != n_var_dofs; i++)
604  {
605  F_var(i) += penalty*(var_value - pin_value)*phi[i];
606 
608  if (request_jacobian && context.get_elem_solution_derivative())
609  {
610  libmesh_assert (context.get_elem_solution_derivative() == 1.0);
611 
612  for (unsigned int j=0; j != n_var_dofs; j++)
613  K_var(i,j) += penalty*phi[i]*phi[j];
614 
615  } // End if request_jacobian
616  } // End i loop
617  } // End if pin_location
618 
619  return;
620  }
void pin_value(AssemblyContext &context, const CachedValues &cache, const bool request_jacobian, const VariableIndex var, const double value, const libMesh::Point &pin_location, const double penalty=1.0)
The idea here is to pin a variable to a particular value if there is a null space - e...

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

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