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 addNSSpecificVolumeAux ()
 

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 27 of file AddNavierStokesKernelsAction.h.

Member Typedef Documentation

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

Definition at line 40 of file NSAction.h.

Constructor & Destructor Documentation

AddNavierStokesKernelsAction::AddNavierStokesKernelsAction ( InputParameters  parameters)

Definition at line 28 of file AddNavierStokesKernelsAction.C.

29  : NSAction(parameters), _fp_name(getParam<UserObjectName>("fluid_properties"))
30 {
31 }
NSAction(InputParameters parameters)
Definition: NSAction.C:28
AddNavierStokesKernelsAction::~AddNavierStokesKernelsAction ( )
virtual

Definition at line 33 of file AddNavierStokesKernelsAction.C.

33 {}

Member Function Documentation

void AddNavierStokesKernelsAction::act ( )
virtual

Reimplemented from NSAction.

Definition at line 36 of file AddNavierStokesKernelsAction.C.

37 {
38  // Call the base class's act() function to initialize the _vars and _auxs names.
39  NSAction::act();
40 
41  // Add time derivative Kernel for all the _vars
42  for (const auto & name : _vars)
43  {
44  const std::string kernel_type = "TimeDerivative";
45  InputParameters params = _factory.getValidParams(kernel_type);
46  params.set<NonlinearVariableName>("variable") = name;
47  _problem->addKernel(kernel_type, name + std::string("_time_deriv"), params);
48  }
49 
50  // Add all the inviscid flux Kernels.
53  for (unsigned int component = 0; component < _dim; ++component)
55 
56  // Add SUPG Kernels
57  addNSSUPGMass();
59  for (unsigned int component = 0; component < _dim; ++component)
61 
62  // Add AuxKernels.
63  addPressureOrTemperatureAux("NSPressureAux");
64  addPressureOrTemperatureAux("NSTemperatureAux");
66  addNSMachAux();
69  for (unsigned int component = 0; component < _dim; ++component)
71 }
void addNSMomentumInviscidFlux(unsigned int component)
void addPressureOrTemperatureAux(const std::string &kernel_type)
Real component(const SymmTensor &symm_tensor, unsigned int index)
void addNSSUPGMomentum(unsigned int component)
unsigned int _dim
Definition: NSAction.h:37
std::vector< std::string > _vars
Definition: NSAction.h:32
void addNSVelocityAux(unsigned int component)
virtual void act()
Definition: NSAction.C:33
void AddNavierStokesKernelsAction::addNSEnergyInviscidFlux ( )
protected

Definition at line 252 of file AddNavierStokesKernelsAction.C.

Referenced by act().

253 {
254  const std::string kernel_type = "NSEnergyInviscidFlux";
255  InputParameters params = _factory.getValidParams(kernel_type);
256  params.set<NonlinearVariableName>("variable") = NS::total_energy;
257  setCommonParams(params);
258 
259  // Extra stuff needed by energy equation
260  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
261 
262  // Add the Kernel
263  _problem->addKernel(kernel_type, "rhoE_if", params);
264 }
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string enthalpy
Definition: NS.h:26
const std::string total_energy
Definition: NS.h:19
void AddNavierStokesKernelsAction::addNSEnthalpyAux ( )
protected

Definition at line 176 of file AddNavierStokesKernelsAction.C.

Referenced by act().

177 {
178  const std::string kernel_type = "NSEnthalpyAux";
179 
180  InputParameters params = _factory.getValidParams(kernel_type);
181  params.set<AuxVariableName>("variable") = NS::enthalpy;
182 
183  // coupled variables
184  params.set<CoupledName>(NS::density) = {NS::density};
186  params.set<CoupledName>(NS::pressure) = {NS::pressure};
187 
188  _problem->addAuxKernel(kernel_type, "enthalpy_auxkernel", params);
189 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string density
Definition: NS.h:15
const std::string enthalpy
Definition: NS.h:26
const std::string pressure
Definition: NS.h:24
const std::string total_energy
Definition: NS.h:19
void AddNavierStokesKernelsAction::addNSInternalEnergyAux ( )
protected

Definition at line 138 of file AddNavierStokesKernelsAction.C.

Referenced by act().

139 {
140  const std::string kernel_type = "NSInternalEnergyAux";
141 
142  InputParameters params = _factory.getValidParams(kernel_type);
143  params.set<AuxVariableName>("variable") = NS::internal_energy;
144 
145  // coupled variables
146  params.set<CoupledName>(NS::density) = {NS::density};
148 
149  // Couple the appropriate number of velocities
150  coupleVelocities(params);
151 
152  _problem->addAuxKernel(kernel_type, "internal_energy_auxkernel", params);
153 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string density
Definition: NS.h:15
const std::string total_energy
Definition: NS.h:19
const std::string internal_energy
Definition: NS.h:28
void coupleVelocities(InputParameters &params)
void AddNavierStokesKernelsAction::addNSMachAux ( )
protected

Definition at line 156 of file AddNavierStokesKernelsAction.C.

Referenced by act().

157 {
158  const std::string kernel_type = "NSMachAux";
159 
160  InputParameters params = _factory.getValidParams(kernel_type);
161  params.set<AuxVariableName>("variable") = NS::mach_number;
162 
163  // coupled variables
166 
167  // Couple the appropriate number of velocities
168  coupleVelocities(params);
169 
170  params.set<UserObjectName>("fluid_properties") = _fp_name;
171 
172  _problem->addAuxKernel(kernel_type, "mach_auxkernel", params);
173 }
const std::string mach_number
Definition: NS.h:27
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string specific_volume
Definition: NS.h:29
const std::string internal_energy
Definition: NS.h:28
void coupleVelocities(InputParameters &params)
void AddNavierStokesKernelsAction::addNSMassInviscidFlux ( )
protected

Definition at line 225 of file AddNavierStokesKernelsAction.C.

Referenced by act().

226 {
227  const std::string kernel_type = "NSMassInviscidFlux";
228  InputParameters params = _factory.getValidParams(kernel_type);
229  params.set<NonlinearVariableName>("variable") = NS::density;
230  setCommonParams(params);
231  _problem->addKernel(kernel_type, "rho_if", params);
232 }
void setCommonParams(InputParameters &params)
const std::string density
Definition: NS.h:15
void AddNavierStokesKernelsAction::addNSMomentumInviscidFlux ( unsigned int  component)
protected

Definition at line 235 of file AddNavierStokesKernelsAction.C.

Referenced by act().

236 {
237  const static std::string momentums[3] = {NS::momentum_x, NS::momentum_y, NS::momentum_z};
238  const std::string kernel_type = "NSMomentumInviscidFlux";
239  InputParameters params = _factory.getValidParams(kernel_type);
240  params.set<NonlinearVariableName>("variable") = momentums[component];
241  setCommonParams(params);
242 
243  // Extra stuff needed by momentum Kernels
244  params.set<CoupledName>(NS::pressure) = {NS::pressure};
245  params.set<unsigned int>("component") = component;
246 
247  // Add the Kernel
248  _problem->addKernel(kernel_type, momentums[component] + std::string("if"), params);
249 }
const std::string momentum_x
Definition: NS.h:16
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
Real component(const SymmTensor &symm_tensor, unsigned int index)
const std::string momentum_y
Definition: NS.h:17
const std::string pressure
Definition: NS.h:24
const std::string momentum_z
Definition: NS.h:18
void AddNavierStokesKernelsAction::addNSSpecificVolumeAux ( )
protected

Definition at line 124 of file AddNavierStokesKernelsAction.C.

Referenced by act().

125 {
126  const std::string kernel_type = "NSSpecificVolumeAux";
127 
128  InputParameters params = _factory.getValidParams(kernel_type);
129  params.set<AuxVariableName>("variable") = NS::specific_volume;
130 
131  // coupled variables
132  params.set<CoupledName>(NS::density) = {NS::density};
133 
134  _problem->addAuxKernel(kernel_type, "specific_volume_auxkernel", params);
135 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string density
Definition: NS.h:15
const std::string specific_volume
Definition: NS.h:29
void AddNavierStokesKernelsAction::addNSSUPGEnergy ( )
protected

Definition at line 109 of file AddNavierStokesKernelsAction.C.

Referenced by act().

110 {
111  const std::string kernel_type = "NSSUPGEnergy";
112  InputParameters params = _factory.getValidParams(kernel_type);
113  params.set<NonlinearVariableName>("variable") = NS::total_energy;
114  setCommonParams(params);
115 
116  // SUPG Kernels also need temperature and enthalpy currently.
118  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
119 
120  _problem->addKernel(kernel_type, "rhoE_supg", params);
121 }
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string temperature
Definition: NS.h:25
const std::string enthalpy
Definition: NS.h:26
const std::string total_energy
Definition: NS.h:19
void AddNavierStokesKernelsAction::addNSSUPGMass ( )
protected

Definition at line 74 of file AddNavierStokesKernelsAction.C.

Referenced by act().

75 {
76  const std::string kernel_type = "NSSUPGMass";
77  InputParameters params = _factory.getValidParams(kernel_type);
78  params.set<NonlinearVariableName>("variable") = NS::density;
79  setCommonParams(params);
80 
81  // SUPG Kernels also need temperature and enthalpy currently.
83  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
84 
85  _problem->addKernel(kernel_type, "rho_supg", params);
86 }
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string density
Definition: NS.h:15
const std::string temperature
Definition: NS.h:25
const std::string enthalpy
Definition: NS.h:26
void AddNavierStokesKernelsAction::addNSSUPGMomentum ( unsigned int  component)
protected

Definition at line 89 of file AddNavierStokesKernelsAction.C.

Referenced by act().

90 {
91  const static std::string momentums[3] = {NS::momentum_x, NS::momentum_y, NS::momentum_z};
92 
93  const std::string kernel_type = "NSSUPGMomentum";
94  InputParameters params = _factory.getValidParams(kernel_type);
95  params.set<NonlinearVariableName>("variable") = momentums[component];
96  setCommonParams(params);
97 
98  // SUPG Kernels also need temperature and enthalpy currently.
100  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
101 
102  // Momentum Kernels also need the component.
103  params.set<unsigned int>("component") = component;
104 
105  _problem->addKernel(kernel_type, momentums[component] + std::string("_supg"), params);
106 }
const std::string momentum_x
Definition: NS.h:16
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
Real component(const SymmTensor &symm_tensor, unsigned int index)
const std::string temperature
Definition: NS.h:25
const std::string enthalpy
Definition: NS.h:26
const std::string momentum_y
Definition: NS.h:17
const std::string momentum_z
Definition: NS.h:18
void AddNavierStokesKernelsAction::addNSVelocityAux ( unsigned int  component)
protected

Definition at line 192 of file AddNavierStokesKernelsAction.C.

Referenced by act().

193 {
194  const std::string kernel_type = "NSVelocityAux";
195  const static std::string velocities[3] = {NS::velocity_x, NS::velocity_y, NS::velocity_z};
196  const static std::string momentums[3] = {NS::momentum_x, NS::momentum_y, NS::momentum_z};
197 
198  InputParameters params = _factory.getValidParams(kernel_type);
199  params.set<AuxVariableName>("variable") = velocities[component];
200 
201  // coupled variables
202  params.set<CoupledName>(NS::density) = {NS::density};
203  params.set<CoupledName>("momentum") = {momentums[component]};
204  params.set<UserObjectName>("fluid_properties") = _fp_name;
205 
206  _problem->addAuxKernel(kernel_type, velocities[component] + "_auxkernel", params);
207 }
const std::string momentum_x
Definition: NS.h:16
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string velocity_z
Definition: NS.h:23
const std::string density
Definition: NS.h:15
Real component(const SymmTensor &symm_tensor, unsigned int index)
const std::string velocity_x
Definition: NS.h:21
const std::string velocity_y
Definition: NS.h:22
const std::string momentum_y
Definition: NS.h:17
const std::string momentum_z
Definition: NS.h:18
void AddNavierStokesKernelsAction::addPressureOrTemperatureAux ( const std::string &  kernel_type)
protected

Definition at line 210 of file AddNavierStokesKernelsAction.C.

Referenced by act().

211 {
212  InputParameters params = _factory.getValidParams(kernel_type);
213  std::string var_name = (kernel_type == "NSPressureAux" ? NS::pressure : NS::temperature);
214  params.set<AuxVariableName>("variable") = var_name;
215 
216  // coupled variables
219  params.set<UserObjectName>("fluid_properties") = _fp_name;
220 
221  _problem->addAuxKernel(kernel_type, var_name + "_auxkernel", params);
222 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string temperature
Definition: NS.h:25
const std::string specific_volume
Definition: NS.h:29
const std::string pressure
Definition: NS.h:24
const std::string internal_energy
Definition: NS.h:28
void AddNavierStokesKernelsAction::coupleMomentums ( InputParameters &  params)
protected

Definition at line 294 of file AddNavierStokesKernelsAction.C.

Referenced by setCommonParams().

295 {
296  params.set<CoupledName>(NS::momentum_x) = {NS::momentum_x};
297 
298  if (_dim >= 2)
299  params.set<CoupledName>(NS::momentum_y) = {NS::momentum_y};
300 
301  if (_dim >= 3)
302  params.set<CoupledName>(NS::momentum_z) = {NS::momentum_z};
303 }
const std::string momentum_x
Definition: NS.h:16
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
unsigned int _dim
Definition: NSAction.h:37
const std::string momentum_y
Definition: NS.h:17
const std::string momentum_z
Definition: NS.h:18
void AddNavierStokesKernelsAction::coupleVelocities ( InputParameters &  params)
protected

Definition at line 282 of file AddNavierStokesKernelsAction.C.

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

283 {
284  params.set<CoupledName>(NS::velocity_x) = {NS::velocity_x};
285 
286  if (_dim >= 2)
287  params.set<CoupledName>(NS::velocity_y) = {NS::velocity_y};
288 
289  if (_dim >= 3)
290  params.set<CoupledName>(NS::velocity_z) = {NS::velocity_z};
291 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string velocity_z
Definition: NS.h:23
const std::string velocity_x
Definition: NS.h:21
unsigned int _dim
Definition: NSAction.h:37
const std::string velocity_y
Definition: NS.h:22
void AddNavierStokesKernelsAction::setCommonParams ( InputParameters &  params)
protected

Definition at line 267 of file AddNavierStokesKernelsAction.C.

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

268 {
269  // coupled variables
270  params.set<CoupledName>(NS::density) = {NS::density};
272 
273  // Couple the appropriate number of velocities
274  coupleVelocities(params);
275  coupleMomentums(params);
276 
277  // FluidProperties object
278  params.set<UserObjectName>("fluid_properties") = _fp_name;
279 }
void coupleMomentums(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:40
const std::string density
Definition: NS.h:15
const std::string total_energy
Definition: NS.h:19
void coupleVelocities(InputParameters &params)

Member Data Documentation

std::vector<std::string> NSAction::_auxs
protectedinherited
unsigned int NSAction::_dim
protectedinherited

Definition at line 37 of file NSAction.h.

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

UserObjectName AddNavierStokesKernelsAction::_fp_name
protected
std::vector<std::string> NSAction::_vars
protectedinherited

The documentation for this class was generated from the following files: