Line data Source code
1 : //* This file is part of SALAMANDER: Software for Advanced Large-scale Analysis of MAgnetic confinement for Numerical Design, Engineering & Research, 2 : //* A multiphysics application for modeling plasma facing components 3 : //* https://github.com/idaholab/salamander 4 : //* https://mooseframework.inl.gov/salamander 5 : //* 6 : //* SALAMANDER is powered by the MOOSE Framework 7 : //* https://www.mooseframework.inl.gov 8 : //* 9 : //* Licensed under LGPL 2.1, please see LICENSE for details 10 : //* https://www.gnu.org/licenses/lgpl-2.1.html 11 : //* 12 : //* Copyright 2025, Battelle Energy Alliance, LLC 13 : //* ALL RIGHTS RESERVED 14 : //* 15 : #include "NegativeVariableGradientComponent.h" 16 : 17 : registerMooseObject("SalamanderApp", NegativeVariableGradientComponent); 18 : 19 : InputParameters 20 96 : NegativeVariableGradientComponent::validParams() 21 : { 22 96 : InputParameters params = AuxKernel::validParams(); 23 96 : params.addClassDescription( 24 : "Returns the component of the gradient of a variable and applies a constant factor of -1."); 25 192 : params.addRequiredCoupledVar("gradient_variable", "The variable from which to take the gradient"); 26 192 : params.addRequiredRangeCheckedParam<unsigned int>( 27 : "component", "component < 3", "The component of the gradient to access"); 28 96 : return params; 29 0 : } 30 : 31 54 : NegativeVariableGradientComponent::NegativeVariableGradientComponent( 32 54 : const InputParameters & parameters) 33 : : AuxKernel(parameters), 34 54 : _grad_var(coupledGradient("gradient_variable")), 35 162 : _component(getParam<unsigned int>("component")) 36 : { 37 54 : } 38 : 39 : Real 40 14720 : NegativeVariableGradientComponent::computeValue() 41 : { 42 14720 : return -_grad_var[_qp](_component); 43 : }