14 #include "libmesh/dof_map.h" 24 "The name of the variable to compute the residual for");
25 MooseEnum norm_type(
"l_1=0 l_2=1 l_inf=2");
26 norm_type.addDocumentation(
"l_1",
"l-1 norm");
27 norm_type.addDocumentation(
"l_2",
"l-2 norm");
28 norm_type.addDocumentation(
"l_inf",
"l-infinity norm");
33 "If set to true, correct the mesh size bias associated with the selected norm. For l-1, " 34 "divide by N, the number of block-restricted DoFs for the variable. For l-2, divide by " 35 "sqrt(N). For l-infinity, no correction needs to be made.");
37 params.
addClassDescription(
"Computes a discrete norm for a block-restricted variable residual.");
44 _var(_fe_problem.getVariable(_tid,
45 getParam<VariableName>(
"variable"),
49 _correct_mesh_bias(getParam<bool>(
"correct_mesh_bias")),
50 _nl_residual_vector(_fe_problem.getNonlinearSystemBase(_sys.number()).RHS())
83 _local_dof_indices.insert(pps._local_dof_indices.begin(), pps._local_dof_indices.end());
90 auto receive_functor = [&](
processor_id_type ,
const std::vector<dof_id_type> & indices)
virtual Real subset_l2_norm(const std::set< numeric_index_type > &indices) const
virtual PostprocessorValue getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
processor_id_type dof_owner(const dof_id_type dof) const
const libMesh::DofMap & dofMap() const
The DofMap associated with the system this variable is in.
NormType
Type of discrete norm.
static InputParameters validParams()
virtual void execute() override
Execute method.
NumericVector< Number > & _nl_residual_vector
Nonlinear residual vector.
static InputParameters validParams()
const Parallel::Communicator & _communicator
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
virtual Real subset_linfty_norm(const std::set< numeric_index_type > &indices) const
virtual Real subset_l1_norm(const std::set< numeric_index_type > &indices) const
MooseVariableFieldBase & _var
The variable we compute the residual for.
uint8_t processor_id_type
virtual void threadJoin(const UserObject &y) override
Must override.
const bool _correct_mesh_bias
If true, correct mesh-size bias in norm.
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
std::map< processor_id_type, std::vector< dof_id_type > > _nonlocal_dof_indices_map
Non-local DoF indices map, indexed by the owning PID.
VarKindType
Framework-wide stuff.
Real PostprocessorValue
various MOOSE typedefs
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("MooseApp", DiscreteVariableResidualNorm)
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
std::set< dof_id_type > _local_dof_indices
Local DoF indices for the variable, block-restricted.
DiscreteVariableResidualNorm(const InputParameters ¶meters)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
Computes a discrete norm for a block-restricted variable residual.
Base class for user-specific data.
const NormType _norm_type
Type of norm to compute.
Real _norm
The computed residual norm.
bool local_index(dof_id_type dof_index) const