https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PINSFVSpeedFunctorMaterial.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 "NS.h"
12#include "NavierStokesMethods.h"
13
15
18{
20 params.addClassDescription("This is the material class used to compute the interstitial velocity"
21 " norm for the incompressible and weakly compressible primitive "
22 "superficial finite-volume implementation of porous media equations.");
23
24 params.addRequiredParam<MooseFunctorName>(NS::porosity, "porosity");
25 params.addParam<MooseFunctorName>(
26 NS::superficial_velocity_x, 0, "The x component of the fluid superficial velocity variable.");
27 params.addParam<MooseFunctorName>(
28 NS::superficial_velocity_y, 0, "The y component of the fluid superficial velocity variable.");
29 params.addParam<MooseFunctorName>(
30 NS::superficial_velocity_z, 0, "The z component of the fluid superficial velocity variable.");
31 auto add_property = [&params](const auto & property_name)
32 {
33 params.addParam<MooseFunctorName>(property_name,
34 property_name,
35 "The name to give the declared '" + property_name +
36 "' functor property");
37 };
38 add_property(NS::velocity);
39 add_property(NS::speed);
40 add_property(NS::velocity_x);
41 add_property(NS::velocity_y);
42 add_property(NS::velocity_z);
43 params.addParam<bool>("define_interstitial_velocity_components",
44 true,
45 "Whether to define the interstitial velocity functors");
46
47 return params;
48}
49
51 : FunctorMaterial(parameters),
52 _eps(getFunctor<ADReal>(NS::porosity)),
53 _superficial_vel_x(getFunctor<ADReal>(NS::superficial_velocity_x)),
54 _superficial_vel_y(getFunctor<ADReal>(NS::superficial_velocity_y)),
55 _superficial_vel_z(getFunctor<ADReal>(NS::superficial_velocity_z))
56{
57 // Check dimension of the mesh
58 const unsigned int num_components_specified =
62 if (num_components_specified != blocksMaxDimension())
63 mooseError("Only ",
64 num_components_specified,
65 " superficial velocity components were provided for a mesh of dimension ",
67
68 // Interstitial velocity is needed by certain correlations
69 const auto & interstitial_velocity = addFunctorProperty<ADRealVectorValue>(
70 getParam<MooseFunctorName>(NS::velocity),
71 [this](const auto & r, const auto & t) -> ADRealVectorValue
72 {
73 return ADRealVectorValue(
75 _eps(r, t);
76 });
77
78 // Speed is normal of regular interstitial velocity
79 // This is needed to compute the Reynolds number
80 addFunctorProperty<ADReal>(getParam<MooseFunctorName>(NS::speed),
81 [&interstitial_velocity](const auto & r, const auto & t) -> ADReal
82 { return NS::computeSpeed<ADReal>(interstitial_velocity(r, t)); });
83
84 // This is not needed for non-porous media, but they can use the 'speed' functor for some friction
85 // models
86 if (getParam<bool>("define_interstitial_velocity_components"))
87 {
88 addFunctorProperty<ADReal>(getParam<MooseFunctorName>(NS::velocity_x),
89 [&interstitial_velocity](const auto & r, const auto & t) -> ADReal
90 { return interstitial_velocity(r, t)(0); });
91 addFunctorProperty<ADReal>(getParam<MooseFunctorName>(NS::velocity_y),
92 [&interstitial_velocity](const auto & r, const auto & t) -> ADReal
93 { return interstitial_velocity(r, t)(1); });
94 addFunctorProperty<ADReal>(getParam<MooseFunctorName>(NS::velocity_z),
95 [&interstitial_velocity](const auto & r, const auto & t) -> ADReal
96 { return interstitial_velocity(r, t)(2); });
97 }
98}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", PINSFVSpeedFunctorMaterial)
unsigned int blocksMaxDimension() const
static InputParameters validParams()
bool isParamSetByUser(const std::string &name) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const InputParameters & parameters() const
void mooseError(Args &&... args) const
Material class used to compute the interstitial velocity norm for the incompressible and weakly compr...
const Moose::Functor< ADReal > & _superficial_vel_y
const Moose::Functor< ADReal > & _eps
Porosity.
static InputParameters validParams()
const Moose::Functor< ADReal > & _superficial_vel_x
PINSFVSpeedFunctorMaterial(const InputParameters &parameters)
const Moose::Functor< ADReal > & _superficial_vel_z
static const std::string superficial_velocity_y
Definition NS.h:52
static const std::string velocity_y
Definition NS.h:48
static const std::string superficial_velocity_z
Definition NS.h:53
template ADReal computeSpeed< ADReal >(const libMesh::VectorValue< ADReal > &velocity)
static const std::string velocity_z
Definition NS.h:49
static const std::string porosity
Definition NS.h:108
static const std::string superficial_velocity_x
Definition NS.h:51
static const std::string speed
Definition NS.h:147
static const std::string velocity_x
Definition NS.h:47
static const std::string velocity
Definition NS.h:46