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

NSInitialCondition sets intial constant values for all variables given the: .) Initial pressure .) Initial temperature .) Initial velocity and a FluidProperties UserObject. More...

#include <NSInitialCondition.h>

Inheritance diagram for NSInitialCondition:
[legend]

Public Member Functions

 NSInitialCondition (const InputParameters &parameters)
 
virtual Real value (const Point &p)
 The value of the variable at a point. More...
 

Protected Attributes

Real _initial_pressure
 
Real _initial_temperature
 
RealVectorValue _initial_velocity
 
const IdealGasFluidProperties_fp
 

Detailed Description

NSInitialCondition sets intial constant values for all variables given the: .) Initial pressure .) Initial temperature .) Initial velocity and a FluidProperties UserObject.

Definition at line 31 of file NSInitialCondition.h.

Constructor & Destructor Documentation

◆ NSInitialCondition()

NSInitialCondition::NSInitialCondition ( const InputParameters &  parameters)

Definition at line 40 of file NSInitialCondition.C.

41  : InitialCondition(parameters),
42  _initial_pressure(getParam<Real>("initial_pressure")),
43  _initial_temperature(getParam<Real>("initial_temperature")),
44  _initial_velocity(getParam<RealVectorValue>("initial_velocity")),
45  _fp(getUserObject<IdealGasFluidProperties>("fluid_properties"))
46 {
47 }
const IdealGasFluidProperties & _fp
RealVectorValue _initial_velocity

Member Function Documentation

◆ value()

Real NSInitialCondition::value ( const Point &  p)
virtual

The value of the variable at a point.

Definition at line 50 of file NSInitialCondition.C.

51 {
52  const Real rho_initial = _fp.rho_from_p_T(_initial_pressure, _initial_temperature);
53 
54  // TODO: The internal energy could be computed by the IdealGasFluidProperties.
55  const Real e_initial = _fp.cv() * _initial_temperature;
56  const Real E_initial = e_initial + 0.5 * _initial_velocity.norm_sq();
57  const Real v_initial = 1. / rho_initial;
58 
59  if (_var.name() == NS::enthalpy)
60  return E_initial + _initial_pressure / rho_initial;
61 
62  if (_var.name() == NS::internal_energy)
63  return e_initial;
64 
65  if (_var.name() == NS::mach_number)
66  return _initial_velocity.norm() / _fp.c_from_v_e(v_initial, e_initial);
67 
68  if (_var.name() == NS::pressure)
69  return _initial_pressure;
70 
71  if (_var.name() == NS::density)
72  return rho_initial;
73 
74  if (_var.name() == NS::momentum_x)
75  return rho_initial * _initial_velocity(0);
76 
77  if (_var.name() == NS::momentum_y)
78  return rho_initial * _initial_velocity(1);
79 
80  if (_var.name() == NS::momentum_z)
81  return rho_initial * _initial_velocity(2);
82 
83  if (_var.name() == NS::total_energy)
84  return rho_initial * E_initial;
85 
86  if (_var.name() == NS::specific_volume)
87  return v_initial;
88 
89  if (_var.name() == NS::temperature)
90  return _initial_temperature;
91 
92  if (_var.name() == NS::velocity_x)
93  return _initial_velocity(0);
94 
95  if (_var.name() == NS::velocity_y)
96  return _initial_velocity(1);
97 
98  if (_var.name() == NS::velocity_z)
99  return _initial_velocity(2);
100 
101  // If we got here, then the variable name was not one of the ones we know about.
102  mooseError("Unrecognized variable: ", _var.name());
103  return 0.;
104 }
const std::string momentum_x
Definition: NS.h:18
virtual Real rho_from_p_T(Real p, Real T) const override
Density from pressure and temperature.
const std::string mach_number
Definition: NS.h:29
const std::string velocity_z
Definition: NS.h:25
const std::string density
Definition: NS.h:17
const std::string velocity_x
Definition: NS.h:23
const std::string temperature
Definition: NS.h:27
const std::string enthalpy
Definition: NS.h:28
const IdealGasFluidProperties & _fp
RealVectorValue _initial_velocity
const std::string specific_volume
Definition: NS.h:31
const std::string velocity_y
Definition: NS.h:24
const std::string momentum_y
Definition: NS.h:19
const std::string pressure
Definition: NS.h:26
const std::string total_energy
Definition: NS.h:21
virtual Real c_from_v_e(Real v, Real e) const override
Sound speed from specific volume and specific internal energy.
const std::string internal_energy
Definition: NS.h:30
const std::string momentum_z
Definition: NS.h:20

Member Data Documentation

◆ _fp

const IdealGasFluidProperties& NSInitialCondition::_fp
protected

Definition at line 47 of file NSInitialCondition.h.

Referenced by value().

◆ _initial_pressure

Real NSInitialCondition::_initial_pressure
protected

Definition at line 42 of file NSInitialCondition.h.

Referenced by value().

◆ _initial_temperature

Real NSInitialCondition::_initial_temperature
protected

Definition at line 43 of file NSInitialCondition.h.

Referenced by value().

◆ _initial_velocity

RealVectorValue NSInitialCondition::_initial_velocity
protected

Definition at line 44 of file NSInitialCondition.h.

Referenced by value().


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