Permalink
Browse files

Merge pull request #12516 from joshuahansel/rdg-flux-init-fix

Used different values for identifying caches in RDG module
  • Loading branch information...
andrsd committed Nov 20, 2018
2 parents 79e0fea + 48bab0d commit ad261b9908f45e8cfdf469c98f3c0aed8839520d
@@ -91,8 +91,15 @@ class BoundaryFluxBase : public ThreadedGeneralUserObject
DenseMatrix<Real> & jac1) const = 0;
protected:
mutable unsigned int _cached_side_id;
mutable dof_id_type _cached_elem_id;
/// element ID of the cached flux values
mutable unsigned int _cached_flux_elem_id;
/// side ID of the cached flux values
mutable unsigned int _cached_flux_side_id;
/// element ID of the cached Jacobian values
mutable unsigned int _cached_jacobian_elem_id;
/// side ID of the cached Jacobian values
mutable unsigned int _cached_jacobian_side_id;
/// Cached flux
mutable std::vector<Real> _flux;
@@ -112,8 +112,15 @@ class InternalSideFluxBase : public ThreadedGeneralUserObject
DenseMatrix<Real> & jac2) const = 0;
protected:
mutable unsigned int _cached_elem_id;
mutable unsigned int _cached_neig_id;
/// element ID of the cached flux values
mutable unsigned int _cached_flux_elem_id;
/// neighbor element ID of the cached flux values
mutable unsigned int _cached_flux_neig_id;
/// element ID of the cached Jacobian values
mutable unsigned int _cached_jacobian_elem_id;
/// neighbor element ID of the cached Jacobian values
mutable unsigned int _cached_jacobian_neig_id;
/// flux vector of this side
mutable std::vector<Real> _flux;
@@ -114,10 +114,15 @@ class RDGFluxBase : public ThreadedGeneralUserObject
DenseMatrix<Real> & jac2) const = 0;
protected:
/// element ID of the cached values
mutable unsigned int _cached_elem_id;
/// side ID of the cached values
mutable unsigned int _cached_side_id;
/// element ID of the cached flux values
mutable unsigned int _cached_flux_elem_id;
/// side ID of the cached flux values
mutable unsigned int _cached_flux_side_id;
/// element ID of the cached Jacobian values
mutable unsigned int _cached_jacobian_elem_id;
/// side ID of the cached Jacobian values
mutable unsigned int _cached_jacobian_side_id;
/// flux vector
mutable std::vector<Real> _flux;
@@ -18,15 +18,21 @@ validParams<BoundaryFluxBase>()
}
BoundaryFluxBase::BoundaryFluxBase(const InputParameters & parameters)
: ThreadedGeneralUserObject(parameters)
: ThreadedGeneralUserObject(parameters),
_cached_flux_elem_id(libMesh::invalid_uint),
_cached_flux_side_id(libMesh::invalid_uint),
_cached_jacobian_elem_id(libMesh::invalid_uint),
_cached_jacobian_side_id(libMesh::invalid_uint)
{
}
void
BoundaryFluxBase::initialize()
{
_cached_elem_id = 0;
_cached_side_id = libMesh::invalid_uint;
_cached_flux_elem_id = libMesh::invalid_uint;
_cached_flux_side_id = libMesh::invalid_uint;
_cached_jacobian_elem_id = libMesh::invalid_uint;
_cached_jacobian_side_id = libMesh::invalid_uint;
}
void
@@ -50,10 +56,10 @@ BoundaryFluxBase::getFlux(unsigned int iside,
const std::vector<Real> & uvec1,
const RealVectorValue & dwave) const
{
if (_cached_elem_id != ielem || _cached_side_id != iside)
if (_cached_flux_elem_id != ielem || _cached_flux_side_id != iside)
{
_cached_elem_id = ielem;
_cached_side_id = iside;
_cached_flux_elem_id = ielem;
_cached_flux_side_id = iside;
calcFlux(iside, ielem, uvec1, dwave, _flux);
}
@@ -66,10 +72,10 @@ BoundaryFluxBase::getJacobian(unsigned int iside,
const std::vector<Real> & uvec1,
const RealVectorValue & dwave) const
{
if (_cached_elem_id != ielem || _cached_side_id != iside)
if (_cached_jacobian_elem_id != ielem || _cached_jacobian_side_id != iside)
{
_cached_elem_id = ielem;
_cached_side_id = iside;
_cached_jacobian_elem_id = ielem;
_cached_jacobian_side_id = iside;
calcJacobian(iside, ielem, uvec1, dwave, _jac1);
}
@@ -19,15 +19,21 @@ validParams<InternalSideFluxBase>()
}
InternalSideFluxBase::InternalSideFluxBase(const InputParameters & parameters)
: ThreadedGeneralUserObject(parameters)
: ThreadedGeneralUserObject(parameters),
_cached_flux_elem_id(libMesh::invalid_uint),
_cached_flux_neig_id(libMesh::invalid_uint),
_cached_jacobian_elem_id(libMesh::invalid_uint),
_cached_jacobian_neig_id(libMesh::invalid_uint)
{
}
void
InternalSideFluxBase::initialize()
{
_cached_elem_id = 0;
_cached_neig_id = 0;
_cached_flux_elem_id = libMesh::invalid_uint;
_cached_flux_neig_id = libMesh::invalid_uint;
_cached_jacobian_elem_id = libMesh::invalid_uint;
_cached_jacobian_neig_id = libMesh::invalid_uint;
}
void
@@ -53,10 +59,10 @@ InternalSideFluxBase::getFlux(unsigned int iside,
const std::vector<Real> & uvec2,
const RealVectorValue & dwave) const
{
if (_cached_elem_id != ielem || _cached_neig_id != ineig)
if (_cached_flux_elem_id != ielem || _cached_flux_neig_id != ineig)
{
_cached_elem_id = ielem;
_cached_neig_id = ineig;
_cached_flux_elem_id = ielem;
_cached_flux_neig_id = ineig;
calcFlux(iside, ielem, ineig, uvec1, uvec2, dwave, _flux);
}
@@ -72,10 +78,10 @@ InternalSideFluxBase::getJacobian(Moose::DGResidualType type,
const std::vector<Real> & uvec2,
const RealVectorValue & dwave) const
{
if (_cached_elem_id != ielem || _cached_neig_id != ineig)
if (_cached_jacobian_elem_id != ielem || _cached_jacobian_neig_id != ineig)
{
_cached_elem_id = ielem;
_cached_neig_id = ineig;
_cached_jacobian_elem_id = ielem;
_cached_jacobian_neig_id = ineig;
calcJacobian(iside, ielem, ineig, uvec1, uvec2, dwave, _jac1, _jac2);
}
@@ -19,15 +19,22 @@ validParams<RDGFluxBase>()
return params;
}
RDGFluxBase::RDGFluxBase(const InputParameters & parameters) : ThreadedGeneralUserObject(parameters)
RDGFluxBase::RDGFluxBase(const InputParameters & parameters)
: ThreadedGeneralUserObject(parameters),
_cached_flux_elem_id(libMesh::invalid_uint),
_cached_flux_side_id(libMesh::invalid_uint),
_cached_jacobian_elem_id(libMesh::invalid_uint),
_cached_jacobian_side_id(libMesh::invalid_uint)
{
}
void
RDGFluxBase::initialize()
{
_cached_elem_id = libMesh::invalid_uint;
_cached_side_id = libMesh::invalid_uint;
_cached_flux_elem_id = libMesh::invalid_uint;
_cached_flux_side_id = libMesh::invalid_uint;
_cached_jacobian_elem_id = libMesh::invalid_uint;
_cached_jacobian_side_id = libMesh::invalid_uint;
}
void
@@ -52,10 +59,10 @@ RDGFluxBase::getFlux(const unsigned int iside,
const std::vector<Real> & uvec2,
const RealVectorValue & normal) const
{
if (_cached_elem_id != ielem || _cached_side_id != iside)
if (_cached_flux_elem_id != ielem || _cached_flux_side_id != iside)
{
_cached_elem_id = ielem;
_cached_side_id = iside;
_cached_flux_elem_id = ielem;
_cached_flux_side_id = iside;
calcFlux(uvec1, uvec2, normal, _flux);
}
@@ -70,10 +77,10 @@ RDGFluxBase::getJacobian(const bool get_first_jacobian,
const std::vector<Real> & uvec2,
const RealVectorValue & normal) const
{
if (_cached_elem_id != ielem || _cached_side_id != iside)
if (_cached_jacobian_elem_id != ielem || _cached_jacobian_side_id != iside)
{
_cached_elem_id = ielem;
_cached_side_id = iside;
_cached_jacobian_elem_id = ielem;
_cached_jacobian_side_id = iside;
calcJacobian(uvec1, uvec2, normal, _jac1, _jac2);
}

0 comments on commit ad261b9

Please sign in to comment.