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 "FVFunctionDirichletBC.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", FVFunctionDirichletBC); 14 : 15 : InputParameters 16 17363 : FVFunctionDirichletBC::validParams() 17 : { 18 17363 : InputParameters params = FVDirichletBCBase::validParams(); 19 17363 : params.addRequiredParam<FunctionName>("function", "The exact solution function."); 20 17363 : params.addClassDescription( 21 : "Imposes the essential boundary condition $u=g(t,\\vec{x})$, where $g$ " 22 : "is a (possibly) time and space-dependent MOOSE Function."); 23 17363 : return params; 24 0 : } 25 : 26 1560 : FVFunctionDirichletBC::FVFunctionDirichletBC(const InputParameters & parameters) 27 1560 : : FVDirichletBCBase(parameters), _function(getFunction("function")) 28 : { 29 1560 : } 30 : 31 : ADReal 32 530099 : FVFunctionDirichletBC::boundaryValue(const FaceInfo & fi, const Moose::StateArg & state) const 33 : { 34 : 35 530099 : if (state.state != 0 && state.iteration_type == Moose::SolutionIterationType::Time) 36 : { 37 : mooseAssert(state.state == 1, "We cannot access values beyond the previous time step."); 38 5880 : return _function.value(_t_old, fi.faceCentroid()); 39 : } 40 : else 41 1054318 : return _function.value(_t, fi.faceCentroid()); 42 : }