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

User object for querying a single-phase or two-phase fluid properties object. More...

#include <FluidPropertiesInterrogator.h>

Inheritance diagram for FluidPropertiesInterrogator:
[legend]

Public Member Functions

 FluidPropertiesInterrogator (const InputParameters &parameters)
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void finalize () override
 

Protected Member Functions

void execute1Phase (const SinglePhaseFluidProperties *const fp_1phase, const std::string &description, bool throw_error_if_no_match)
 Queries a 1-phase fluid properties object. More...
 
void executeVaporMixture (bool throw_error_if_no_match)
 Queries a vapor mixture fluid properties object. More...
 
void execute2Phase ()
 Queries a 2-phase fluid properties object. More...
 
std::map< std::string, bool > getSpecifiedSetMap (const std::vector< std::vector< std::string >> &parameter_sets, const std::string &fp_type, bool throw_error_if_no_match) const
 Gets a map of a parameter set to a flag telling whether that set was provided. More...
 
void outputHeader (const std::string &header) const
 Outputs a header for a section of properties. More...
 
void outputProperty (const std::string &name, const Real &value, const std::string &units)
 Outputs a property value. More...
 
void outputStaticProperties (const SinglePhaseFluidProperties *const fp, const Real &rho, const Real &e, const Real &p, const Real &T)
 Outputs static properties for a single-phase fluid properties object. More...
 
void outputStagnationProperties (const SinglePhaseFluidProperties *const fp, const Real &rho, const Real &e, const Real &p, const Real &T, const Real &vel)
 Outputs stagnation properties for a single-phase fluid properties object. More...
 
void outputVaporMixtureStaticProperties (const Real &rho, const Real &e, const Real &p, const Real &T, const std::vector< Real > &x_ncg)
 Outputs static properties for a vapor mixture fluid properties object. More...
 
void outputVaporMixtureStagnationProperties (const Real &rho, const Real &e, const Real &p, const Real &T, const std::vector< Real > &x_ncg, const Real &vel)
 Outputs stagnation properties for a vapor mixture fluid properties object. More...
 

Protected Attributes

const FluidProperties *const _fp
 pointer to fluid properties object More...
 
const SinglePhaseFluidProperties *const _fp_1phase
 pointer to 1-phase fluid properties object (if provided 1-phase object) More...
 
const TwoPhaseFluidProperties *const _fp_2phase
 pointer to 2-phase fluid properties object (if provided 2-phase object) More...
 
const TwoPhaseNCGFluidProperties *const _fp_2phase_ncg
 pointer to 2-phase NCG fluid properties object (if provided 2-phase NCG object) More...
 
const bool _has_1phase
 flag that user provided 1-phase fluid properties More...
 
const bool _has_vapor_mixture
 flag that user provided vapor mixture fluid properties More...
 
const bool _has_2phase
 flag that user provided 2-phase fluid properties More...
 
const bool _has_2phase_ncg
 flag that user provided 2-phase NCG fluid properties More...
 
const SinglePhaseFluidProperties *const _fp_liquid
 pointer to liquid fluid properties object (if provided 2-phase object) More...
 
const SinglePhaseFluidProperties *const _fp_vapor
 pointer to vapor fluid properties object (if provided 2-phase object) More...
 
const VaporMixtureFluidProperties *const _fp_vapor_mixture
 pointer to vapor mixture fluid properties object (if provided 2-phase NCG object) More...
 
bool _nan_encountered
 flag that NaN has been encountered More...
 
const unsigned int & _precision
 Precision used for printing values. More...
 

Detailed Description

User object for querying a single-phase or two-phase fluid properties object.

Definition at line 27 of file FluidPropertiesInterrogator.h.

Constructor & Destructor Documentation

◆ FluidPropertiesInterrogator()

FluidPropertiesInterrogator::FluidPropertiesInterrogator ( const InputParameters &  parameters)

Definition at line 42 of file FluidPropertiesInterrogator.C.

43  : GeneralUserObject(parameters),
44  _fp(&getUserObject<FluidProperties>("fp")),
45  _fp_1phase(dynamic_cast<const SinglePhaseFluidProperties * const>(_fp)),
46  _fp_2phase(dynamic_cast<const TwoPhaseFluidProperties * const>(_fp)),
47  _fp_2phase_ncg(dynamic_cast<const TwoPhaseNCGFluidProperties * const>(_fp)),
49  _has_vapor_mixture(dynamic_cast<const VaporMixtureFluidProperties * const>(_fp)),
53  ? &getUserObjectByName<SinglePhaseFluidProperties>(_fp_2phase->getLiquidName())
54  : nullptr),
56  ? &getUserObjectByName<SinglePhaseFluidProperties>(_fp_2phase->getVaporName())
57  : nullptr),
59  ? dynamic_cast<const VaporMixtureFluidProperties * const>(_fp)
60  : (_has_2phase_ncg ? &getUserObjectByName<VaporMixtureFluidProperties>(
62  : nullptr)),
63  _nan_encountered(false),
64  _precision(getParam<unsigned int>("precision"))
65 {
67  mooseError(
68  "The type of the parameter 'fp' must be derived from type 'SinglePhaseFluidProperties', "
69  "'VaporMixtureFluidProperties', or 'TwoPhaseFluidProperties'.");
70 }
const SinglePhaseFluidProperties *const _fp_vapor
pointer to vapor fluid properties object (if provided 2-phase object)
virtual const UserObjectName & getLiquidName() const
Returns the name of the liquid single-phase fluid properties object.
virtual const UserObjectName & getVaporName() const
Returns the name of the vapor single-phase fluid properties object.
const VaporMixtureFluidProperties *const _fp_vapor_mixture
pointer to vapor mixture fluid properties object (if provided 2-phase NCG object) ...
const FluidProperties *const _fp
pointer to fluid properties object
const TwoPhaseFluidProperties *const _fp_2phase
pointer to 2-phase fluid properties object (if provided 2-phase object)
const bool _has_2phase_ncg
flag that user provided 2-phase NCG fluid properties
const unsigned int & _precision
Precision used for printing values.
const SinglePhaseFluidProperties *const _fp_liquid
pointer to liquid fluid properties object (if provided 2-phase object)
bool _nan_encountered
flag that NaN has been encountered
const UserObjectName & getVaporMixtureName() const
Returns the name of the vapor mixture fluid properties object.
const bool _has_1phase
flag that user provided 1-phase fluid properties
const TwoPhaseNCGFluidProperties *const _fp_2phase_ncg
pointer to 2-phase NCG fluid properties object (if provided 2-phase NCG object)
const bool _has_vapor_mixture
flag that user provided vapor mixture fluid properties
const bool _has_2phase
flag that user provided 2-phase fluid properties
const SinglePhaseFluidProperties *const _fp_1phase
pointer to 1-phase fluid properties object (if provided 1-phase object)

Member Function Documentation

◆ execute()

void FluidPropertiesInterrogator::execute ( )
overridevirtual

Definition at line 78 of file FluidPropertiesInterrogator.C.

79 {
80  if (_has_2phase_ncg)
81  {
82  execute2Phase();
83  execute1Phase(_fp_liquid, "LIQUID phase", false);
84  executeVaporMixture(false);
85  }
86  else if (_has_2phase)
87  {
88  execute2Phase();
89  execute1Phase(_fp_liquid, "LIQUID phase", false);
90  execute1Phase(_fp_vapor, "VAPOR phase", false);
91  }
92  else if (_has_vapor_mixture)
93  executeVaporMixture(true);
94  else
95  execute1Phase(_fp_1phase, "Single-phase", true);
96 }
const SinglePhaseFluidProperties *const _fp_vapor
pointer to vapor fluid properties object (if provided 2-phase object)
const bool _has_2phase_ncg
flag that user provided 2-phase NCG fluid properties
void executeVaporMixture(bool throw_error_if_no_match)
Queries a vapor mixture fluid properties object.
const SinglePhaseFluidProperties *const _fp_liquid
pointer to liquid fluid properties object (if provided 2-phase object)
void execute1Phase(const SinglePhaseFluidProperties *const fp_1phase, const std::string &description, bool throw_error_if_no_match)
Queries a 1-phase fluid properties object.
const bool _has_vapor_mixture
flag that user provided vapor mixture fluid properties
const bool _has_2phase
flag that user provided 2-phase fluid properties
const SinglePhaseFluidProperties *const _fp_1phase
pointer to 1-phase fluid properties object (if provided 1-phase object)
void execute2Phase()
Queries a 2-phase fluid properties object.

◆ execute1Phase()

void FluidPropertiesInterrogator::execute1Phase ( const SinglePhaseFluidProperties *const  fp_1phase,
const std::string &  description,
bool  throw_error_if_no_match 
)
protected

Queries a 1-phase fluid properties object.

Parameters
[in]fp_1phase1-phase fluid properties
[in]descriptionString describing the 1-phase fluid properties
[in]throw_error_if_no_matchOption to throw an error if no sets match the inputs

Definition at line 104 of file FluidPropertiesInterrogator.C.

Referenced by execute().

107 {
108  // reset NaN flag
109  _nan_encountered = false;
110 
111  // determine how state is specified
112  std::vector<std::vector<std::string>> parameter_sets = {{"p", "T"}, {"rho", "e"}, {"rho", "p"}};
113  if (_has_1phase)
114  parameter_sets.push_back({"rho", "rhou", "rhoE"});
115  auto specified = getSpecifiedSetMap(parameter_sets, "one-phase", throw_error_if_no_match);
116 
117  // compute/determine rho, e, p, T, vel
118 
119  Real rho, e, p, T, vel;
120  bool specified_a_set = false;
121  if (specified["rho,e"])
122  {
123  rho = getParam<Real>("rho");
124  e = getParam<Real>("e");
125  const Real v = 1.0 / rho;
126  p = fp_1phase->p_from_v_e(v, e);
127  T = fp_1phase->T_from_v_e(v, e);
128  if (isParamValid("vel"))
129  vel = getParam<Real>("vel");
130 
131  specified_a_set = true;
132  }
133  else if (specified["rho,p"])
134  {
135  rho = getParam<Real>("rho");
136  p = getParam<Real>("p");
137  const Real v = 1.0 / rho;
138  e = fp_1phase->e_from_p_rho(p, rho);
139  T = fp_1phase->T_from_v_e(v, e);
140  if (isParamValid("vel"))
141  vel = getParam<Real>("vel");
142 
143  specified_a_set = true;
144  }
145  else if (specified["p,T"])
146  {
147  p = getParam<Real>("p");
148  T = getParam<Real>("T");
149  rho = fp_1phase->rho_from_p_T(p, T);
150  e = fp_1phase->e_from_p_rho(p, rho);
151  if (isParamValid("vel"))
152  vel = getParam<Real>("vel");
153 
154  specified_a_set = true;
155  }
156  else if (specified["rho,rhou,rhoE"])
157  {
158  rho = getParam<Real>("rho");
159  const Real rhou = getParam<Real>("rhou");
160  const Real rhoE = getParam<Real>("rhoE");
161 
162  vel = rhou / rho;
163  const Real E = rhoE / rho;
164  e = E - 0.5 * vel * vel;
165 
166  const Real v = 1.0 / rho;
167  p = fp_1phase->p_from_v_e(v, e);
168  T = fp_1phase->T_from_v_e(v, e);
169 
170  specified_a_set = true;
171  }
172 
173  if (specified_a_set)
174  {
175  // output static property values
176  outputHeader(description + " STATIC properties");
177  outputStaticProperties(fp_1phase, rho, e, p, T);
178 
179  // output stagnation property values
180  if (isParamValid("vel") || specified["rho,rhou,rhoE"])
181  {
182  outputHeader(description + " STAGNATION properties");
183  outputStagnationProperties(fp_1phase, rho, e, p, T, vel);
184  }
185 
186  // warn if NaN encountered
187  if (_nan_encountered)
188  mooseWarning(
189  "At least one NaN was encountered. This implies one of the following:\n",
190  " 1. The specified thermodynamic state is inconsistent with the equation of state\n",
191  " (for example, the state corresponds to a different phase of the fluid).\n",
192  " 2. There is a problem with the equation of state package at this state\n",
193  " (for example, the supplied state is outside of the valid state space\n",
194  " that was programmed in the package).");
195  }
196 }
bool _nan_encountered
flag that NaN has been encountered
void outputStaticProperties(const SinglePhaseFluidProperties *const fp, const Real &rho, const Real &e, const Real &p, const Real &T)
Outputs static properties for a single-phase fluid properties object.
const bool _has_1phase
flag that user provided 1-phase fluid properties
std::map< std::string, bool > getSpecifiedSetMap(const std::vector< std::vector< std::string >> &parameter_sets, const std::string &fp_type, bool throw_error_if_no_match) const
Gets a map of a parameter set to a flag telling whether that set was provided.
void outputHeader(const std::string &header) const
Outputs a header for a section of properties.
void outputStagnationProperties(const SinglePhaseFluidProperties *const fp, const Real &rho, const Real &e, const Real &p, const Real &T, const Real &vel)
Outputs stagnation properties for a single-phase fluid properties object.

◆ execute2Phase()

void FluidPropertiesInterrogator::execute2Phase ( )
protected

Queries a 2-phase fluid properties object.

Definition at line 281 of file FluidPropertiesInterrogator.C.

Referenced by execute().

282 {
283  // reset NaN flag
284  _nan_encountered = false;
285 
286  // determine how state is specified
287  std::vector<std::vector<std::string>> parameter_sets = {{"p", "T"}, {"p"}, {"T"}};
288  auto specified = getSpecifiedSetMap(parameter_sets, "two-phase", true);
289 
290  // output the requested quantities
291 
292  outputHeader("TWO-PHASE properties");
293 
294  const Real p_critical = _fp_2phase->p_critical();
295  outputProperty("Critical pressure", p_critical, "Pa");
296  if (specified["p"])
297  {
298  const Real p = getParam<Real>("p");
299  const Real T_sat = _fp_2phase->T_sat(p);
300  const Real h_lat = _fp_2phase->h_lat(p, T_sat);
301  outputProperty("Saturation temperature", T_sat, "K");
302  outputProperty("Latent heat of vaporization", h_lat, "J/kg");
303  }
304  if (specified["T"])
305  {
306  const Real T = getParam<Real>("T");
307  const Real p_sat = _fp_2phase->p_sat(T);
308  const Real h_lat = _fp_2phase->h_lat(p_sat, T);
309  const Real sigma = _fp_2phase->sigma_from_T(T);
310  outputProperty("Saturation pressure", p_sat, "Pa");
311  outputProperty("Latent heat of vaporization", h_lat, "J/kg");
312  outputProperty("Surface tension", sigma, "N/m");
313  }
314  if (specified["p,T"])
315  {
316  const Real p = getParam<Real>("p");
317  const Real T = getParam<Real>("T");
318  const Real h_lat = _fp_2phase->h_lat(p, T);
319  outputProperty("Latent heat of vaporization", h_lat, "J/kg");
320  }
321  _console << std::endl;
322 
323  // warn if NaN encountered
324  if (_nan_encountered)
325  mooseWarning("At least one NaN was encountered.");
326 }
const TwoPhaseFluidProperties *const _fp_2phase
pointer to 2-phase fluid properties object (if provided 2-phase object)
bool _nan_encountered
flag that NaN has been encountered
void outputProperty(const std::string &name, const Real &value, const std::string &units)
Outputs a property value.
virtual Real h_lat(Real p, Real T) const
Computes latent heat of vaporization.
virtual Real p_critical() const =0
Returns the critical pressure.
std::map< std::string, bool > getSpecifiedSetMap(const std::vector< std::vector< std::string >> &parameter_sets, const std::string &fp_type, bool throw_error_if_no_match) const
Gets a map of a parameter set to a flag telling whether that set was provided.
virtual Real p_sat(Real T) const =0
Computes the saturation pressure at a temperature.
virtual Real T_sat(Real p) const =0
Computes the saturation temperature at a pressure.
void outputHeader(const std::string &header) const
Outputs a header for a section of properties.
virtual Real sigma_from_T(Real T) const
Computes surface tension sigma of saturated liquid in contact with saturated vapor.

◆ executeVaporMixture()

void FluidPropertiesInterrogator::executeVaporMixture ( bool  throw_error_if_no_match)
protected

Queries a vapor mixture fluid properties object.

Parameters
[in]throw_error_if_no_matchOption to throw an error if no sets match the inputs

Definition at line 199 of file FluidPropertiesInterrogator.C.

Referenced by execute().

200 {
201  // reset NaN flag
202  _nan_encountered = false;
203 
204  // determine how state is specified
205  std::vector<std::vector<std::string>> parameter_sets = {
206  {"p", "T", "x_ncg"}, {"rho", "e", "x_ncg"}, {"rho", "rhou", "rhoE", "x_ncg"}};
207  auto specified = getSpecifiedSetMap(parameter_sets, "vapor mixture", throw_error_if_no_match);
208 
209  const auto x_ncg = getParam<std::vector<Real>>("x_ncg");
210 
211  // compute/determine rho, e, p, T, vel
212 
213  Real rho, e, p, T, vel;
214  bool specified_a_set = false;
215  if (specified["rho,e,x_ncg"])
216  {
217  rho = getParam<Real>("rho");
218  e = getParam<Real>("e");
219  const Real v = 1.0 / rho;
220  p = _fp_vapor_mixture->p_from_v_e(v, e, x_ncg);
221  T = _fp_vapor_mixture->T_from_v_e(v, e, x_ncg);
222  if (isParamValid("vel"))
223  vel = getParam<Real>("vel");
224 
225  specified_a_set = true;
226  }
227  else if (specified["p,T,x_ncg"])
228  {
229  p = getParam<Real>("p");
230  T = getParam<Real>("T");
231  rho = _fp_vapor_mixture->rho_from_p_T(p, T, x_ncg);
232  e = _fp_vapor_mixture->e_from_p_T(p, T, x_ncg);
233  if (isParamValid("vel"))
234  vel = getParam<Real>("vel");
235 
236  specified_a_set = true;
237  }
238  else if (specified["rho,rhou,rhoE,x_ncg"])
239  {
240  rho = getParam<Real>("rho");
241  const Real rhou = getParam<Real>("rhou");
242  const Real rhoE = getParam<Real>("rhoE");
243 
244  vel = rhou / rho;
245  const Real E = rhoE / rho;
246  e = E - 0.5 * vel * vel;
247 
248  const Real v = 1.0 / rho;
249  p = _fp_vapor_mixture->p_from_v_e(v, e, x_ncg);
250  T = _fp_vapor_mixture->T_from_v_e(v, e, x_ncg);
251 
252  specified_a_set = true;
253  }
254 
255  if (specified_a_set)
256  {
257  // output static property values
258  outputHeader("Vapor mixture STATIC properties");
259  outputVaporMixtureStaticProperties(rho, e, p, T, x_ncg);
260 
261  // output stagnation property values
262  if (isParamValid("vel") || specified["rho,rhou,rhoE,x_ncg"])
263  {
264  outputHeader("Vapor mixture STAGNATION properties");
265  outputVaporMixtureStagnationProperties(rho, e, p, T, x_ncg, vel);
266  }
267 
268  // warn if NaN encountered
269  if (_nan_encountered)
270  mooseWarning(
271  "At least one NaN was encountered. This implies one of the following:\n",
272  " 1. The specified thermodynamic state is inconsistent with the equation of state\n",
273  " (for example, the state corresponds to a different phase of the fluid).\n",
274  " 2. There is a problem with the equation of state package at this state\n",
275  " (for example, the supplied state is outside of the valid state space\n",
276  " that was programmed in the package).");
277  }
278 }
const VaporMixtureFluidProperties *const _fp_vapor_mixture
pointer to vapor mixture fluid properties object (if provided 2-phase NCG object) ...
virtual Real p_from_v_e(Real v, Real e, const std::vector< Real > &x) const =0
Pressure from specific volume and specific internal energy.
bool _nan_encountered
flag that NaN has been encountered
virtual Real e_from_p_T(Real p, Real T, const std::vector< Real > &x) const =0
Specific internal energy from pressure and temperature.
virtual Real rho_from_p_T(Real p, Real T, const std::vector< Real > &x) const =0
Density from pressure and temperature.
std::map< std::string, bool > getSpecifiedSetMap(const std::vector< std::vector< std::string >> &parameter_sets, const std::string &fp_type, bool throw_error_if_no_match) const
Gets a map of a parameter set to a flag telling whether that set was provided.
void outputHeader(const std::string &header) const
Outputs a header for a section of properties.
void outputVaporMixtureStaticProperties(const Real &rho, const Real &e, const Real &p, const Real &T, const std::vector< Real > &x_ncg)
Outputs static properties for a vapor mixture fluid properties object.
void outputVaporMixtureStagnationProperties(const Real &rho, const Real &e, const Real &p, const Real &T, const std::vector< Real > &x_ncg, const Real &vel)
Outputs stagnation properties for a vapor mixture fluid properties object.
virtual Real T_from_v_e(Real v, Real e, const std::vector< Real > &x) const =0
Temperature from specific volume and specific internal energy.

◆ finalize()

void FluidPropertiesInterrogator::finalize ( )
overridevirtual

Definition at line 99 of file FluidPropertiesInterrogator.C.

100 {
101 }

◆ getSpecifiedSetMap()

std::map< std::string, bool > FluidPropertiesInterrogator::getSpecifiedSetMap ( const std::vector< std::vector< std::string >> &  parameter_sets,
const std::string &  fp_type,
bool  throw_error_if_no_match 
) const
protected

Gets a map of a parameter set to a flag telling whether that set was provided.

Parameters
[in]parameter_setsvector of vectors of strings of parameter names. The first dimension is the parameter set, and the second dimension is a parameter within the set. If a set is a subset of another set, the subset should be after the other.
[in]fp_typestring used to identify the set of parameter sets
[in]throw_error_if_no_matchOption to throw an error if no sets match the inputs

Definition at line 329 of file FluidPropertiesInterrogator.C.

Referenced by execute1Phase(), execute2Phase(), and executeVaporMixture().

333 {
334  // get union of parameters from all sets
335  std::vector<std::string> parameter_union;
336  for (auto & parameter_set : parameter_sets)
337  parameter_union.insert(parameter_union.end(), parameter_set.begin(), parameter_set.end());
338  std::sort(parameter_union.begin(), parameter_union.end());
339  parameter_union.erase(std::unique(parameter_union.begin(), parameter_union.end()),
340  parameter_union.end());
341 
342  std::vector<std::string> parameter_set_names;
343  std::map<std::string, bool> specified;
344  bool specified_a_set = false;
345  for (const auto & parameter_set : parameter_sets)
346  {
347  // create unique string to identify parameter set
348  std::stringstream ss;
349  for (unsigned int i = 0; i < parameter_set.size(); i++)
350  if (i == 0)
351  ss << parameter_set[i];
352  else
353  ss << "," << parameter_set[i];
354  const std::string parameter_set_name = ss.str();
355  parameter_set_names.push_back(parameter_set_name);
356 
357  // check if the set parameters were provided
358  bool all_parameters_provided = true;
359  for (const auto & parameter : parameter_set)
360  if (!isParamValid(parameter))
361  all_parameters_provided = false;
362 
363  if (all_parameters_provided)
364  {
365  // exclude set if a superset (assumed to be ordered before this set) was specified
366  if (!specified_a_set)
367  {
368  specified[parameter_set_name] = true;
369 
370  // check that there are no extraneous parameters
371  std::vector<std::string> parameter_set_sorted(parameter_set);
372  std::sort(parameter_set_sorted.begin(), parameter_set_sorted.end());
373  std::vector<std::string> extraneous_parameters;
374  std::set_difference(parameter_union.begin(),
375  parameter_union.end(),
376  parameter_set_sorted.begin(),
377  parameter_set_sorted.end(),
378  std::inserter(extraneous_parameters, extraneous_parameters.end()));
379  for (const auto & parameter : extraneous_parameters)
380  if (isParamValid(parameter))
381  mooseError(name(),
382  ": (",
383  parameter_set_name,
384  ") has been specified; ",
385  parameter,
386  " cannot be specified.");
387  }
388 
389  specified_a_set = true;
390  }
391  else
392  specified[parameter_set_name] = false;
393  }
394 
395  if (!specified_a_set && throw_error_if_no_match)
396  {
397  std::stringstream ss;
398  ss << name() << ": For " << fp_type
399  << " fluid properties, you must provide one of the following\n"
400  "combinations of thermodynamic properties:\n";
401  for (const auto & parameter_set_name : parameter_set_names)
402  ss << " * (" << parameter_set_name << ")\n";
403  mooseError(ss.str());
404  }
405 
406  return specified;
407 }
const std::string name
Definition: Setup.h:21

◆ initialize()

void FluidPropertiesInterrogator::initialize ( )
overridevirtual

Definition at line 73 of file FluidPropertiesInterrogator.C.

74 {
75 }

◆ outputHeader()

void FluidPropertiesInterrogator::outputHeader ( const std::string &  header) const
protected

Outputs a header for a section of properties.

Definition at line 410 of file FluidPropertiesInterrogator.C.

Referenced by execute1Phase(), execute2Phase(), and executeVaporMixture().

411 {
412  _console << std::endl
413  << std::endl
414  << header << ":" << std::endl
415  << std::setfill('-') << std::setw(80) << "-" << std::setfill(' ') << std::endl;
416 }

◆ outputProperty()

void FluidPropertiesInterrogator::outputProperty ( const std::string &  name,
const Real &  value,
const std::string &  units 
)
protected

Outputs a property value.

Definition at line 419 of file FluidPropertiesInterrogator.C.

Referenced by execute2Phase(), outputStagnationProperties(), outputStaticProperties(), outputVaporMixtureStagnationProperties(), and outputVaporMixtureStaticProperties().

422 {
423  const bool use_scientific_notation = ((value < 0.001) || (value >= 10000.0));
424 
425  // check for NaN value
426  const bool is_nan = value != value;
427  if (is_nan)
428  _nan_encountered = true;
429 
430  const std::string units_printed = is_nan ? "" : units;
431 
432  // The console output is not used directly because there is no way to reset
433  // format flags. For example, if scientific format is used, there is no way
434  // to restore the general format (not fixed format); for cout, there are
435  // methods to save and restore format flags, but Console does not provide these.
436  std::stringstream ss;
437 
438  if (use_scientific_notation)
439  ss << std::setw(35) << std::left << name + ":" << std::setw(_precision + 10) << std::right
440  << std::setprecision(_precision) << std::scientific << value << " " << units_printed
441  << std::endl;
442  else
443  ss << std::setw(35) << std::left << name + ":" << std::setw(_precision + 10) << std::right
444  << std::setprecision(_precision) << value << " " << units_printed << std::endl;
445 
446  _console << ss.str();
447 }
const unsigned int & _precision
Precision used for printing values.
bool _nan_encountered
flag that NaN has been encountered
const std::string name
Definition: Setup.h:21

◆ outputStagnationProperties()

void FluidPropertiesInterrogator::outputStagnationProperties ( const SinglePhaseFluidProperties *const  fp,
const Real &  rho,
const Real &  e,
const Real &  p,
const Real &  T,
const Real &  vel 
)
protected

Outputs stagnation properties for a single-phase fluid properties object.

Parameters
[in]fpSingle-phase fluid properties
[in]rhoDensity
[in]eSpecific internal energy
[in]pPressure
[in]TTemperature
[in]velVelocity

Definition at line 484 of file FluidPropertiesInterrogator.C.

Referenced by execute1Phase().

490 {
491  const Real v = 1.0 / rho;
492  const Real s = fp->s_from_v_e(v, e);
493  const Real s0 = s;
494  const Real h = fp->h_from_p_T(p, T);
495  const Real h0 = h + 0.5 * vel * vel;
496  const Real p0 = fp->p_from_h_s(h0, s0);
497  const Real rho0 = fp->rho_from_p_s(p0, s0);
498  const Real e0 = fp->e_from_p_rho(p0, rho0);
499  const Real v0 = 1.0 / rho0;
500  const Real T0 = fp->T_from_v_e(v0, e0);
501  const Real c0 = fp->c_from_v_e(v0, e0);
502  const Real mu0 = fp->mu_from_v_e(v0, e0);
503  const Real cp0 = fp->cp_from_v_e(v0, e0);
504  const Real cv0 = fp->cv_from_v_e(v0, e0);
505  const Real k0 = fp->k_from_v_e(v0, e0);
506  const Real beta0 = fp->beta_from_p_T(p0, T0);
507 
508  outputProperty("Pressure", p0, "Pa");
509  outputProperty("Temperature", T0, "K");
510  outputProperty("Density", rho0, "kg/m^3");
511  outputProperty("Specific volume", v0, "m^3/kg");
512  outputProperty("Specific internal energy", e0, "J/kg");
513  outputProperty("Specific enthalpy", h0, "J/kg");
514  outputProperty("Specific entropy", s0, "J/kg");
515  _console << std::endl;
516  outputProperty("Sound speed", c0, "m/s");
517  outputProperty("Dynamic viscosity", mu0, "Pa-s");
518  outputProperty("Specific heat at constant pressure", cp0, "J/(kg-K)");
519  outputProperty("Specific heat at constant volume", cv0, "J/(kg-K)");
520  outputProperty("Thermal conductivity", k0, "W/(m-K)");
521  outputProperty("Volumetric expansion coefficient", beta0, "1/K");
522  _console << std::endl;
523 }
void outputProperty(const std::string &name, const Real &value, const std::string &units)
Outputs a property value.

◆ outputStaticProperties()

void FluidPropertiesInterrogator::outputStaticProperties ( const SinglePhaseFluidProperties *const  fp,
const Real &  rho,
const Real &  e,
const Real &  p,
const Real &  T 
)
protected

Outputs static properties for a single-phase fluid properties object.

Parameters
[in]fpSingle-phase fluid properties
[in]rhoDensity
[in]eSpecific internal energy
[in]pPressure
[in]TTemperature

Definition at line 450 of file FluidPropertiesInterrogator.C.

Referenced by execute1Phase().

455 {
456  const Real v = 1.0 / rho;
457  const Real h = fp->h_from_p_T(p, T);
458  const Real s = fp->s_from_v_e(v, e);
459  const Real c = fp->c_from_v_e(v, e);
460  const Real mu = fp->mu_from_v_e(v, e);
461  const Real cp = fp->cp_from_v_e(v, e);
462  const Real cv = fp->cv_from_v_e(v, e);
463  const Real k = fp->k_from_v_e(v, e);
464  const Real beta = fp->beta_from_p_T(p, T);
465 
466  outputProperty("Pressure", p, "Pa");
467  outputProperty("Temperature", T, "K");
468  outputProperty("Density", rho, "kg/m^3");
469  outputProperty("Specific volume", v, "m^3/kg");
470  outputProperty("Specific internal energy", e, "J/kg");
471  outputProperty("Specific enthalpy", h, "J/kg");
472  outputProperty("Specific entropy", s, "J/kg");
473  _console << std::endl;
474  outputProperty("Sound speed", c, "m/s");
475  outputProperty("Dynamic viscosity", mu, "Pa-s");
476  outputProperty("Specific heat at constant pressure", cp, "J/(kg-K)");
477  outputProperty("Specific heat at constant volume", cv, "J/(kg-K)");
478  outputProperty("Thermal conductivity", k, "W/(m-K)");
479  outputProperty("Volumetric expansion coefficient", beta, "1/K");
480  _console << std::endl;
481 }
void outputProperty(const std::string &name, const Real &value, const std::string &units)
Outputs a property value.

◆ outputVaporMixtureStagnationProperties()

void FluidPropertiesInterrogator::outputVaporMixtureStagnationProperties ( const Real &  rho,
const Real &  e,
const Real &  p,
const Real &  T,
const std::vector< Real > &  x_ncg,
const Real &  vel 
)
protected

Outputs stagnation properties for a vapor mixture fluid properties object.

Parameters
[in]rhoDensity
[in]eSpecific internal energy
[in]pPressure
[in]TTemperature
[in]x_ncgMass fractions of NCGs
[in]velVelocity

Definition at line 556 of file FluidPropertiesInterrogator.C.

Referenced by executeVaporMixture().

563 {
564  const Real h = e + p / rho;
565  const Real h0 = h + 0.5 * vel * vel;
566 
567  outputProperty("Specific enthalpy", h0, "J/kg");
568  _console << std::endl;
569 }
void outputProperty(const std::string &name, const Real &value, const std::string &units)
Outputs a property value.

◆ outputVaporMixtureStaticProperties()

void FluidPropertiesInterrogator::outputVaporMixtureStaticProperties ( const Real &  rho,
const Real &  e,
const Real &  p,
const Real &  T,
const std::vector< Real > &  x_ncg 
)
protected

Outputs static properties for a vapor mixture fluid properties object.

Parameters
[in]rhoDensity
[in]eSpecific internal energy
[in]pPressure
[in]TTemperature
[in]x_ncgMass fractions of NCGs

Definition at line 526 of file FluidPropertiesInterrogator.C.

Referenced by executeVaporMixture().

531 {
532  const Real v = 1.0 / rho;
533  const Real h = e + p / rho;
534  const Real c = _fp_vapor_mixture->c_from_p_T(p, T, x_ncg);
535  const Real mu = _fp_vapor_mixture->mu_from_p_T(p, T, x_ncg);
536  const Real cp = _fp_vapor_mixture->cp_from_p_T(p, T, x_ncg);
537  const Real cv = _fp_vapor_mixture->cv_from_p_T(p, T, x_ncg);
538  const Real k = _fp_vapor_mixture->k_from_p_T(p, T, x_ncg);
539 
540  outputProperty("Pressure", p, "Pa");
541  outputProperty("Temperature", T, "K");
542  outputProperty("Density", rho, "kg/m^3");
543  outputProperty("Specific volume", v, "m^3/kg");
544  outputProperty("Specific internal energy", e, "J/kg");
545  outputProperty("Specific enthalpy", h, "J/kg");
546  _console << std::endl;
547  outputProperty("Sound speed", c, "m/s");
548  outputProperty("Dynamic viscosity", mu, "Pa-s");
549  outputProperty("Specific heat at constant pressure", cp, "J/(kg-K)");
550  outputProperty("Specific heat at constant volume", cv, "J/(kg-K)");
551  outputProperty("Thermal conductivity", k, "W/(m-K)");
552  _console << std::endl;
553 }
const VaporMixtureFluidProperties *const _fp_vapor_mixture
pointer to vapor mixture fluid properties object (if provided 2-phase NCG object) ...
void outputProperty(const std::string &name, const Real &value, const std::string &units)
Outputs a property value.
virtual Real cv_from_p_T(Real p, Real T, const std::vector< Real > &x) const =0
Isochoric (constant-volume) specific heat from pressure and temperature.
virtual Real mu_from_p_T(Real p, Real T, const std::vector< Real > &x) const =0
Dynamic viscosity from pressure and temperature.
virtual Real c_from_p_T(Real p, Real T, const std::vector< Real > &x) const =0
Sound speed from pressure and temperature.
virtual Real cp_from_p_T(Real p, Real T, const std::vector< Real > &x) const =0
Isobaric (constant-pressure) specific heat from pressure and temperature.
virtual Real k_from_p_T(Real p, Real T, const std::vector< Real > &x) const =0
Thermal conductivity from pressure and temperature.

Member Data Documentation

◆ _fp

const FluidProperties* const FluidPropertiesInterrogator::_fp
protected

pointer to fluid properties object

Definition at line 153 of file FluidPropertiesInterrogator.h.

◆ _fp_1phase

const SinglePhaseFluidProperties* const FluidPropertiesInterrogator::_fp_1phase
protected

pointer to 1-phase fluid properties object (if provided 1-phase object)

Definition at line 155 of file FluidPropertiesInterrogator.h.

Referenced by execute().

◆ _fp_2phase

const TwoPhaseFluidProperties* const FluidPropertiesInterrogator::_fp_2phase
protected

pointer to 2-phase fluid properties object (if provided 2-phase object)

Definition at line 157 of file FluidPropertiesInterrogator.h.

Referenced by execute2Phase().

◆ _fp_2phase_ncg

const TwoPhaseNCGFluidProperties* const FluidPropertiesInterrogator::_fp_2phase_ncg
protected

pointer to 2-phase NCG fluid properties object (if provided 2-phase NCG object)

Definition at line 159 of file FluidPropertiesInterrogator.h.

◆ _fp_liquid

const SinglePhaseFluidProperties* const FluidPropertiesInterrogator::_fp_liquid
protected

pointer to liquid fluid properties object (if provided 2-phase object)

Definition at line 171 of file FluidPropertiesInterrogator.h.

Referenced by execute().

◆ _fp_vapor

const SinglePhaseFluidProperties* const FluidPropertiesInterrogator::_fp_vapor
protected

pointer to vapor fluid properties object (if provided 2-phase object)

Definition at line 173 of file FluidPropertiesInterrogator.h.

Referenced by execute().

◆ _fp_vapor_mixture

const VaporMixtureFluidProperties* const FluidPropertiesInterrogator::_fp_vapor_mixture
protected

pointer to vapor mixture fluid properties object (if provided 2-phase NCG object)

Definition at line 175 of file FluidPropertiesInterrogator.h.

Referenced by executeVaporMixture(), and outputVaporMixtureStaticProperties().

◆ _has_1phase

const bool FluidPropertiesInterrogator::_has_1phase
protected

flag that user provided 1-phase fluid properties

Definition at line 162 of file FluidPropertiesInterrogator.h.

Referenced by execute1Phase(), and FluidPropertiesInterrogator().

◆ _has_2phase

const bool FluidPropertiesInterrogator::_has_2phase
protected

flag that user provided 2-phase fluid properties

Definition at line 166 of file FluidPropertiesInterrogator.h.

Referenced by execute(), and FluidPropertiesInterrogator().

◆ _has_2phase_ncg

const bool FluidPropertiesInterrogator::_has_2phase_ncg
protected

flag that user provided 2-phase NCG fluid properties

Definition at line 168 of file FluidPropertiesInterrogator.h.

Referenced by execute().

◆ _has_vapor_mixture

const bool FluidPropertiesInterrogator::_has_vapor_mixture
protected

flag that user provided vapor mixture fluid properties

Definition at line 164 of file FluidPropertiesInterrogator.h.

Referenced by execute(), and FluidPropertiesInterrogator().

◆ _nan_encountered

bool FluidPropertiesInterrogator::_nan_encountered
protected

flag that NaN has been encountered

Definition at line 178 of file FluidPropertiesInterrogator.h.

Referenced by execute1Phase(), execute2Phase(), executeVaporMixture(), and outputProperty().

◆ _precision

const unsigned int& FluidPropertiesInterrogator::_precision
protected

Precision used for printing values.

Definition at line 181 of file FluidPropertiesInterrogator.h.

Referenced by outputProperty().


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