LCOV - code coverage report
Current view: top level - src/fvinterpolationmethods - FVAdvectedUpwind.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 13 14 92.9 %
Date: 2026-05-29 20:35:17 Functions: 4 4 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             : 
       9             : #include "FVAdvectedUpwind.h"
      10             : 
      11             : registerMooseObject("MooseApp", FVAdvectedUpwind);
      12             : 
      13             : InputParameters
      14        3815 : FVAdvectedUpwind::validParams()
      15             : {
      16        3815 :   InputParameters params = FVInterpolationMethod::validParams();
      17        3815 :   params.addClassDescription(
      18             :       "Upwind interpolation for advected quantities using the face mass flux sign.");
      19        3815 :   return params;
      20           0 : }
      21             : 
      22         377 : FVAdvectedUpwind::FVAdvectedUpwind(const InputParameters & params) : FVInterpolationMethod(params)
      23             : {
      24         377 : }
      25             : 
      26             : FVAdvectedInterpolationMethod::AdvectedSystemContribution
      27    10342227 : FVAdvectedUpwind::advectedInterpolate(const FaceInfo & /*face*/,
      28             :                                       Real /*elem_value*/,
      29             :                                       Real /*neighbor_value*/,
      30             :                                       const VectorValue<Real> * /*elem_grad*/,
      31             :                                       const VectorValue<Real> * /*neighbor_grad*/,
      32             :                                       Real mass_flux) const
      33             : {
      34    10342227 :   AdvectedSystemContribution result;
      35             :   // Branchless upwind selection to keep interpolation SIMD/GPU friendly
      36    10342227 :   const Real neighbor_weight = mass_flux < 0.0;
      37    10342227 :   result.weights_matrix = std::make_pair(1.0 - neighbor_weight, neighbor_weight);
      38    20684454 :   return result;
      39             : }
      40             : 
      41             : Real
      42          12 : FVAdvectedUpwind::advectedInterpolateValue(const FaceInfo & /*face*/,
      43             :                                            Real elem_value,
      44             :                                            Real neighbor_value,
      45             :                                            const VectorValue<Real> * /*elem_grad*/,
      46             :                                            const VectorValue<Real> * /*neighbor_grad*/,
      47             :                                            Real mass_flux) const
      48             : {
      49          12 :   return mass_flux < 0.0 ? neighbor_value : elem_value;
      50             : }

Generated by: LCOV version 1.14