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