https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
FVRelationshipManagerInterface Class Reference

This class is responsible for adding relationship managers that describe geometric, algebraic and coupling ghosting for finite volume computations. More...

#include <FVRelationshipManagerInterface.h>

Inheritance diagram for FVRelationshipManagerInterface:
[legend]

Public Member Functions

 FVRelationshipManagerInterface ()
 

Static Public Member Functions

static InputParameters validParams ()
 
static void setRMParamsAdvection (const InputParameters &obj_params, InputParameters &rm_params, const unsigned short conditional_extended_layers)
 Helper function to set the relationship manager parameters for advection-related kernels. More...
 
static void setRMParamsDiffusion (const InputParameters &obj_params, InputParameters &rm_params, const unsigned short conditional_extended_layers)
 Helper function to set the relationship manager parameters for diffusion-related kernels. More...
 

Static Private Member Functions

static void setRMParams (const InputParameters &obj_params, InputParameters &rm_params, const unsigned short ghost_layers)
 Helper function to set the relationship manager parameters. More...
 
template<typename T >
static void parameterError (const InputParameters &obj_params, const std::string &parameter_name, const std::string &function_name, const std::string &description)
 Throw an error with an acceptable context. More...
 

Detailed Description

This class is responsible for adding relationship managers that describe geometric, algebraic and coupling ghosting for finite volume computations.

Definition at line 20 of file FVRelationshipManagerInterface.h.

Constructor & Destructor Documentation

◆ FVRelationshipManagerInterface()

FVRelationshipManagerInterface::FVRelationshipManagerInterface ( )
inline

Definition at line 49 of file FVRelationshipManagerInterface.h.

49 {}

Member Function Documentation

◆ parameterError()

template<typename T >
void FVRelationshipManagerInterface::parameterError ( const InputParameters obj_params,
const std::string &  parameter_name,
const std::string &  function_name,
const std::string &  description 
)
staticprivate

Throw an error with an acceptable context.

Parameters
obj_paramsThe object parameters
parameter_nameThe name of the parameter

Definition at line 76 of file FVRelationshipManagerInterface.h.

80 {
81  if (!obj_params.have_parameter<T>(parameter_name))
82  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 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
std::string blockFullpath() const

◆ setRMParams()

void FVRelationshipManagerInterface::setRMParams ( const InputParameters obj_params,
InputParameters rm_params,
const unsigned short  ghost_layers 
)
staticprivate

Helper function to set the relationship manager parameters.

Parameters
obj_paramsThe input parameters of the object
rm_paramsThe input parameters of the relationship manager
ghost_layersThe number of ghosted layers needed

Definition at line 101 of file FVRelationshipManagerInterface.C.

Referenced by setRMParamsAdvection(), setRMParamsDiffusion(), and validParams().

104 {
105  rm_params.set<unsigned short>("layers") = ghost_layers;
106  rm_params.set<bool>("use_point_neighbors") = obj_params.get<bool>("use_point_neighbors");
107 
108  rm_params.set<bool>("attach_geometric_early") = true;
109  rm_params.set<bool>("use_displaced_mesh") = obj_params.get<bool>("use_displaced_mesh");
110 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.

◆ setRMParamsAdvection()

void FVRelationshipManagerInterface::setRMParamsAdvection ( const InputParameters obj_params,
InputParameters rm_params,
const unsigned short  conditional_extended_layers 
)
static

Helper function to set the relationship manager parameters for advection-related kernels.

Parameters
obj_paramsThe input parameters of the object
rm_paramsThe input parameters of the relationship manager
conditional_extended_layersNumber of layers that will get assigned if the conditions in the function are met

Definition at line 53 of file FVRelationshipManagerInterface.C.

Referenced by FVAdvection::validParams().

57 {
58  parameterError<unsigned short>(
59  obj_params, "ghost_layers", "setRMParamsAdvection", "non-advection");
60  parameterError<MooseEnum>(
61  obj_params, "advected_interp_method", "setRMParamsAdvection", "non-advection");
62 
63  auto ghost_layers = obj_params.get<unsigned short>("ghost_layers");
64  const auto & interp_method_in = obj_params.get<MooseEnum>("advected_interp_method");
65  const auto interp_method = Moose::FV::selectInterpolationMethod(interp_method_in);
66 
67  // For the interpolation techniques below, we will need to extend ghosting
68  if (interp_method == Moose::FV::InterpMethod::SOU ||
69  interp_method == Moose::FV::InterpMethod::MinMod ||
70  interp_method == Moose::FV::InterpMethod::VanLeer ||
71  interp_method == Moose::FV::InterpMethod::QUICK ||
73  ghost_layers = std::max(conditional_extended_layers, ghost_layers);
74 
75  setRMParams(obj_params, rm_params, ghost_layers);
76 }
auto max(const L &left, const R &right)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
static void setRMParams(const InputParameters &obj_params, InputParameters &rm_params, const unsigned short ghost_layers)
Helper function to set the relationship manager parameters.
InterpMethod selectInterpolationMethod(const std::string &interp_method)
Definition: MathFVUtils.C:81

◆ setRMParamsDiffusion()

void FVRelationshipManagerInterface::setRMParamsDiffusion ( const InputParameters obj_params,
InputParameters rm_params,
const unsigned short  conditional_extended_layers 
)
static

Helper function to set the relationship manager parameters for diffusion-related kernels.

Parameters
obj_paramsThe input parameters of the object
rm_paramsThe input parameters of the relationship manager
conditional_extended_layersNumber of layers that will get assigned if the conditions in the function are met

Definition at line 79 of file FVRelationshipManagerInterface.C.

Referenced by FVAnisotropicDiffusion::validParams(), and FVDiffusion::validParams().

83 {
84  parameterError<unsigned short>(
85  obj_params, "ghost_layers", "setRMParamsDiffusion", "non-diffusion");
86  parameterError<MooseEnum>(
87  obj_params, "variable_interp_method", "setRMParamsDiffusion", "non-diffusion");
88 
89  auto ghost_layers = obj_params.get<unsigned short>("ghost_layers");
90  const auto & interp_method_in = obj_params.get<MooseEnum>("variable_interp_method");
91  const auto interp_method = Moose::FV::selectInterpolationMethod(interp_method_in);
92 
93  // For the interpolation techniques below, we will need to extend ghosting
95  ghost_layers = std::max(conditional_extended_layers, ghost_layers);
96 
97  setRMParams(obj_params, rm_params, ghost_layers);
98 }
auto max(const L &left, const R &right)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
static void setRMParams(const InputParameters &obj_params, InputParameters &rm_params, const unsigned short ghost_layers)
Helper function to set the relationship manager parameters.
(gc*elem+(1-gc)*neighbor)+gradient*(rf-rf&#39;)
InterpMethod selectInterpolationMethod(const std::string &interp_method)
Definition: MathFVUtils.C:81

◆ validParams()

InputParameters FVRelationshipManagerInterface::validParams ( )
static

Definition at line 14 of file FVRelationshipManagerInterface.C.

Referenced by LinearFVKernel::validParams(), and FVKernel::validParams().

15 {
16  // Create InputParameters object that will be appended to the parameters for the inheriting object
18 
19  params.addParam<unsigned short>("ghost_layers", 1, "The number of layers of elements to ghost.");
20  params.addParam<bool>("use_point_neighbors",
21  false,
22  "Whether to use point neighbors, which introduces additional ghosting to "
23  "that used for simple face neighbors.");
24  params.addParamNamesToGroup("ghost_layers use_point_neighbors", "Parallel ghosting");
25 
26  params.addParam<bool>("use_displaced_mesh",
27  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  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.
40  "ElementSideNeighborLayers",
43  [](const InputParameters & obj_params, InputParameters & rm_params)
44  {
46  obj_params, rm_params, obj_params.get<unsigned short>("ghost_layers"));
47  });
48 
49  return params;
50 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
InputParameters emptyInputParameters()
static void setRMParams(const InputParameters &obj_params, InputParameters &rm_params, const unsigned short ghost_layers)
Helper function to set the relationship manager parameters.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...

The documentation for this class was generated from the following files: