LCOV - code coverage report
Current view: top level - src/interfaces - FVRelationshipManagerInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 43 45 95.6 %
Date: 2025-07-17 01:28:37 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 "FVRelationshipManagerInterface.h"
      11             : #include "MathFVUtils.h"
      12             : 
      13             : InputParameters
      14      451678 : FVRelationshipManagerInterface::validParams()
      15             : {
      16             :   // Create InputParameters object that will be appended to the parameters for the inheriting object
      17      451678 :   InputParameters params = emptyInputParameters();
      18             : 
      19      451678 :   params.addParam<unsigned short>("ghost_layers", 1, "The number of layers of elements to ghost.");
      20     1355034 :   params.addParam<bool>("use_point_neighbors",
      21      903356 :                         false,
      22             :                         "Whether to use point neighbors, which introduces additional ghosting to "
      23             :                         "that used for simple face neighbors.");
      24      451678 :   params.addParamNamesToGroup("ghost_layers use_point_neighbors", "Parallel ghosting");
      25             : 
      26     1355034 :   params.addParam<bool>("use_displaced_mesh",
      27      903356 :                         false,
      28             :                         "Whether or not this object should use the "
      29             :                         "displaced mesh for computation. Note that in "
      30             :                         "the case this is true but no displacements "
      31             :                         "are provided in the Mesh block the "
      32             :                         "undisplaced mesh will still be used.");
      33      451678 :   params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
      34             : 
      35             :   // FV Kernels always need at least one layer of ghosting because when looping over
      36             :   // faces to compute fluxes, the elements on each side of the face may be on
      37             :   // different MPI ranks, but we still need to access them as a pair to
      38             :   // compute the numerical face flux.
      39      451678 :   params.addRelationshipManager(
      40             :       "ElementSideNeighborLayers",
      41             :       Moose::RelationshipManagerType::GEOMETRIC | Moose::RelationshipManagerType::ALGEBRAIC |
      42             :           Moose::RelationshipManagerType::COUPLING,
      43           0 :       [](const InputParameters & obj_params, InputParameters & rm_params)
      44             :       {
      45       34041 :         FVRelationshipManagerInterface::setRMParams(
      46       34041 :             obj_params, rm_params, obj_params.get<unsigned short>("ghost_layers"));
      47       34041 :       });
      48             : 
      49      451678 :   return params;
      50           0 : }
      51             : 
      52             : void
      53        2260 : FVRelationshipManagerInterface::setRMParamsAdvection(
      54             :     const InputParameters & obj_params,
      55             :     InputParameters & rm_params,
      56             :     const unsigned short conditional_extended_layers)
      57             : {
      58        2260 :   parameterError<unsigned short>(
      59             :       obj_params, "ghost_layers", "setRMParamsAdvection", "non-advection");
      60        2260 :   parameterError<MooseEnum>(
      61             :       obj_params, "advected_interp_method", "setRMParamsAdvection", "non-advection");
      62             : 
      63        2260 :   auto ghost_layers = obj_params.get<unsigned short>("ghost_layers");
      64        2260 :   const auto & interp_method_in = obj_params.get<MooseEnum>("advected_interp_method");
      65        2260 :   const auto interp_method = Moose::FV::selectInterpolationMethod(interp_method_in);
      66             : 
      67             :   // For the interpolation techniques below, we will need to extend ghosting
      68        2260 :   if (interp_method == Moose::FV::InterpMethod::SOU ||
      69        1552 :       interp_method == Moose::FV::InterpMethod::MinMod ||
      70        1492 :       interp_method == Moose::FV::InterpMethod::VanLeer ||
      71        1432 :       interp_method == Moose::FV::InterpMethod::QUICK ||
      72             :       interp_method == Moose::FV::InterpMethod::Venkatakrishnan)
      73         888 :     ghost_layers = std::max(conditional_extended_layers, ghost_layers);
      74             : 
      75        2260 :   setRMParams(obj_params, rm_params, ghost_layers);
      76        2260 : }
      77             : 
      78             : void
      79        9547 : FVRelationshipManagerInterface::setRMParamsDiffusion(
      80             :     const InputParameters & obj_params,
      81             :     InputParameters & rm_params,
      82             :     const unsigned short conditional_extended_layers)
      83             : {
      84        9547 :   parameterError<unsigned short>(
      85             :       obj_params, "ghost_layers", "setRMParamsDiffusion", "non-diffusion");
      86        9547 :   parameterError<MooseEnum>(
      87             :       obj_params, "variable_interp_method", "setRMParamsDiffusion", "non-diffusion");
      88             : 
      89        9547 :   auto ghost_layers = obj_params.get<unsigned short>("ghost_layers");
      90        9547 :   const auto & interp_method_in = obj_params.get<MooseEnum>("variable_interp_method");
      91        9547 :   const auto interp_method = Moose::FV::selectInterpolationMethod(interp_method_in);
      92             : 
      93             :   // For the interpolation techniques below, we will need to extend ghosting
      94        9547 :   if (interp_method == Moose::FV::InterpMethod::SkewCorrectedAverage)
      95         420 :     ghost_layers = std::max(conditional_extended_layers, ghost_layers);
      96             : 
      97        9547 :   setRMParams(obj_params, rm_params, ghost_layers);
      98        9547 : }
      99             : 
     100             : void
     101       45848 : FVRelationshipManagerInterface::setRMParams(const InputParameters & obj_params,
     102             :                                             InputParameters & rm_params,
     103             :                                             const unsigned short ghost_layers)
     104             : {
     105       45848 :   rm_params.set<unsigned short>("layers") = ghost_layers;
     106       45848 :   rm_params.set<bool>("use_point_neighbors") = obj_params.get<bool>("use_point_neighbors");
     107             : 
     108       45848 :   rm_params.set<bool>("attach_geometric_early") = true;
     109       45848 :   rm_params.set<bool>("use_displaced_mesh") = obj_params.get<bool>("use_displaced_mesh");
     110       45848 : }

Generated by: LCOV version 1.14