LCOV - code coverage report
Current view: top level - src/bcs - ADVectorFunctionDirichletBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 24 28 85.7 %
Date: 2025-07-17 01:28:37 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "ADVectorFunctionDirichletBC.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", ADVectorFunctionDirichletBC);
      14             : 
      15             : InputParameters
      16       14565 : ADVectorFunctionDirichletBC::validParams()
      17             : {
      18       14565 :   InputParameters params = ADDirichletBCBaseTempl<RealVectorValue>::validParams();
      19       14565 :   params.addClassDescription(
      20             :       "Imposes the essential boundary condition $\\vec{u}=\\vec{g}$, where $\\vec{g}$ "
      21             :       "components are calculated with functions.");
      22       14565 :   params.addParam<FunctionName>("function",
      23             :                                 "The boundary condition vector function. This cannot be supplied "
      24             :                                 "with the component parameters.");
      25       14565 :   params.addParam<FunctionName>("function_x", 0, "The function for the x component");
      26       14565 :   params.addParam<FunctionName>("function_y", 0, "The function for the y component");
      27       14565 :   params.addParam<FunctionName>("function_z", 0, "The function for the z component");
      28       14565 :   return params;
      29           0 : }
      30             : 
      31         152 : ADVectorFunctionDirichletBC::ADVectorFunctionDirichletBC(const InputParameters & parameters)
      32             :   : ADDirichletBCBaseTempl<RealVectorValue>(parameters),
      33         152 :     _function(isParamValid("function") ? &getFunction("function") : nullptr),
      34         152 :     _function_x(getFunction("function_x")),
      35         152 :     _function_y(getFunction("function_y")),
      36         304 :     _function_z(getFunction("function_z"))
      37             : {
      38         152 :   if (_function && parameters.isParamSetByUser("function_x"))
      39           4 :     paramError("function_x", "The 'function' and 'function_x' parameters cannot both be set.");
      40         148 :   if (_function && parameters.isParamSetByUser("function_y"))
      41           0 :     paramError("function_y", "The 'function' and 'function_y' parameters cannot both be set.");
      42         148 :   if (_function && parameters.isParamSetByUser("function_z"))
      43           0 :     paramError("function_z", "The 'function' and 'function_z' parameters cannot both be set.");
      44         148 : }
      45             : 
      46             : ADRealVectorValue
      47      110442 : ADVectorFunctionDirichletBC::computeQpValue()
      48             : {
      49      110442 :   if (_function)
      50           0 :     _values = _function->vectorValue(_t, *_current_node);
      51             :   else
      52      110442 :     _values = RealVectorValue(_function_x.value(_t, *_current_node),
      53      110442 :                               _function_y.value(_t, *_current_node),
      54      220884 :                               _function_z.value(_t, *_current_node));
      55      110442 :   return _values;
      56             : }

Generated by: LCOV version 1.14