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

Member Typedef Documentation

◆ CoupledName

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

Definition at line 43 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 }
NSAction(InputParameters parameters)
Definition: NSAction.C:30

◆ ~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 }
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:40
std::vector< std::string > _vars
Definition: NSAction.h:35
const std::string name
Definition: Setup.h:22
void addNSVelocityAux(unsigned int component)
virtual void act()
Definition: NSAction.C:35

◆ addNSEnergyInviscidFlux()

void AddNavierStokesKernelsAction::addNSEnergyInviscidFlux ( )
protected

Definition at line 256 of file AddNavierStokesKernelsAction.C.

Referenced by act().

257 {
258  const std::string kernel_type = "NSEnergyInviscidFlux";
259  InputParameters params = _factory.getValidParams(kernel_type);
260  params.set<NonlinearVariableName>("variable") = NS::total_energy;
261  setCommonParams(params);
262 
263  // Extra stuff needed by energy equation
264  params.set<CoupledName>(NS::enthalpy) = {NS::enthalpy};
265 
266  // Add the Kernel
267  _problem->addKernel(kernel_type, "rhoE_if", params);
268 }
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string enthalpy
Definition: NS.h:28
const std::string total_energy
Definition: NS.h:21

◆ addNSEnthalpyAux()

void AddNavierStokesKernelsAction::addNSEnthalpyAux ( )
protected

Definition at line 180 of file AddNavierStokesKernelsAction.C.

Referenced by act().

181 {
182  const std::string kernel_type = "NSEnthalpyAux";
183 
184  InputParameters params = _factory.getValidParams(kernel_type);
185  params.set<AuxVariableName>("variable") = NS::enthalpy;
186 
187  // coupled variables
188  params.set<CoupledName>(NS::density) = {NS::density};
190  params.set<CoupledName>(NS::pressure) = {NS::pressure};
191 
192  _problem->addAuxKernel(kernel_type, "enthalpy_auxkernel", params);
193 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string density
Definition: NS.h:17
const std::string enthalpy
Definition: NS.h:28
const std::string pressure
Definition: NS.h:26
const std::string total_energy
Definition: NS.h:21

◆ addNSInternalEnergyAux()

void AddNavierStokesKernelsAction::addNSInternalEnergyAux ( )
protected

Definition at line 142 of file AddNavierStokesKernelsAction.C.

Referenced by act().

143 {
144  const std::string kernel_type = "NSInternalEnergyAux";
145 
146  InputParameters params = _factory.getValidParams(kernel_type);
147  params.set<AuxVariableName>("variable") = NS::internal_energy;
148 
149  // coupled variables
150  params.set<CoupledName>(NS::density) = {NS::density};
152 
153  // Couple the appropriate number of velocities
154  coupleVelocities(params);
155 
156  _problem->addAuxKernel(kernel_type, "internal_energy_auxkernel", params);
157 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string density
Definition: NS.h:17
const std::string total_energy
Definition: NS.h:21
const std::string internal_energy
Definition: NS.h:30
void coupleVelocities(InputParameters &params)

◆ addNSMachAux()

void AddNavierStokesKernelsAction::addNSMachAux ( )
protected

Definition at line 160 of file AddNavierStokesKernelsAction.C.

Referenced by act().

161 {
162  const std::string kernel_type = "NSMachAux";
163 
164  InputParameters params = _factory.getValidParams(kernel_type);
165  params.set<AuxVariableName>("variable") = NS::mach_number;
166 
167  // coupled variables
170 
171  // Couple the appropriate number of velocities
172  coupleVelocities(params);
173 
174  params.set<UserObjectName>("fluid_properties") = _fp_name;
175 
176  _problem->addAuxKernel(kernel_type, "mach_auxkernel", params);
177 }
const std::string mach_number
Definition: NS.h:29
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string specific_volume
Definition: NS.h:31
const std::string internal_energy
Definition: NS.h:30
void coupleVelocities(InputParameters &params)

◆ addNSMassInviscidFlux()

void AddNavierStokesKernelsAction::addNSMassInviscidFlux ( )
protected

Definition at line 229 of file AddNavierStokesKernelsAction.C.

Referenced by act().

230 {
231  const std::string kernel_type = "NSMassInviscidFlux";
232  InputParameters params = _factory.getValidParams(kernel_type);
233  params.set<NonlinearVariableName>("variable") = NS::density;
234  setCommonParams(params);
235  _problem->addKernel(kernel_type, "rho_if", params);
236 }
void setCommonParams(InputParameters &params)
const std::string density
Definition: NS.h:17

◆ addNSMomentumInviscidFlux()

void AddNavierStokesKernelsAction::addNSMomentumInviscidFlux ( unsigned int  component)
protected

Definition at line 239 of file AddNavierStokesKernelsAction.C.

Referenced by act().

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

◆ addNSSpecificVolumeAux()

void AddNavierStokesKernelsAction::addNSSpecificVolumeAux ( )
protected

Definition at line 128 of file AddNavierStokesKernelsAction.C.

Referenced by act().

129 {
130  const std::string kernel_type = "NSSpecificVolumeAux";
131 
132  InputParameters params = _factory.getValidParams(kernel_type);
133  params.set<AuxVariableName>("variable") = NS::specific_volume;
134 
135  // coupled variables
136  params.set<CoupledName>(NS::density) = {NS::density};
137 
138  _problem->addAuxKernel(kernel_type, "specific_volume_auxkernel", params);
139 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string density
Definition: NS.h:17
const std::string specific_volume
Definition: NS.h:31

◆ addNSSUPGEnergy()

void AddNavierStokesKernelsAction::addNSSUPGEnergy ( )
protected

Definition at line 113 of file AddNavierStokesKernelsAction.C.

Referenced by act().

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 }
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string temperature
Definition: NS.h:27
const std::string enthalpy
Definition: NS.h:28
const std::string total_energy
Definition: NS.h:21

◆ addNSSUPGMass()

void AddNavierStokesKernelsAction::addNSSUPGMass ( )
protected

Definition at line 78 of file AddNavierStokesKernelsAction.C.

Referenced by act().

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 }
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string density
Definition: NS.h:17
const std::string temperature
Definition: NS.h:27
const std::string enthalpy
Definition: NS.h:28

◆ addNSSUPGMomentum()

void AddNavierStokesKernelsAction::addNSSUPGMomentum ( unsigned int  component)
protected

Definition at line 93 of file AddNavierStokesKernelsAction.C.

Referenced by act().

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 }
const std::string momentum_x
Definition: NS.h:18
void setCommonParams(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
Real component(const SymmTensor &symm_tensor, unsigned int index)
const std::string temperature
Definition: NS.h:27
const std::string enthalpy
Definition: NS.h:28
const std::string momentum_y
Definition: NS.h:19
const std::string momentum_z
Definition: NS.h:20

◆ addNSVelocityAux()

void AddNavierStokesKernelsAction::addNSVelocityAux ( unsigned int  component)
protected

Definition at line 196 of file AddNavierStokesKernelsAction.C.

Referenced by act().

197 {
198  const std::string kernel_type = "NSVelocityAux";
199  const static std::string velocities[3] = {NS::velocity_x, NS::velocity_y, NS::velocity_z};
200  const static std::string momentums[3] = {NS::momentum_x, NS::momentum_y, NS::momentum_z};
201 
202  InputParameters params = _factory.getValidParams(kernel_type);
203  params.set<AuxVariableName>("variable") = velocities[component];
204 
205  // coupled variables
206  params.set<CoupledName>(NS::density) = {NS::density};
207  params.set<CoupledName>("momentum") = {momentums[component]};
208  params.set<UserObjectName>("fluid_properties") = _fp_name;
209 
210  _problem->addAuxKernel(kernel_type, velocities[component] + "_auxkernel", params);
211 }
const std::string momentum_x
Definition: NS.h:18
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string velocity_z
Definition: NS.h:25
const std::string density
Definition: NS.h:17
Real component(const SymmTensor &symm_tensor, unsigned int index)
const std::string velocity_x
Definition: NS.h:23
const std::string velocity_y
Definition: NS.h:24
const std::string momentum_y
Definition: NS.h:19
const std::string momentum_z
Definition: NS.h:20

◆ addPressureOrTemperatureAux()

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

Definition at line 214 of file AddNavierStokesKernelsAction.C.

Referenced by act().

215 {
216  InputParameters params = _factory.getValidParams(kernel_type);
217  std::string var_name = (kernel_type == "NSPressureAux" ? NS::pressure : NS::temperature);
218  params.set<AuxVariableName>("variable") = var_name;
219 
220  // coupled variables
223  params.set<UserObjectName>("fluid_properties") = _fp_name;
224 
225  _problem->addAuxKernel(kernel_type, var_name + "_auxkernel", params);
226 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string temperature
Definition: NS.h:27
const std::string specific_volume
Definition: NS.h:31
const std::string pressure
Definition: NS.h:26
const std::string internal_energy
Definition: NS.h:30

◆ coupleMomentums()

void AddNavierStokesKernelsAction::coupleMomentums ( InputParameters &  params)
protected

Definition at line 298 of file AddNavierStokesKernelsAction.C.

Referenced by setCommonParams().

299 {
300  params.set<CoupledName>(NS::momentum_x) = {NS::momentum_x};
301 
302  if (_dim >= 2)
303  params.set<CoupledName>(NS::momentum_y) = {NS::momentum_y};
304 
305  if (_dim >= 3)
306  params.set<CoupledName>(NS::momentum_z) = {NS::momentum_z};
307 }
const std::string momentum_x
Definition: NS.h:18
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
unsigned int _dim
Definition: NSAction.h:40
const std::string momentum_y
Definition: NS.h:19
const std::string momentum_z
Definition: NS.h:20

◆ coupleVelocities()

void AddNavierStokesKernelsAction::coupleVelocities ( InputParameters &  params)
protected

Definition at line 286 of file AddNavierStokesKernelsAction.C.

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

287 {
288  params.set<CoupledName>(NS::velocity_x) = {NS::velocity_x};
289 
290  if (_dim >= 2)
291  params.set<CoupledName>(NS::velocity_y) = {NS::velocity_y};
292 
293  if (_dim >= 3)
294  params.set<CoupledName>(NS::velocity_z) = {NS::velocity_z};
295 }
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string velocity_z
Definition: NS.h:25
const std::string velocity_x
Definition: NS.h:23
unsigned int _dim
Definition: NSAction.h:40
const std::string velocity_y
Definition: NS.h:24

◆ setCommonParams()

void AddNavierStokesKernelsAction::setCommonParams ( InputParameters &  params)
protected

Definition at line 271 of file AddNavierStokesKernelsAction.C.

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

272 {
273  // coupled variables
274  params.set<CoupledName>(NS::density) = {NS::density};
276 
277  // Couple the appropriate number of velocities
278  coupleVelocities(params);
279  coupleMomentums(params);
280 
281  // FluidProperties object
282  params.set<UserObjectName>("fluid_properties") = _fp_name;
283 }
void coupleMomentums(InputParameters &params)
std::vector< VariableName > CoupledName
Definition: NSAction.h:43
const std::string density
Definition: NS.h:17
const std::string total_energy
Definition: NS.h:21
void coupleVelocities(InputParameters &params)

Member Data Documentation

◆ _auxs

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

◆ _dim

unsigned int NSAction::_dim
protectedinherited

Definition at line 40 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: