Line data Source code
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 : 12 : InputParameters 13 0 : RDGFluxBase::validParams() 14 : { 15 0 : InputParameters params = GeneralUserObject::validParams(); 16 0 : params.addClassDescription( 17 : "Abstract base class for computing and caching internal or boundary fluxes for RDG"); 18 0 : return params; 19 0 : } 20 : 21 0 : RDGFluxBase::RDGFluxBase(const InputParameters & parameters) 22 : : ThreadedGeneralUserObject(parameters), 23 0 : _cached_flux_elem_id(libMesh::invalid_uint), 24 0 : _cached_flux_side_id(libMesh::invalid_uint), 25 0 : _cached_jacobian_elem_id(libMesh::invalid_uint), 26 0 : _cached_jacobian_side_id(libMesh::invalid_uint) 27 : { 28 0 : } 29 : 30 : void 31 0 : RDGFluxBase::initialize() 32 : { 33 0 : _cached_flux_elem_id = libMesh::invalid_uint; 34 0 : _cached_flux_side_id = libMesh::invalid_uint; 35 0 : _cached_jacobian_elem_id = libMesh::invalid_uint; 36 0 : _cached_jacobian_side_id = libMesh::invalid_uint; 37 0 : } 38 : 39 : void 40 0 : RDGFluxBase::execute() 41 : { 42 0 : } 43 : 44 : void 45 0 : RDGFluxBase::finalize() 46 : { 47 0 : } 48 : 49 : void 50 0 : RDGFluxBase::threadJoin(const UserObject &) 51 : { 52 0 : } 53 : 54 : const std::vector<Real> & 55 0 : 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 0 : if (_cached_flux_elem_id != ielem || _cached_flux_side_id != iside) 62 : { 63 0 : _cached_flux_elem_id = ielem; 64 0 : _cached_flux_side_id = iside; 65 : 66 0 : calcFlux(uvec1, uvec2, normal, _flux); 67 : } 68 0 : return _flux; 69 : } 70 : 71 : const DenseMatrix<Real> & 72 0 : 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 0 : if (_cached_jacobian_elem_id != ielem || _cached_jacobian_side_id != iside) 80 : { 81 0 : _cached_jacobian_elem_id = ielem; 82 0 : _cached_jacobian_side_id = iside; 83 : 84 0 : calcJacobian(uvec1, uvec2, normal, _jac1, _jac2); 85 : } 86 : 87 0 : if (get_first_jacobian) 88 0 : return _jac1; 89 : else 90 0 : return _jac2; 91 : }