LCOV - code coverage report
Current view: top level - src/materials - AEFVMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose rdg: #32971 (54bef8) with base c6cf66 Lines: 22 23 95.7 %
Date: 2026-05-29 20:39:15 Functions: 4 5 80.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         166 : AEFVMaterial::validParams()
      21             : {
      22         166 :   InputParameters params = Material::validParams();
      23         166 :   params.addClassDescription(
      24             :       "A material kernel for the advection equation using a cell-centered finite volume method.");
      25         332 :   params.addRequiredCoupledVar("u", "Cell-averge variable");
      26         332 :   params.addRequiredParam<UserObjectName>("slope_limiting", "Name for slope limiting user object");
      27         166 :   return params;
      28           0 : }
      29             : 
      30         129 : AEFVMaterial::AEFVMaterial(const InputParameters & parameters)
      31             :   : Material(parameters),
      32         129 :     _uc(coupledValue("u")),
      33         129 :     _lslope(getUserObject<SlopeLimitingBase>("slope_limiting")),
      34         258 :     _u(declareProperty<Real>("u"))
      35             : {
      36         129 : }
      37             : 
      38         129 : AEFVMaterial::~AEFVMaterial() {}
      39             : 
      40             : void
      41      132936 : AEFVMaterial::computeQpProperties()
      42             : {
      43             :   // initialize the variable
      44      132936 :   _u[_qp] = _uc[_qp];
      45             : 
      46             :   // interpolate variable values at face center
      47      132936 :   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       87436 :     std::vector<RealGradient> ugrad(nvars, RealGradient(0., 0., 0.));
      53       87436 :     ugrad = _lslope.getElementSlope(_current_elem->id());
      54             : 
      55             :     // get the directional vector from cell center to face center
      56       87436 :     RealGradient dvec = _q_point[_qp] - _current_elem->vertex_average();
      57             : 
      58             :     // calculate the variable at face center
      59       87436 :     _u[_qp] += ugrad[0] * dvec;
      60             : 
      61             :     // clear the temporary vectors
      62       87436 :     ugrad.clear();
      63       87436 :   }
      64             :   // calculations only for elemental output
      65             :   else if (!_bnd)
      66             :   {
      67             :   }
      68      132936 : }

Generated by: LCOV version 1.14