https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GradientJumpIndicator.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
11
13
16{
19 "Compute the jump of the solution gradient across element boundaries.");
20 params.addParam<bool>("variable_is_FV",
21 false,
22 "Whether the solution variable is using a finite volume discretization");
23
24 // We need more ghosting to compute finite volume gradients across from a boundary
25 // We do not use skewness correction here, therefore avoiding needing three layers
26 params.addRelationshipManager("ElementSideNeighborLayers",
28 [](const InputParameters & obj_params, InputParameters & rm_params)
29 {
30 rm_params.set<unsigned short>("layers") =
31 obj_params.get<bool>("variable_is_FV") ? 2 : 1;
32 });
33
34 return params;
35}
36
41
42Real
44{
45 Real jump = 0;
46 // If the variable is not defined in the neighbor cell, we cant define the block
47 // If the indicator is not defined in the neighbor cell, we should not be looking at it
48 mooseAssert(_neighbor_elem, "Should have a neighbor");
49 if (_var.hasBlocks(_neighbor_elem->subdomain_id()) && hasBlocks(_neighbor_elem->subdomain_id()))
50 {
51 if (_var.isFV())
52 jump =
54 Moose::ElemArg{_current_elem, /*correct_skewness=*/false}, Moose::currentState())) -
56 _var.gradient(Moose::ElemArg{_neighbor_elem, false}, Moose::currentState()))) *
58 else
60 }
61
62 return jump * jump;
63}
registerMooseObject("MooseApp", GradientJumpIndicator)
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.
virtual Real computeQpIntegral() override
The virtual function you will want to override to compute error contributions.
GradientJumpIndicator(const InputParameters &parameters)
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
const MooseArray< Point > & _normals
Normal vectors at the quadrature points.
unsigned int _qp
The current quadrature point.
const Elem *const & _neighbor_elem
The neighbor element across from the current side.
The InternalSideIndicator class is responsible for calculating the residuals for various physics on i...
const OutputTools< ComputeValueType >::VariableGradient & _grad_u_neighbor
Holds the current solution gradient at the current quadrature point.
const OutputTools< ComputeValueType >::VariableGradient & _grad_u
Holds the current solution gradient at the current quadrature point on the face.
MooseVariableField< ComputeValueType > & _var
static InputParameters validParams()
Factory constructor initializes all internal references needed for indicator computation.
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...
auto raw_value(const Eigen::Map< T > &in)
StateArg currentState()
A structure that is used to evaluate Moose functors logically at an element/cell center.