https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FVRelationshipManagerInterface.C
Go to the documentation of this file.
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
11#include "MathFVUtils.h"
12
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}
51
52void
54 const InputParameters & obj_params,
55 InputParameters & rm_params,
56 const unsigned short conditional_extended_layers)
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}
77
78void
80 const InputParameters & obj_params,
81 InputParameters & rm_params,
82 const unsigned short conditional_extended_layers)
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}
99
100void
102 InputParameters & rm_params,
103 const unsigned short ghost_layers)
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}
InputParameters emptyInputParameters()
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.
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.
static void setRMParams(const InputParameters &obj_params, InputParameters &rm_params, const unsigned short ghost_layers)
Helper function to set the relationship manager parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
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.
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
@ SkewCorrectedAverage
(gc*elem+(1-gc)*neighbor)+gradient*(rf-rf')
InterpMethod selectInterpolationMethod(const std::string &interp_method)
Definition MathFVUtils.C:81