LCOV - code coverage report
Current view: top level - src/bcs - ADVectorFunctionDirichletBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 24 28 85.7 %
Date: 2025-08-08 20:01:16 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       14583 : ADVectorFunctionDirichletBC::validParams()
      17             : {
      18       14583 :   InputParameters params = ADDirichletBCBaseTempl<RealVectorValue>::validParams();
      19       14583 :   params.addClassDescription(
      20             :       "Imposes the essential boundary condition $\\vec{u}=\\vec{g}$, where $\\vec{g}$ "
      21             :       "components are calculated with functions.");
      22       14583 :   params.addParam<FunctionName>("function",
      23             :                                 "The boundary condition vector function. This cannot be supplied "
      24             :                                 "with the component parameters.");
      25       14583 :   params.addParam<FunctionName>("function_x", 0, "The function for the x component");
      26       14583 :   params.addParam<FunctionName>("function_y", 0, "The function for the y component");
      27       14583 :   params.addParam<FunctionName>("function_z", 0, "The function for the z component");
      28       14583 :   return params;
      29           0 : }
      30             : 
      31         161 : ADVectorFunctionDirichletBC::ADVectorFunctionDirichletBC(const InputParameters & parameters)
      32             :   : ADDirichletBCBaseTempl<RealVectorValue>(parameters),
      33         161 :     _function(isParamValid("function") ? &getFunction("function") : nullptr),
      34         161 :     _function_x(getFunction("function_x")),
      35         161 :     _function_y(getFunction("function_y")),
      36         322 :     _function_z(getFunction("function_z"))
      37             : {
      38         161 :   if (_function && parameters.isParamSetByUser("function_x"))
      39           4 :     paramError("function_x", "The 'function' and 'function_x' parameters cannot both be set.");
      40         157 :   if (_function && parameters.isParamSetByUser("function_y"))
      41           0 :     paramError("function_y", "The 'function' and 'function_y' parameters cannot both be set.");
      42         157 :   if (_function && parameters.isParamSetByUser("function_z"))
      43           0 :     paramError("function_z", "The 'function' and 'function_z' parameters cannot both be set.");
      44         157 : }
      45             : 
      46             : ADRealVectorValue
      47      117600 : ADVectorFunctionDirichletBC::computeQpValue()
      48             : {
      49      117600 :   if (_function)
      50           0 :     _values = _function->vectorValue(_t, *_current_node);
      51             :   else
      52      117600 :     _values = RealVectorValue(_function_x.value(_t, *_current_node),
      53      117600 :                               _function_y.value(_t, *_current_node),
      54      235200 :                               _function_z.value(_t, *_current_node));
      55      117600 :   return _values;
      56             : }

Generated by: LCOV version 1.14