www.mooseframework.org
GradientJumpIndicator.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "GradientJumpIndicator.h"
11 
13 
16 {
18  params.addClassDescription(
19  "Compute the jump of the solution gradient across element boundaries.");
20  return params;
21 }
22 
24  : InternalSideIndicator(parameters)
25 {
26 }
27 
28 Real
30 {
31  Real jump = 0;
32  if (_var.isFV())
33  {
34  // If the variable is not defined in the neighbor cell, we cant define the block
35  if (_var.hasBlocks(_neighbor_elem->subdomain_id()))
36  jump =
38  Moose::ElemArg{_current_elem, /*correct_skewness=*/false}, Moose::currentState())) -
40  _var.gradient(Moose::ElemArg{_neighbor_elem, false}, Moose::currentState()))) *
41  _normals[_qp];
42  else
43  jump = 0;
44  }
45  else
46  jump = (_grad_u[_qp] - _grad_u_neighbor[_qp]) * _normals[_qp];
47 
48  return jump * jump;
49 }
static InputParameters validParams()
Factory constructor initializes all internal references needed for indicator computation.
virtual bool isFV() const
auto raw_value(const Eigen::Map< T > &in)
Definition: ADReal.h:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const VariableGradient & _grad_u_neighbor
Holds the current solution gradient at the current quadrature point.
MooseVariableField< Real > & _var
A structure that is used to evaluate Moose functors logically at an element/cell center.
const Elem *const & _neighbor_elem
The neighboring element.
GradientJumpIndicator(const InputParameters &parameters)
registerMooseObject("MooseApp", GradientJumpIndicator)
The InternalSideIndicator class is responsible for calculating the residuals for various physics on i...
const VariableGradient & _grad_u
Holds the current solution gradient at the current quadrature point on the face.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseArray< Point > & _normals
Normal vectors at the quadrature points.
bool hasBlocks(const SubdomainID id) const override
Returns whether the functor is defined on this block.
GradientType gradient(const ElemArg &elem, const StateArg &state) const
Same as their evaluateGradient overloads with the same arguments but allows for caching implementatio...
Definition: MooseFunctor.h:840
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
static InputParameters validParams()
virtual Real computeQpIntegral() override
The virtual function you will want to override to compute error contributions.
StateArg currentState()