https://mooseframework.inl.gov
WCNSFVCoupledAdvectionPhysicsHelper.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 "RelationshipManager.h"
13 #include "WCNSFVFlowPhysicsBase.h"
15 
18 {
20  params.addClassDescription("Class to facilitate coupling between a Physics defining flow "
21  "equations and other objects, notably advection Physics.");
22 
23  params.addParam<PhysicsName>("coupled_flow_physics",
24  "WCNSFVFlowPhysics generating the velocities");
25  params.addParam<PhysicsName>("coupled_turbulence_physics",
26  "Turbulence Physics coupled with this Physics");
27  params.addParamNamesToGroup("coupled_flow_physics coupled_turbulence_physics", "Coupled Physics");
28 
29  return params;
30 }
31 
33  const NavierStokesPhysicsBase * derived_physics)
34  : _advection_physics(derived_physics),
35  _flow_equations_physics(getCoupledFlowPhysics()),
36  _compressibility(_flow_equations_physics->compressibility()),
37  _porous_medium_treatment(_flow_equations_physics->porousMediumTreatment()),
38  _velocity_names(_flow_equations_physics->getVelocityNames()),
39  _pressure_name(_flow_equations_physics->getPressureName()),
40  _density_name(_flow_equations_physics->densityName()),
41  _dynamic_viscosity_name(_flow_equations_physics->dynamicViscosityName()),
42  _velocity_interpolation(_flow_equations_physics->getVelocityFaceInterpolationMethod())
43 {
44 }
45 
46 MooseFunctorName
48 {
50 }
51 
54 {
55  // User passed it, just use that
56  if (_advection_physics->isParamValid("coupled_flow_physics"))
58  _advection_physics->getParam<PhysicsName>("coupled_flow_physics"));
59  // Look for any physics of the right type, and check the block restriction
60  else
61  {
62  const auto all_flow_physics =
64  for (const auto physics : all_flow_physics)
66  physics->name(), physics->blocks(), /*error_if_not_identical=*/false))
67  {
68  return physics;
69  }
70  }
71  mooseError("No coupled flow Physics found of type derived from 'WCNSFVFlowPhysicsBase'. Use the "
72  "'coupled_flow_physics' parameter to give the name of the desired "
73  "WCNSFVFlowPhysicsBase-derived Physics to couple with");
74 }
75 
78 {
79  // User passed it, just use that
80  if (_advection_physics->isParamValid("coupled_turbulence_physics"))
82  _advection_physics->getParam<PhysicsName>("coupled_turbulence_physics"));
83  // Look for any physics of the right type, and check the block restriction
84  else
85  {
86  const auto all_turbulence_physics =
88  for (const auto physics : all_turbulence_physics)
90  physics->name(), physics->blocks(), /*error_if_not_identical=*/false))
91  return physics;
92  }
93  // Did not find one
94  return nullptr;
95 }
Creates all the objects needed to add a turbulence model to an incompressible / weakly-compressible N...
MooseFunctorName getPorosityFunctorName(bool smoothed) const
Return the porosity functor name.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void mooseError(Args &&... args)
const T * getCoupledPhysics(const PhysicsName &phys_name, const bool allow_fail=false) const
const WCNSFVFlowPhysicsBase * getCoupledFlowPhysics() const
WCNSFVCoupledAdvectionPhysicsHelper(const NavierStokesPhysicsBase *derived_physics)
InputParameters emptyInputParameters()
bool isParamValid(const std::string &name) const
MooseFunctorName getPorosityFunctorName(const bool smoothed) const
Base class for Physics which create the Navier Stokes flow equations.
const T & getParam(const std::string &name) const
bool checkBlockRestrictionIdentical(const std::string &object_name, const std::vector< SubdomainName > &blocks, const bool error_if_not_identical=true) const
void addClassDescription(const std::string &doc_string)
Base class to hold common parameters and utilities between all the weakly compressible Navier Stokes-...
const WCNSFVTurbulencePhysics * getCoupledTurbulencePhysics() const
const NavierStokesPhysicsBase * _advection_physics
The Physics class using this helper.
const WCNSFVFlowPhysicsBase * _flow_equations_physics
Flow physics.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)