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

This class allows us to have a section of the input file like the following which automatically adds all the required nonlinear variables with the appropriate scaling. More...

#include <AddNavierStokesVariablesAction.h>

Inheritance diagram for AddNavierStokesVariablesAction:
[legend]

Public Member Functions

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

Protected Types

typedef std::vector< VariableName > CoupledName
 

Protected Attributes

std::vector< Real > _scaling
 
std::vector< SubdomainName > _blocks
 
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 all the required nonlinear variables with the appropriate scaling.

[NavierStokes] [./Variables]

'rho rhou rhov rhoE'

scaling = '1. 1. 1. 9.869232667160121e-6' family = LAGRANGE order = FIRST [../] []

Definition at line 34 of file AddNavierStokesVariablesAction.h.

Member Typedef Documentation

◆ CoupledName

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

Definition at line 43 of file NSAction.h.

Constructor & Destructor Documentation

◆ AddNavierStokesVariablesAction()

AddNavierStokesVariablesAction::AddNavierStokesVariablesAction ( InputParameters  parameters)

Definition at line 50 of file AddNavierStokesVariablesAction.C.

51  : NSAction(parameters),
52  _scaling(getParam<std::vector<Real>>("scaling")),
53  _blocks(getParam<std::vector<SubdomainName>>("block"))
54 {
55 }
NSAction(InputParameters parameters)
Definition: NSAction.C:30

◆ ~AddNavierStokesVariablesAction()

AddNavierStokesVariablesAction::~AddNavierStokesVariablesAction ( )
virtual

Definition at line 57 of file AddNavierStokesVariablesAction.C.

57 {}

Member Function Documentation

◆ act()

void AddNavierStokesVariablesAction::act ( )
virtual

Reimplemented from NSAction.

Definition at line 60 of file AddNavierStokesVariablesAction.C.

61 {
62  // Call the base class's act() function to initialize the _vars and _auxs names.
63  NSAction::act();
64 
65  // Make sure the number of scaling parameters matches the number of variables
66  if (_scaling.size() != _vars.size())
67  mooseError("Must provide a scaling parameter for each variable.");
68 
69  // All variables have the same type
70  FEType fe_type(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
71  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family")));
72 
73  std::set<SubdomainID> _block_ids;
74  for (const auto & subdomain_name : _blocks)
75  {
76  SubdomainID id = _mesh->getSubdomainID(subdomain_name);
77  _block_ids.insert(id);
78  }
79 
80  if (_block_ids.size() == 0)
81  {
82  // Add the variables to the FEProblemBase
83  for (unsigned int i = 0; i < _vars.size(); ++i)
84  _problem->addVariable(_vars[i], fe_type, _scaling[i]);
85 
86  // Add Aux variables. These are all required in order for the code
87  // to run, so they should not be independently selectable by the
88  // user.
89  for (const auto & aux_name : _auxs)
90  _problem->addAuxVariable(aux_name, fe_type);
91  }
92  else
93  {
94  // Add the variables to the FEProblemBase
95  for (unsigned int i = 0; i < _vars.size(); ++i)
96  _problem->addVariable(_vars[i], fe_type, _scaling[i], &_block_ids);
97 
98  // Add Aux variables. These are all required in order for the code
99  // to run, so they should not be independently selectable by the
100  // user.
101  for (const auto & aux_name : _auxs)
102  _problem->addAuxVariable(aux_name, fe_type, &_block_ids);
103  }
104 }
std::vector< std::string > _auxs
Definition: NSAction.h:36
std::vector< std::string > _vars
Definition: NSAction.h:35
virtual void act()
Definition: NSAction.C:35

Member Data Documentation

◆ _auxs

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

Definition at line 36 of file NSAction.h.

Referenced by NSAction::act(), AddNavierStokesICsAction::act(), and act().

◆ _blocks

std::vector<SubdomainName> AddNavierStokesVariablesAction::_blocks
protected

Definition at line 44 of file AddNavierStokesVariablesAction.h.

Referenced by act().

◆ _dim

unsigned int NSAction::_dim
protectedinherited

◆ _scaling

std::vector<Real> AddNavierStokesVariablesAction::_scaling
protected

Definition at line 43 of file AddNavierStokesVariablesAction.h.

Referenced by act().

◆ _vars

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

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