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 : #pragma once 11 : 12 : #include "InputParameters.h" 13 : #include "MooseError.h" 14 : 15 : /** 16 : * This class is responsible for adding relationship managers 17 : * that describe geometric, algebraic and coupling ghosting 18 : * for finite volume computations. 19 : */ 20 : class FVRelationshipManagerInterface 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : /** 26 : * Helper function to set the relationship manager parameters 27 : * for advection-related kernels. 28 : * @param obj_params The input parameters of the object 29 : * @param rm_params The input parameters of the relationship manager 30 : * @param conditional_extended_layers Number of layers that will get assigned if the conditions in 31 : * the function are met 32 : */ 33 : static void setRMParamsAdvection(const InputParameters & obj_params, 34 : InputParameters & rm_params, 35 : const unsigned short conditional_extended_layers); 36 : 37 : /** 38 : * Helper function to set the relationship manager parameters 39 : * for diffusion-related kernels. 40 : * @param obj_params The input parameters of the object 41 : * @param rm_params The input parameters of the relationship manager 42 : * @param conditional_extended_layers Number of layers that will get assigned if the conditions in 43 : * the function are met 44 : */ 45 : static void setRMParamsDiffusion(const InputParameters & obj_params, 46 : InputParameters & rm_params, 47 : const unsigned short conditional_extended_layers); 48 : 49 11881 : FVRelationshipManagerInterface() {} 50 : 51 : private: 52 : /** 53 : * Helper function to set the relationship manager parameters 54 : * @param obj_params The input parameters of the object 55 : * @param rm_params The input parameters of the relationship manager 56 : * @param ghost_layers The number of ghosted layers needed 57 : */ 58 : static void setRMParams(const InputParameters & obj_params, 59 : InputParameters & rm_params, 60 : const unsigned short ghost_layers); 61 : 62 : /** 63 : * Throw an error with an acceptable context. 64 : * @param obj_params The object parameters 65 : * @param parameter_name The name of the parameter 66 : */ 67 : template <typename T> 68 : static void parameterError(const InputParameters & obj_params, 69 : const std::string & parameter_name, 70 : const std::string & function_name, 71 : const std::string & description); 72 : }; 73 : 74 : template <typename T> 75 : void 76 23614 : FVRelationshipManagerInterface::parameterError(const InputParameters & obj_params, 77 : const std::string & parameter_name, 78 : const std::string & function_name, 79 : const std::string & description) 80 : { 81 23614 : if (!obj_params.have_parameter<T>(parameter_name)) 82 0 : mooseError( 83 : obj_params.blockFullpath(), 84 : " The following parameter ", 85 : parameter_name, 86 : " was not found! This is required for setting the correct amount of ghosting in parallel " 87 : "runs. This error is typically caused by utilizing incompatible relationship manager " 88 : "callback functions in different objects. An example can be using ", 89 : function_name, 90 : " in a(n)", 91 : description, 92 : " object."); 93 23614 : }