https://mooseframework.inl.gov
RDGFluxBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "RDGFluxBase.h"
11 
14 {
16  params.addClassDescription(
17  "Abstract base class for computing and caching internal or boundary fluxes for RDG");
18  return params;
19 }
20 
22  : ThreadedGeneralUserObject(parameters),
23  _cached_flux_elem_id(libMesh::invalid_uint),
24  _cached_flux_side_id(libMesh::invalid_uint),
25  _cached_jacobian_elem_id(libMesh::invalid_uint),
26  _cached_jacobian_side_id(libMesh::invalid_uint)
27 {
28 }
29 
30 void
32 {
37 }
38 
39 void
41 {
42 }
43 
44 void
46 {
47 }
48 
49 void
51 {
52 }
53 
54 const std::vector<Real> &
55 RDGFluxBase::getFlux(const unsigned int iside,
56  const dof_id_type ielem,
57  const std::vector<Real> & uvec1,
58  const std::vector<Real> & uvec2,
59  const RealVectorValue & normal) const
60 {
61  if (_cached_flux_elem_id != ielem || _cached_flux_side_id != iside)
62  {
63  _cached_flux_elem_id = ielem;
64  _cached_flux_side_id = iside;
65 
66  calcFlux(uvec1, uvec2, normal, _flux);
67  }
68  return _flux;
69 }
70 
71 const DenseMatrix<Real> &
72 RDGFluxBase::getJacobian(const bool get_first_jacobian,
73  const unsigned int iside,
74  const dof_id_type ielem,
75  const std::vector<Real> & uvec1,
76  const std::vector<Real> & uvec2,
77  const RealVectorValue & normal) const
78 {
79  if (_cached_jacobian_elem_id != ielem || _cached_jacobian_side_id != iside)
80  {
83 
84  calcJacobian(uvec1, uvec2, normal, _jac1, _jac2);
85  }
86 
87  if (get_first_jacobian)
88  return _jac1;
89  else
90  return _jac2;
91 }
unsigned int _cached_flux_elem_id
element ID of the cached flux values
Definition: RDGFluxBase.h:114
DenseMatrix< Real > _jac1
Jacobian matrix contribution to the "left" cell.
Definition: RDGFluxBase.h:126
const unsigned int invalid_uint
static InputParameters validParams()
virtual void calcFlux(const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal, std::vector< Real > &flux) const =0
Calculates the flux vector given "left" and "right" states.
virtual const DenseMatrix< Real > & getJacobian(const bool get_first_jacobian, const unsigned int iside, const dof_id_type ielem, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal) const
Gets the flux Jacobian matrix for an element/side combination.
Definition: RDGFluxBase.C:72
unsigned int _cached_jacobian_elem_id
element ID of the cached Jacobian values
Definition: RDGFluxBase.h:119
static InputParameters validParams()
Definition: RDGFluxBase.C:13
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
virtual void initialize() override
Definition: RDGFluxBase.C:31
virtual const std::vector< Real > & getFlux(const unsigned int iside, const dof_id_type ielem, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal) const
Gets the flux vector for an element/side combination.
Definition: RDGFluxBase.C:55
RDGFluxBase(const InputParameters &parameters)
Definition: RDGFluxBase.C:21
std::vector< Real > _flux
flux vector
Definition: RDGFluxBase.h:124
unsigned int _cached_jacobian_side_id
side ID of the cached Jacobian values
Definition: RDGFluxBase.h:121
virtual void threadJoin(const UserObject &) override
Definition: RDGFluxBase.C:50
virtual void finalize() override
Definition: RDGFluxBase.C:45
DenseMatrix< Real > _jac2
Jacobian matrix contribution to the "right" cell.
Definition: RDGFluxBase.h:128
virtual void execute() override
Definition: RDGFluxBase.C:40
virtual void calcJacobian(const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &normal, DenseMatrix< Real > &jac1, DenseMatrix< Real > &jac2) const =0
Calculates the flux Jacobian matrices given "left" and "right" states.
void addClassDescription(const std::string &doc_string)
unsigned int _cached_flux_side_id
side ID of the cached flux values
Definition: RDGFluxBase.h:116
uint8_t dof_id_type