https://mooseframework.inl.gov
NavierStokesPhysicsBase.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 
12 #include "NSFVUtils.h"
13 #include "RelationshipManager.h"
14 #include "WCNSFVFlowPhysics.h"
15 
18 {
20  params.addClassDescription(
21  "Base class to define the Navier Stokes incompressible and weakly-compressible equation");
22 
23  params.addParam<bool>(
24  "define_variables",
25  true,
26  "Whether to define variables if the variables with the specified names do not exist. Note "
27  "that if the variables are defined externally from the Physics, the initial conditions will "
28  "not be created in the Physics either.");
29 
30  params.addParam<unsigned short>(
31  "ghost_layers", 2, "Number of layers of elements to ghost near process domain boundaries");
32  params.addParamNamesToGroup("define_variables ghost_layers", "Advanced");
33 
34  return params;
35 }
36 
38  : PhysicsBase(parameters), _define_variables(getParam<bool>("define_variables"))
39 {
40 }
41 
42 void
44 {
45  const std::string method_name = interpolation_method;
46  if (getProblem().hasFVInterpolationMethod(method_name))
47  return;
48 
49  const auto method_type = NS::fvAdvectedInterpolationMethodType(interpolation_method);
50 
51  InputParameters params = getFactory().getValidParams(method_type);
52  getProblem().addFVInterpolationMethod(method_type, method_name, params);
53 }
54 
57 {
58  unsigned short necessary_layers = getParam<unsigned short>("ghost_layers");
59  necessary_layers = std::max(necessary_layers, getNumberAlgebraicGhostingLayersNeeded());
60 
61  // Just an object that has a ghost_layers parameter
62  const std::string kernel_type = "INSFVMixingLengthReynoldsStress";
63  InputParameters params = getFactory().getValidParams(kernel_type);
64  params.template set<unsigned short>("ghost_layers") = necessary_layers;
65 
66  return params;
67 }
Factory & getFactory()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addFVAdvectedInterpolationMethod(const MooseEnum &interpolation_method)
Add the FVInterpolationMethod object for an advected interpolation method if absent.
InputParameters getValidParams(const std::string &name) const
std::string fvAdvectedInterpolationMethodType(const MooseEnum &interpolation_method)
Gets the FVInterpolationMethod object type for an advected interpolation method.
Definition: NSFVUtils.C:67
virtual FEProblemBase & getProblem()
static InputParameters validParams()
NavierStokesPhysicsBase(const InputParameters &parameters)
virtual unsigned short getNumberAlgebraicGhostingLayersNeeded() const =0
Return the number of ghosting layers needed.
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
virtual void addFVInterpolationMethod(const std::string &method_type, const std::string &name, InputParameters &parameters)
InputParameters getAdditionalRMParams() const override
Parameters to change or add relationship managers.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)