www.mooseframework.org
AddNavierStokesICsAction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 // Navier-Stokes includes
10 #include "NavierStokesApp.h"
11 #include "NSInitialCondition.h"
12 #include "NSAction.h"
13 
14 // MOOSE includes
15 #include "FEProblem.h"
16 #include "MooseMesh.h"
17 
18 #include "libmesh/string_to_enum.h"
19 #include "libmesh/fe.h"
20 
21 template <>
22 InputParameters
24 {
25  InputParameters params = validParams<NSAction>();
26 
27  params.addClassDescription("This class allows us to have a section of the input file like the "
28  "following which automatically adds initial conditions for all the "
29  "required nonlinear and auxiliary variables.");
30  params.addRequiredParam<Real>("initial_pressure",
31  "The initial pressure, assumed constant everywhere");
32  params.addRequiredParam<Real>("initial_temperature",
33  "The initial temperature, assumed constant everywhere");
34  params.addRequiredParam<RealVectorValue>("initial_velocity",
35  "The initial velocity, assumed constant everywhere");
36  params.addRequiredParam<UserObjectName>("fluid_properties",
37  "The name of the user object for fluid properties");
38 
39  return params;
40 }
41 
43  : NSAction(parameters),
44  _initial_pressure(getParam<Real>("initial_pressure")),
45  _initial_temperature(getParam<Real>("initial_temperature")),
46  _initial_velocity(getParam<RealVectorValue>("initial_velocity")),
47  _fp_name(getParam<UserObjectName>("fluid_properties"))
48 {
49 }
50 
52 
53 void
55 {
56  // Call the base class's act() function to initialize the _vars and _auxs names.
57  NSAction::act();
58 
59  // Now add the ICs for the nonlinear and auxiliary variables
60  addICs(_vars);
61  addICs(_auxs);
62 }
63 
64 void
65 AddNavierStokesICsAction::addICs(std::vector<std::string> & names)
66 {
67  for (const auto & name : names)
68  {
69  InputParameters params = _factory.getValidParams("NSInitialCondition");
70  params.set<VariableName>("variable") = name;
71  params.set<Real>("initial_pressure") = _initial_pressure;
72  params.set<Real>("initial_temperature") = _initial_temperature;
73  params.set<RealVectorValue>("initial_velocity") = _initial_velocity;
74  params.set<UserObjectName>("fluid_properties") = _fp_name;
75  _problem->addInitialCondition("NSInitialCondition", name + std::string("_ic"), params);
76  }
77 }
void addICs(std::vector< std::string > &names)
std::vector< std::string > _auxs
Definition: NSAction.h:33
InputParameters validParams< NSAction >()
Definition: NSAction.C:17
InputParameters validParams< AddNavierStokesICsAction >()
std::vector< std::string > _vars
Definition: NSAction.h:32
virtual void act()
Definition: NSAction.C:33
AddNavierStokesICsAction(InputParameters parameters)
This is a base Action class for the Navier-Stokes module which is responsible for building lists of n...
Definition: NSAction.h:23