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 31 of file AddNavierStokesVariablesAction.h.

Member Typedef Documentation

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

Definition at line 40 of file NSAction.h.

Constructor & Destructor Documentation

AddNavierStokesVariablesAction::AddNavierStokesVariablesAction ( InputParameters  parameters)

Definition at line 43 of file AddNavierStokesVariablesAction.C.

44  : NSAction(parameters),
45  _scaling(getParam<std::vector<Real>>("scaling")),
46  _blocks(getParam<std::vector<SubdomainName>>("block"))
47 {
48 }
NSAction(InputParameters parameters)
Definition: NSAction.C:28
AddNavierStokesVariablesAction::~AddNavierStokesVariablesAction ( )
virtual

Definition at line 50 of file AddNavierStokesVariablesAction.C.

50 {}

Member Function Documentation

void AddNavierStokesVariablesAction::act ( )
virtual

Reimplemented from NSAction.

Definition at line 53 of file AddNavierStokesVariablesAction.C.

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

Member Data Documentation

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

Definition at line 33 of file NSAction.h.

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

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

Definition at line 41 of file AddNavierStokesVariablesAction.h.

Referenced by act().

unsigned int NSAction::_dim
protectedinherited
std::vector<Real> AddNavierStokesVariablesAction::_scaling
protected

Definition at line 40 of file AddNavierStokesVariablesAction.h.

Referenced by act().

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

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