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 "AEFVBC.h" 11 : 12 : registerMooseObject("RdgApp", AEFVBC); 13 : 14 : InputParameters 15 116 : AEFVBC::validParams() 16 : { 17 116 : InputParameters params = IntegratedBC::validParams(); 18 116 : params.addClassDescription("A boundary condition kernel for the advection equation using a " 19 : "cell-centered finite volume method."); 20 232 : MooseEnum component("concentration"); 21 232 : params.addParam<MooseEnum>("component", component, "Choose one of the equations"); 22 232 : params.addRequiredCoupledVar("u", "Name of the variable to use"); 23 232 : params.addRequiredParam<UserObjectName>("flux", "Name of the boundary flux object to use"); 24 116 : return params; 25 116 : } 26 : 27 67 : AEFVBC::AEFVBC(const InputParameters & parameters) 28 : : IntegratedBC(parameters), 29 67 : _component(getParam<MooseEnum>("component")), 30 67 : _uc1(coupledValue("u")), 31 134 : _u1(getMaterialProperty<Real>("u")), 32 134 : _flux(getUserObject<BoundaryFluxBase>("flux")) 33 : { 34 67 : } 35 : 36 : Real 37 948 : AEFVBC::computeQpResidual() 38 : { 39 : // assemble the input vectors, which are 40 : // the reconstructed linear monomial 41 : // extrapolated at side center from the current element 42 948 : std::vector<Real> uvec1 = {_u1[_qp]}; 43 : 44 : // calculate the flux 45 948 : const auto & flux = _flux.getFlux(_current_side, _current_elem->id(), uvec1, _normals[_qp]); 46 : 47 : // distribute the contribution to the current element 48 948 : return flux[_component] * _test[_i][_qp]; 49 948 : } 50 : 51 : Real 52 122 : AEFVBC::computeQpJacobian() 53 : { 54 : // assemble the input vectors, which are 55 : // the constant monomial from the current element 56 122 : std::vector<Real> uvec1 = {_uc1[_qp]}; 57 : 58 : // calculate the flux 59 122 : auto & fjac1 = _flux.getJacobian(_current_side, _current_elem->id(), uvec1, _normals[_qp]); 60 : 61 : // distribute the contribution to the current element 62 122 : return fjac1(_component, _component) * _phi[_j][_qp] * _test[_i][_qp]; 63 122 : }