www.mooseframework.org
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
AddNavierStokesKernelsAction Class Reference

This class allows us to have a section of the input file like the following which automatically adds Kernels and AuxKernels for all the required nonlinear and auxiliary variables. More...

#include <AddNavierStokesKernelsAction.h>

Inheritance diagram for AddNavierStokesKernelsAction:
[legend]

Public Member Functions

 AddNavierStokesKernelsAction (InputParameters parameters)
 
virtual ~AddNavierStokesKernelsAction ()
 
virtual void act ()
 

Protected Types

typedef std::vector< VariableName > CoupledName
 

Protected Member Functions

void setCommonParams (InputParameters &params)
 
void coupleVelocities (InputParameters &params)
 
void coupleMomentums (InputParameters &params)
 
void addNSMassInviscidFlux ()
 
void addNSMomentumInviscidFlux (unsigned int component)
 
void addNSEnergyInviscidFlux ()
 
void addNSSUPGMass ()
 
void addNSSUPGMomentum (unsigned int component)
 
void addNSSUPGEnergy ()
 
void addPressureOrTemperatureAux (const std::string &kernel_type)
 
void addNSVelocityAux (unsigned int component)
 
void addNSEnthalpyAux ()
 
void addNSMachAux ()
 
void addNSInternalEnergyAux ()
 
void addSpecificVolumeComputation ()
 

Protected Attributes

UserObjectName _fp_name
 
std::vector< std::string > _vars
 
std::vector< std::string > _auxs
 
unsigned int _dim
 

Detailed Description

This class allows us to have a section of the input file like the following which automatically adds Kernels and AuxKernels for all the required nonlinear and auxiliary variables.

[NavierStokes] [./Kernels] [../] []

Definition at line 29 of file AddNavierStokesKernelsAction.h.

Member Typedef Documentation

◆ CoupledName

typedef std::vector<VariableName> NSAction::CoupledName
protectedinherited

Definition at line 42 of file NSAction.h.

Constructor & Destructor Documentation

◆ AddNavierStokesKernelsAction()

AddNavierStokesKernelsAction::AddNavierStokesKernelsAction ( InputParameters  parameters)

Definition at line 32 of file AddNavierStokesKernelsAction.C.

33  : NSAction(parameters), _fp_name(getParam<UserObjectName>("fluid_properties"))
34 {
35 }

◆ ~AddNavierStokesKernelsAction()

AddNavierStokesKernelsAction::~AddNavierStokesKernelsAction ( )
virtual

Definition at line 37 of file AddNavierStokesKernelsAction.C.

37 {}

Member Function Documentation

◆ act()

void AddNavierStokesKernelsAction::act ( )
virtual

Reimplemented from NSAction.

Definition at line 40 of file AddNavierStokesKernelsAction.C.

41 {
42  // Call the base class's act() function to initialize the _vars and _auxs names.
43  NSAction::act();
44 
45  // Add time derivative Kernel for all the _vars
46  for (const auto & name : _vars)
47  {
48  const std::string kernel_type = "TimeDerivative";
49  InputParameters params = _factory.getValidParams(kernel_type);
50  params.set<NonlinearVariableName>("variable") = name;
51  _problem->addKernel(kernel_type, name + std::string("_time_deriv"), params);
52  }
53 
54  // Add all the inviscid flux Kernels.
57  for (unsigned int component = 0; component < _dim; ++component)
59 
60  // Add SUPG Kernels
61  addNSSUPGMass();
63  for (unsigned int component = 0; component < _dim; ++component)
65 
66  // Add AuxKernels.
67  addPressureOrTemperatureAux("NSPressureAux");
68  addPressureOrTemperatureAux("NSTemperatureAux");
70  addNSMachAux();
73  for (unsigned int component = 0; component < _dim; ++component)
75 }

◆ addNSEnergyInviscidFlux()

void AddNavierStokesKernelsAction::addNSEnergyInviscidFlux ( )
protected

Definition at line 260 of file AddNavierStokesKernelsAction.C.

261 {
262  const std::string kernel_type = "NSEnergyInviscidFlux";
263  InputParameters params = _factory.getValidParams(kernel_type);
264  params.set<NonlinearVariableName>("variable") = NS::total_energy;
265  setCommonParams(params);
266 
267  // Extra stuff needed by energy equation
268  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
269 
270  // Add the Kernel
271  _problem->addKernel(kernel_type, "rhoE_if", params);
272 }

Referenced by act().

◆ addNSEnthalpyAux()

void AddNavierStokesKernelsAction::addNSEnthalpyAux ( )
protected

Definition at line 184 of file AddNavierStokesKernelsAction.C.

185 {
186  const std::string kernel_type = "NSEnthalpyAux";
187 
188  InputParameters params = _factory.getValidParams(kernel_type);
189  params.set<AuxVariableName>("variable") = NS::enthalpy;
190 
191  // coupled variables
192  params.set<CoupledName>(NS::density) = {NS::density};
194  params.set<CoupledName>(NS::pressure) = {NS::pressure};
195 
196  _problem->addAuxKernel(kernel_type, "enthalpy_auxkernel", params);
197 }

Referenced by act().

◆ addNSInternalEnergyAux()

void AddNavierStokesKernelsAction::addNSInternalEnergyAux ( )
protected

Definition at line 146 of file AddNavierStokesKernelsAction.C.

147 {
148  const std::string kernel_type = "NSInternalEnergyAux";
149 
150  InputParameters params = _factory.getValidParams(kernel_type);
151  params.set<AuxVariableName>("variable") = NS::internal_energy;
152 
153  // coupled variables
154  params.set<CoupledName>(NS::density) = {NS::density};
156 
157  // Couple the appropriate number of velocities
158  coupleVelocities(params);
159 
160  _problem->addAuxKernel(kernel_type, "internal_energy_auxkernel", params);
161 }

Referenced by act().

◆ addNSMachAux()

void AddNavierStokesKernelsAction::addNSMachAux ( )
protected

Definition at line 164 of file AddNavierStokesKernelsAction.C.

165 {
166  const std::string kernel_type = "NSMachAux";
167 
168  InputParameters params = _factory.getValidParams(kernel_type);
169  params.set<AuxVariableName>("variable") = NS::mach_number;
170 
171  // coupled variables
174 
175  // Couple the appropriate number of velocities
176  coupleVelocities(params);
177 
178  params.set<UserObjectName>("fluid_properties") = _fp_name;
179 
180  _problem->addAuxKernel(kernel_type, "mach_auxkernel", params);
181 }

Referenced by act().

◆ addNSMassInviscidFlux()

void AddNavierStokesKernelsAction::addNSMassInviscidFlux ( )
protected

Definition at line 233 of file AddNavierStokesKernelsAction.C.

234 {
235  const std::string kernel_type = "NSMassInviscidFlux";
236  InputParameters params = _factory.getValidParams(kernel_type);
237  params.set<NonlinearVariableName>("variable") = NS::density;
238  setCommonParams(params);
239  _problem->addKernel(kernel_type, "rho_if", params);
240 }

Referenced by act().

◆ addNSMomentumInviscidFlux()

void AddNavierStokesKernelsAction::addNSMomentumInviscidFlux ( unsigned int  component)
protected

Definition at line 243 of file AddNavierStokesKernelsAction.C.

244 {
245  const static std::string momentums[3] = {NS::momentum_x, NS::momentum_y, NS::momentum_z};
246  const std::string kernel_type = "NSMomentumInviscidFlux";
247  InputParameters params = _factory.getValidParams(kernel_type);
248  params.set<NonlinearVariableName>("variable") = momentums[component];
249  setCommonParams(params);
250 
251  // Extra stuff needed by momentum Kernels
252  params.set<CoupledName>(NS::pressure) = {NS::pressure};
253  params.set<unsigned int>("component") = component;
254 
255  // Add the Kernel
256  _problem->addKernel(kernel_type, momentums[component] + std::string("if"), params);
257 }

Referenced by act().

◆ addNSSUPGEnergy()

void AddNavierStokesKernelsAction::addNSSUPGEnergy ( )
protected

Definition at line 113 of file AddNavierStokesKernelsAction.C.

114 {
115  const std::string kernel_type = "NSSUPGEnergy";
116  InputParameters params = _factory.getValidParams(kernel_type);
117  params.set<NonlinearVariableName>("variable") = NS::total_energy;
118  setCommonParams(params);
119 
120  // SUPG Kernels also need temperature and enthalpy currently.
122  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
123 
124  _problem->addKernel(kernel_type, "rhoE_supg", params);
125 }

Referenced by act().

◆ addNSSUPGMass()

void AddNavierStokesKernelsAction::addNSSUPGMass ( )
protected

Definition at line 78 of file AddNavierStokesKernelsAction.C.

79 {
80  const std::string kernel_type = "NSSUPGMass";
81  InputParameters params = _factory.getValidParams(kernel_type);
82  params.set<NonlinearVariableName>("variable") = NS::density;
83  setCommonParams(params);
84 
85  // SUPG Kernels also need temperature and enthalpy currently.
87  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
88 
89  _problem->addKernel(kernel_type, "rho_supg", params);
90 }

Referenced by act().

◆ addNSSUPGMomentum()

void AddNavierStokesKernelsAction::addNSSUPGMomentum ( unsigned int  component)
protected

Definition at line 93 of file AddNavierStokesKernelsAction.C.

94 {
95  const static std::string momentums[3] = {NS::momentum_x, NS::momentum_y, NS::momentum_z};
96 
97  const std::string kernel_type = "NSSUPGMomentum";
98  InputParameters params = _factory.getValidParams(kernel_type);
99  params.set<NonlinearVariableName>("variable") = momentums[component];
100  setCommonParams(params);
101 
102  // SUPG Kernels also need temperature and enthalpy currently.
104  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
105 
106  // Momentum Kernels also need the component.
107  params.set<unsigned int>("component") = component;
108 
109  _problem->addKernel(kernel_type, momentums[component] + std::string("_supg"), params);
110 }

Referenced by act().

◆ addNSVelocityAux()

void AddNavierStokesKernelsAction::addNSVelocityAux ( unsigned int  component)
protected

Definition at line 200 of file AddNavierStokesKernelsAction.C.

201 {
202  const std::string kernel_type = "NSVelocityAux";
203  const static std::string velocities[3] = {NS::velocity_x, NS::velocity_y, NS::velocity_z};
204  const static std::string momentums[3] = {NS::momentum_x, NS::momentum_y, NS::momentum_z};
205 
206  InputParameters params = _factory.getValidParams(kernel_type);
207  params.set<AuxVariableName>("variable") = velocities[component];
208 
209  // coupled variables
210  params.set<CoupledName>(NS::density) = {NS::density};
211  params.set<CoupledName>("momentum") = {momentums[component]};
212  params.set<UserObjectName>("fluid_properties") = _fp_name;
213 
214  _problem->addAuxKernel(kernel_type, velocities[component] + "_auxkernel", params);
215 }

Referenced by act().

◆ addPressureOrTemperatureAux()

void AddNavierStokesKernelsAction::addPressureOrTemperatureAux ( const std::string &  kernel_type)
protected

Definition at line 218 of file AddNavierStokesKernelsAction.C.

219 {
220  InputParameters params = _factory.getValidParams(kernel_type);
221  std::string var_name = (kernel_type == "NSPressureAux" ? NS::pressure : NS::temperature);
222  params.set<AuxVariableName>("variable") = var_name;
223 
224  // coupled variables
227  params.set<UserObjectName>("fluid_properties") = _fp_name;
228 
229  _problem->addAuxKernel(kernel_type, var_name + "_auxkernel", params);
230 }

Referenced by act().

◆ addSpecificVolumeComputation()

void AddNavierStokesKernelsAction::addSpecificVolumeComputation ( )
protected

Definition at line 128 of file AddNavierStokesKernelsAction.C.

129 {
130  const std::string kernel_type = "ParsedAux";
131 
132  InputParameters params = _factory.getValidParams(kernel_type);
133  params.set<AuxVariableName>("variable") = NS::specific_volume;
134 
135  // arguments
136  params.set<CoupledName>("args") = {NS::density};
137 
138  // expression
139  std::string function = "if(" + NS::density + " = 0, 1e10, 1 / " + NS::density + ")";
140  params.set<std::string>("function") = function;
141 
142  _problem->addAuxKernel(kernel_type, "specific_volume_auxkernel", params);
143 }

Referenced by act().

◆ coupleMomentums()

void AddNavierStokesKernelsAction::coupleMomentums ( InputParameters &  params)
protected

Definition at line 302 of file AddNavierStokesKernelsAction.C.

303 {
304  params.set<CoupledName>(NS::momentum_x) = {NS::momentum_x};
305 
306  if (_dim >= 2)
307  params.set<CoupledName>(NS::momentum_y) = {NS::momentum_y};
308 
309  if (_dim >= 3)
310  params.set<CoupledName>(NS::momentum_z) = {NS::momentum_z};
311 }

Referenced by setCommonParams().

◆ coupleVelocities()

void AddNavierStokesKernelsAction::coupleVelocities ( InputParameters &  params)
protected

Definition at line 290 of file AddNavierStokesKernelsAction.C.

291 {
292  params.set<CoupledName>(NS::velocity_x) = {NS::velocity_x};
293 
294  if (_dim >= 2)
295  params.set<CoupledName>(NS::velocity_y) = {NS::velocity_y};
296 
297  if (_dim >= 3)
298  params.set<CoupledName>(NS::velocity_z) = {NS::velocity_z};
299 }

Referenced by addNSInternalEnergyAux(), addNSMachAux(), and setCommonParams().

◆ setCommonParams()

void AddNavierStokesKernelsAction::setCommonParams ( InputParameters &  params)
protected

Definition at line 275 of file AddNavierStokesKernelsAction.C.

276 {
277  // coupled variables
278  params.set<CoupledName>(NS::density) = {NS::density};
280 
281  // Couple the appropriate number of velocities
282  coupleVelocities(params);
283  coupleMomentums(params);
284 
285  // FluidProperties object
286  params.set<UserObjectName>("fluid_properties") = _fp_name;
287 }

Referenced by addNSEnergyInviscidFlux(), addNSMassInviscidFlux(), addNSMomentumInviscidFlux(), addNSSUPGEnergy(), addNSSUPGMass(), and addNSSUPGMomentum().

Member Data Documentation

◆ _auxs

std::vector<std::string> NSAction::_auxs
protectedinherited

◆ _dim

unsigned int NSAction::_dim
protectedinherited

Definition at line 39 of file NSAction.h.

Referenced by NSAction::act(), act(), coupleMomentums(), and coupleVelocities().

◆ _fp_name

UserObjectName AddNavierStokesKernelsAction::_fp_name
protected

◆ _vars

std::vector<std::string> NSAction::_vars
protectedinherited

The documentation for this class was generated from the following files:
AddNavierStokesKernelsAction::addNSMassInviscidFlux
void addNSMassInviscidFlux()
Definition: AddNavierStokesKernelsAction.C:233
NS::velocity_x
const std::string velocity_x
Definition: NS.h:22
AddNavierStokesKernelsAction::_fp_name
UserObjectName _fp_name
Definition: AddNavierStokesKernelsAction.h:65
AddNavierStokesKernelsAction::addNSSUPGEnergy
void addNSSUPGEnergy()
Definition: AddNavierStokesKernelsAction.C:113
AddNavierStokesKernelsAction::addNSInternalEnergyAux
void addNSInternalEnergyAux()
Definition: AddNavierStokesKernelsAction.C:146
AddNavierStokesKernelsAction::addNSVelocityAux
void addNSVelocityAux(unsigned int component)
Definition: AddNavierStokesKernelsAction.C:200
AddNavierStokesKernelsAction::addNSSUPGMass
void addNSSUPGMass()
Definition: AddNavierStokesKernelsAction.C:78
NS::specific_volume
const std::string specific_volume
Definition: NS.h:30
AddNavierStokesKernelsAction::coupleVelocities
void coupleVelocities(InputParameters &params)
Definition: AddNavierStokesKernelsAction.C:290
NS::velocity_y
const std::string velocity_y
Definition: NS.h:23
NS::velocity_z
const std::string velocity_z
Definition: NS.h:24
AddNavierStokesKernelsAction::coupleMomentums
void coupleMomentums(InputParameters &params)
Definition: AddNavierStokesKernelsAction.C:302
NSAction::_vars
std::vector< std::string > _vars
Definition: NSAction.h:34
NS::momentum_y
const std::string momentum_y
Definition: NS.h:18
NSAction::act
virtual void act()
Definition: NSAction.C:35
NS::mach_number
const std::string mach_number
Definition: NS.h:28
NSAction::CoupledName
std::vector< VariableName > CoupledName
Definition: NSAction.h:42
AddNavierStokesKernelsAction::addNSSUPGMomentum
void addNSSUPGMomentum(unsigned int component)
Definition: AddNavierStokesKernelsAction.C:93
NSAction::_dim
unsigned int _dim
Definition: NSAction.h:39
AddNavierStokesKernelsAction::setCommonParams
void setCommonParams(InputParameters &params)
Definition: AddNavierStokesKernelsAction.C:275
AddNavierStokesKernelsAction::addNSEnergyInviscidFlux
void addNSEnergyInviscidFlux()
Definition: AddNavierStokesKernelsAction.C:260
NS::density
const std::string density
Definition: NS.h:16
NS::enthalpy
const std::string enthalpy
Definition: NS.h:27
AddNavierStokesKernelsAction::addNSMachAux
void addNSMachAux()
Definition: AddNavierStokesKernelsAction.C:164
name
const std::string name
Definition: Setup.h:21
NS::momentum_z
const std::string momentum_z
Definition: NS.h:19
AddNavierStokesKernelsAction::addNSEnthalpyAux
void addNSEnthalpyAux()
Definition: AddNavierStokesKernelsAction.C:184
MaterialTensorCalculatorTools::component
Real component(const SymmTensor &symm_tensor, unsigned int index)
Definition: MaterialTensorCalculatorTools.C:16
NS::momentum_x
const std::string momentum_x
Definition: NS.h:17
NS::internal_energy
const std::string internal_energy
Definition: NS.h:29
NSAction::NSAction
NSAction(InputParameters parameters)
Definition: NSAction.C:30
AddNavierStokesKernelsAction::addSpecificVolumeComputation
void addSpecificVolumeComputation()
Definition: AddNavierStokesKernelsAction.C:128
AddNavierStokesKernelsAction::addNSMomentumInviscidFlux
void addNSMomentumInviscidFlux(unsigned int component)
Definition: AddNavierStokesKernelsAction.C:243
NS::temperature
const std::string temperature
Definition: NS.h:26
AddNavierStokesKernelsAction::addPressureOrTemperatureAux
void addPressureOrTemperatureAux(const std::string &kernel_type)
Definition: AddNavierStokesKernelsAction.C:218
NS::total_energy
const std::string total_energy
Definition: NS.h:20
NS::pressure
const std::string pressure
Definition: NS.h:25