www.mooseframework.org
BoundaryFluxBase.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #include "BoundaryFluxBase.h"
9 
10 // Static mutex definition
11 Threads::spin_mutex BoundaryFluxBase::_mutex;
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<GeneralUserObject>();
18  return params;
19 }
20 
21 BoundaryFluxBase::BoundaryFluxBase(const InputParameters & parameters)
22  : GeneralUserObject(parameters)
23 {
24  _flux.resize(libMesh::n_threads());
25  _jac1.resize(libMesh::n_threads());
26 }
27 
28 void
30 {
31  _cached_elem_id = 0;
32  _cached_side_id = libMesh::invalid_uint;
33 }
34 
35 void
37 {
38 }
39 
40 void
42 {
43 }
44 
45 const std::vector<Real> &
46 BoundaryFluxBase::getFlux(unsigned int iside,
47  dof_id_type ielem,
48  const std::vector<Real> & uvec1,
49  const RealVectorValue & dwave,
50  THREAD_ID tid) const
51 {
52  Threads::spin_mutex::scoped_lock lock(_mutex);
53  if (_cached_elem_id != ielem || _cached_side_id != iside)
54  {
55  _cached_elem_id = ielem;
56  _cached_side_id = iside;
57 
58  calcFlux(iside, ielem, uvec1, dwave, _flux[tid]);
59  }
60  return _flux[tid];
61 }
62 
63 const DenseMatrix<Real> &
64 BoundaryFluxBase::getJacobian(unsigned int iside,
65  dof_id_type ielem,
66  const std::vector<Real> & uvec1,
67  const RealVectorValue & dwave,
68  THREAD_ID tid) const
69 {
70  Threads::spin_mutex::scoped_lock lock(_mutex);
71  if (_cached_elem_id != ielem || _cached_side_id != iside)
72  {
73  _cached_elem_id = ielem;
74  _cached_side_id = iside;
75 
76  calcJacobian(iside, ielem, uvec1, dwave, _jac1[tid]);
77  }
78  return _jac1[tid];
79 }
unsigned int _cached_side_id
virtual void execute()
virtual const DenseMatrix< Real > & getJacobian(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, THREAD_ID tid) const
Get the boundary Jacobian matrix.
static Threads::spin_mutex _mutex
virtual void initialize()
InputParameters validParams< BoundaryFluxBase >()
std::vector< DenseMatrix< Real > > _jac1
Threaded storage for jacobians.
virtual void calcJacobian(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, DenseMatrix< Real > &jac1) const =0
Compute the Jacobian matrix on the boundary face.
virtual const std::vector< Real > & getFlux(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, THREAD_ID tid) const
Get the boundary flux vector.
BoundaryFluxBase(const InputParameters &parameters)
std::vector< std::vector< Real > > _flux
Threaded storage for fluxes.
dof_id_type _cached_elem_id
virtual void calcFlux(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, std::vector< Real > &flux) const =0
Solve the Riemann problem on the boundary face.
virtual void finalize()