LCOV - code coverage report
Current view: top level - src/materials - AEFVMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose rdg: #31405 (292dce) with base fef103 Lines: 22 23 95.7 %
Date: 2025-09-04 07:56:15 Functions: 5 5 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 "AEFVMaterial.h"
      11             : #include "MooseMesh.h"
      12             : 
      13             : #include "libmesh/quadrature.h"
      14             : 
      15             : using namespace libMesh;
      16             : 
      17             : registerMooseObject("RdgApp", AEFVMaterial);
      18             : 
      19             : InputParameters
      20         250 : AEFVMaterial::validParams()
      21             : {
      22         250 :   InputParameters params = Material::validParams();
      23         250 :   params.addClassDescription(
      24             :       "A material kernel for the advection equation using a cell-centered finite volume method.");
      25         500 :   params.addRequiredCoupledVar("u", "Cell-averge variable");
      26         500 :   params.addRequiredParam<UserObjectName>("slope_limiting", "Name for slope limiting user object");
      27         250 :   return params;
      28           0 : }
      29             : 
      30         201 : AEFVMaterial::AEFVMaterial(const InputParameters & parameters)
      31             :   : Material(parameters),
      32         201 :     _uc(coupledValue("u")),
      33         201 :     _lslope(getUserObject<SlopeLimitingBase>("slope_limiting")),
      34         402 :     _u(declareProperty<Real>("u"))
      35             : {
      36         201 : }
      37             : 
      38         402 : AEFVMaterial::~AEFVMaterial() {}
      39             : 
      40             : void
      41      163545 : AEFVMaterial::computeQpProperties()
      42             : {
      43             :   // initialize the variable
      44      163545 :   _u[_qp] = _uc[_qp];
      45             : 
      46             :   // interpolate variable values at face center
      47      163545 :   if (_bnd)
      48             :   {
      49             :     // you should know how many equations you are solving and assign this number
      50             :     // e.g. = 1 (for the advection equation)
      51             :     unsigned int nvars = 1;
      52      107545 :     std::vector<RealGradient> ugrad(nvars, RealGradient(0., 0., 0.));
      53      107545 :     ugrad = _lslope.getElementSlope(_current_elem->id());
      54             : 
      55             :     // get the directional vector from cell center to face center
      56      107545 :     RealGradient dvec = _q_point[_qp] - _current_elem->vertex_average();
      57             : 
      58             :     // calculate the variable at face center
      59      107545 :     _u[_qp] += ugrad[0] * dvec;
      60             : 
      61             :     // clear the temporary vectors
      62      107545 :     ugrad.clear();
      63      107545 :   }
      64             :   // calculations only for elemental output
      65             :   else if (!_bnd)
      66             :   {
      67             :   }
      68      163545 : }

Generated by: LCOV version 1.14