LCOV - code coverage report
Current view: top level - src/bcs - VectorFunctionDirichletBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 32 37 86.5 %
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 "VectorFunctionDirichletBC.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", VectorFunctionDirichletBC);
      14             : registerMooseObjectRenamed("MooseApp",
      15             :                            LagrangeVecFunctionDirichletBC,
      16             :                            "05/01/2019 00:01",
      17             :                            VectorFunctionDirichletBC);
      18             : 
      19             : InputParameters
      20       28734 : VectorFunctionDirichletBC::validParams()
      21             : {
      22       28734 :   InputParameters params = VectorNodalBC::validParams();
      23       28734 :   params.addClassDescription(
      24             :       "Imposes the essential boundary condition $\\vec{u}=\\vec{g}$, where $\\vec{g}$ "
      25             :       "components are calculated with functions.");
      26             : 
      27       28734 :   params.addParam<FunctionName>("function",
      28             :                                 "The boundary condition vector function. This cannot be supplied "
      29             :                                 "with the component parameters.");
      30             : 
      31       28734 :   params.addParam<FunctionName>("function_x", 0, "The function for the x component");
      32       28734 :   params.addParam<FunctionName>("function_y", 0, "The function for the y component");
      33       28734 :   params.addParam<FunctionName>("function_z", 0, "The function for the z component");
      34             : 
      35       28734 :   params.addDeprecatedParam<FunctionName>(
      36             :       "x_exact_soln", "The exact solution for the x component", "Use 'function_x' instead.");
      37       28734 :   params.addDeprecatedParam<FunctionName>(
      38             :       "y_exact_soln", "The exact solution for the y component", "Use 'function_y' instead.");
      39       28734 :   params.addDeprecatedParam<FunctionName>(
      40             :       "z_exact_soln", "The exact solution for the z component", "Use 'function_z' instead.");
      41       28734 :   return params;
      42           0 : }
      43             : 
      44          98 : VectorFunctionDirichletBC::VectorFunctionDirichletBC(const InputParameters & parameters)
      45             :   : VectorNodalBC(parameters),
      46          98 :     _function(isParamValid("function") ? &getFunction("function") : nullptr),
      47         196 :     _function_x(isParamValid("x_exact_soln") ? getFunction("x_exact_soln")
      48          98 :                                              : getFunction("function_x")),
      49         196 :     _function_y(isParamValid("y_exact_soln") ? getFunction("y_exact_soln")
      50          98 :                                              : getFunction("function_y")),
      51         196 :     _function_z(isParamValid("z_exact_soln") ? getFunction("z_exact_soln")
      52         294 :                                              : getFunction("function_z"))
      53             : {
      54          98 :   if (_function &&
      55          98 :       (parameters.isParamSetByUser("function_x") || parameters.isParamSetByUser("x_exact_soln")))
      56           0 :     paramError("function_x", "The 'function' and 'function_x' parameters cannot both be set.");
      57          98 :   if (_function &&
      58          98 :       (parameters.isParamSetByUser("function_y") || parameters.isParamSetByUser("y_exact_soln")))
      59           0 :     paramError("function_y", "The 'function' and 'function_y' parameters cannot both be set.");
      60          98 :   if (_function &&
      61          98 :       (parameters.isParamSetByUser("function_z") || parameters.isParamSetByUser("z_exact_soln")))
      62           0 :     paramError("function_z", "The 'function' and 'function_z' parameters cannot both be set.");
      63          98 : }
      64             : 
      65             : RealVectorValue
      66       70750 : VectorFunctionDirichletBC::computeQpResidual()
      67             : {
      68       70750 :   if (_function)
      69           0 :     _values = _function->vectorValue(_t, *_current_node);
      70             :   else
      71       70750 :     _values = {_function_x.value(_t, *_current_node),
      72       70750 :                _function_y.value(_t, *_current_node),
      73       70750 :                _function_z.value(_t, *_current_node)};
      74             : 
      75       70750 :   return _u - _values;
      76             : }

Generated by: LCOV version 1.14