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 outputLiquidSpecificProperties (const LiquidFluidPropertiesInterface *const liquid_fp, const Real &p, const Real &T)
 Outputs liquid-specific properties. 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 29 of file FluidPropertiesInterrogator.h.

Constructor & Destructor Documentation

◆ FluidPropertiesInterrogator()

FluidPropertiesInterrogator::FluidPropertiesInterrogator ( const InputParameters &  parameters)

Definition at line 43 of file FluidPropertiesInterrogator.C.

44  : GeneralUserObject(parameters),
45  _fp(&getUserObject<FluidProperties>("fp")),
46  _fp_1phase(dynamic_cast<const SinglePhaseFluidProperties * const>(_fp)),
47  _fp_2phase(dynamic_cast<const TwoPhaseFluidProperties * const>(_fp)),
48  _fp_2phase_ncg(dynamic_cast<const TwoPhaseNCGFluidProperties * const>(_fp)),
50  _has_vapor_mixture(dynamic_cast<const VaporMixtureFluidProperties * const>(_fp)),
54  ? &getUserObjectByName<SinglePhaseFluidProperties>(_fp_2phase->getLiquidName())
55  : nullptr),
57  ? &getUserObjectByName<SinglePhaseFluidProperties>(_fp_2phase->getVaporName())
58  : nullptr),
60  ? dynamic_cast<const VaporMixtureFluidProperties * const>(_fp)
61  : (_has_2phase_ncg ? &getUserObjectByName<VaporMixtureFluidProperties>(
63  : nullptr)),
64  _nan_encountered(false),
65  _precision(getParam<unsigned int>("precision"))
66 {
68  mooseError(
69  "The type of the parameter 'fp' must be derived from type 'SinglePhaseFluidProperties', "
70  "'VaporMixtureFluidProperties', or 'TwoPhaseFluidProperties'.");
71 }
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 79 of file FluidPropertiesInterrogator.C.

80 {
81  if (_has_2phase_ncg)
82  {
83  execute2Phase();
84  execute1Phase(_fp_liquid, "LIQUID phase", false);
85  executeVaporMixture(false);
86  }
87  else if (_has_2phase)
88  {
89  execute2Phase();
90  execute1Phase(_fp_liquid, "LIQUID phase", false);
91  execute1Phase(_fp_vapor, "VAPOR phase", false);
92  }
93  else if (_has_vapor_mixture)
94  executeVaporMixture(true);
95  else
96  execute1Phase(_fp_1phase, "Single-phase", true);
97 }
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 105 of file FluidPropertiesInterrogator.C.

Referenced by execute().

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

Referenced by execute().

289 {
290  // reset NaN flag
291  _nan_encountered = false;
292 
293  // determine how state is specified
294  std::vector<std::vector<std::string>> parameter_sets = {{"p", "T"}, {"p"}, {"T"}};
295  auto specified = getSpecifiedSetMap(parameter_sets, "two-phase", true);
296 
297  // output the requested quantities
298 
299  outputHeader("TWO-PHASE properties");
300 
301  const Real p_critical = _fp_2phase->p_critical();
302  outputProperty("Critical pressure", p_critical, "Pa");
303  if (specified["p"])
304  {
305  const Real p = getParam<Real>("p");
306  const Real T_sat = _fp_2phase->T_sat(p);
307  const Real h_lat = _fp_2phase->h_lat(p, T_sat);
308  outputProperty("Saturation temperature", T_sat, "K");
309  outputProperty("Latent heat of vaporization", h_lat, "J/kg");
310  }
311  if (specified["T"])
312  {
313  const Real T = getParam<Real>("T");
314  const Real p_sat = _fp_2phase->p_sat(T);
315  const Real h_lat = _fp_2phase->h_lat(p_sat, T);
316  outputProperty("Saturation pressure", p_sat, "Pa");
317  outputProperty("Latent heat of vaporization", h_lat, "J/kg");
318  }
319  if (specified["p,T"])
320  {
321  const Real p = getParam<Real>("p");
322  const Real T = getParam<Real>("T");
323  const Real h_lat = _fp_2phase->h_lat(p, T);
324  outputProperty("Latent heat of vaporization", h_lat, "J/kg");
325  }
326  _console << std::endl;
327 
328  // warn if NaN encountered
329  if (_nan_encountered)
330  mooseWarning("At least one NaN was encountered.");
331 }
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.

◆ 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 206 of file FluidPropertiesInterrogator.C.

Referenced by execute().

207 {
208  // reset NaN flag
209  _nan_encountered = false;
210 
211  // determine how state is specified
212  std::vector<std::vector<std::string>> parameter_sets = {
213  {"p", "T", "x_ncg"}, {"rho", "e", "x_ncg"}, {"rho", "rhou", "rhoE", "x_ncg"}};
214  auto specified = getSpecifiedSetMap(parameter_sets, "vapor mixture", throw_error_if_no_match);
215 
216  const auto x_ncg = getParam<std::vector<Real>>("x_ncg");
217 
218  // compute/determine rho, e, p, T, vel
219 
220  Real rho, e, p, T, vel;
221  bool specified_a_set = false;
222  if (specified["rho,e,x_ncg"])
223  {
224  rho = getParam<Real>("rho");
225  e = getParam<Real>("e");
226  const Real v = 1.0 / rho;
227  p = _fp_vapor_mixture->p_from_v_e(v, e, x_ncg);
228  T = _fp_vapor_mixture->T_from_v_e(v, e, x_ncg);
229  if (isParamValid("vel"))
230  vel = getParam<Real>("vel");
231 
232  specified_a_set = true;
233  }
234  else if (specified["p,T,x_ncg"])
235  {
236  p = getParam<Real>("p");
237  T = getParam<Real>("T");
238  rho = _fp_vapor_mixture->rho_from_p_T(p, T, x_ncg);
239  e = _fp_vapor_mixture->e_from_p_T(p, T, x_ncg);
240  if (isParamValid("vel"))
241  vel = getParam<Real>("vel");
242 
243  specified_a_set = true;
244  }
245  else if (specified["rho,rhou,rhoE,x_ncg"])
246  {
247  rho = getParam<Real>("rho");
248  const Real rhou = getParam<Real>("rhou");
249  const Real rhoE = getParam<Real>("rhoE");
250 
251  vel = rhou / rho;
252  const Real E = rhoE / rho;
253  e = E - 0.5 * vel * vel;
254 
255  const Real v = 1.0 / rho;
256  p = _fp_vapor_mixture->p_from_v_e(v, e, x_ncg);
257  T = _fp_vapor_mixture->T_from_v_e(v, e, x_ncg);
258 
259  specified_a_set = true;
260  }
261 
262  if (specified_a_set)
263  {
264  // output static property values
265  outputHeader("Vapor mixture STATIC properties");
266  outputVaporMixtureStaticProperties(rho, e, p, T, x_ncg);
267 
268  // output stagnation property values
269  if (isParamValid("vel") || specified["rho,rhou,rhoE,x_ncg"])
270  {
271  outputHeader("Vapor mixture STAGNATION properties");
272  outputVaporMixtureStagnationProperties(rho, e, p, T, x_ncg, vel);
273  }
274 
275  // warn if NaN encountered
276  if (_nan_encountered)
277  mooseWarning(
278  "At least one NaN was encountered. This implies one of the following:\n",
279  " 1. The specified thermodynamic state is inconsistent with the equation of state\n",
280  " (for example, the state corresponds to a different phase of the fluid).\n",
281  " 2. There is a problem with the equation of state package at this state\n",
282  " (for example, the supplied state is outside of the valid state space\n",
283  " that was programmed in the package).");
284  }
285 }
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 100 of file FluidPropertiesInterrogator.C.

101 {
102 }

◆ 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 334 of file FluidPropertiesInterrogator.C.

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

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

◆ initialize()

void FluidPropertiesInterrogator::initialize ( )
overridevirtual

Definition at line 74 of file FluidPropertiesInterrogator.C.

75 {
76 }

◆ outputHeader()

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

Outputs a header for a section of properties.

Definition at line 415 of file FluidPropertiesInterrogator.C.

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

416 {
417  _console << std::endl
418  << std::endl
419  << header << ":" << std::endl
420  << std::setfill('-') << std::setw(80) << "-" << std::setfill(' ') << std::endl;
421 }

◆ outputLiquidSpecificProperties()

void FluidPropertiesInterrogator::outputLiquidSpecificProperties ( const LiquidFluidPropertiesInterface *const  liquid_fp,
const Real &  p,
const Real &  T 
)
protected

Outputs liquid-specific properties.

Parameters
[in]liquid_fpLiquid fluid properties
[in]pPressure
[in]TTemperature

Definition at line 489 of file FluidPropertiesInterrogator.C.

Referenced by execute1Phase().

491 {
492  const Real sigma = liquid_fp->sigma_from_p_T(p, T);
493  outputProperty("Surface tension", sigma, "N/m");
494  _console << std::endl;
495 }
void outputProperty(const std::string &name, const Real &value, const std::string &units)
Outputs a property value.
virtual Real sigma_from_p_T(Real p, Real T) const =0
Surface tension from pressure and temperature.

◆ outputProperty()

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

Outputs a property value.

Definition at line 424 of file FluidPropertiesInterrogator.C.

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

427 {
428  const bool use_scientific_notation = ((value < 0.001) || (value >= 10000.0));
429 
430  // check for NaN value
431  const bool is_nan = value != value;
432  if (is_nan)
433  _nan_encountered = true;
434 
435  const std::string units_printed = is_nan ? "" : units;
436 
437  // The console output is not used directly because there is no way to reset
438  // format flags. For example, if scientific format is used, there is no way
439  // to restore the general format (not fixed format); for cout, there are
440  // methods to save and restore format flags, but Console does not provide these.
441  std::stringstream ss;
442 
443  if (use_scientific_notation)
444  ss << std::setw(35) << std::left << name + ":" << std::setw(_precision + 10) << std::right
445  << std::setprecision(_precision) << std::scientific << value << " " << units_printed
446  << std::endl;
447  else
448  ss << std::setw(35) << std::left << name + ":" << std::setw(_precision + 10) << std::right
449  << std::setprecision(_precision) << value << " " << units_printed << std::endl;
450 
451  _console << ss.str();
452 }
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:22

◆ 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 498 of file FluidPropertiesInterrogator.C.

Referenced by execute1Phase().

504 {
505  const Real v = 1.0 / rho;
506  const Real s = fp->s_from_v_e(v, e);
507  const Real s0 = s;
508  const Real h = fp->h_from_p_T(p, T);
509  const Real h0 = h + 0.5 * vel * vel;
510  const Real p0 = fp->p_from_h_s(h0, s0);
511  const Real rho0 = fp->rho_from_p_s(p0, s0);
512  const Real e0 = fp->e_from_p_rho(p0, rho0);
513  const Real v0 = 1.0 / rho0;
514  const Real T0 = fp->T_from_v_e(v0, e0);
515  const Real c0 = fp->c_from_v_e(v0, e0);
516  const Real mu0 = fp->mu_from_v_e(v0, e0);
517  const Real cp0 = fp->cp_from_v_e(v0, e0);
518  const Real cv0 = fp->cv_from_v_e(v0, e0);
519  const Real k0 = fp->k_from_v_e(v0, e0);
520  const Real beta0 = fp->beta_from_p_T(p0, T0);
521 
522  outputProperty("Pressure", p0, "Pa");
523  outputProperty("Temperature", T0, "K");
524  outputProperty("Density", rho0, "kg/m^3");
525  outputProperty("Specific volume", v0, "m^3/kg");
526  outputProperty("Specific internal energy", e0, "J/kg");
527  outputProperty("Specific enthalpy", h0, "J/kg");
528  outputProperty("Specific entropy", s0, "J/kg");
529  _console << std::endl;
530  outputProperty("Sound speed", c0, "m/s");
531  outputProperty("Dynamic viscosity", mu0, "Pa-s");
532  outputProperty("Specific heat at constant pressure", cp0, "J/(kg-K)");
533  outputProperty("Specific heat at constant volume", cv0, "J/(kg-K)");
534  outputProperty("Thermal conductivity", k0, "W/(m-K)");
535  outputProperty("Volumetric expansion coefficient", beta0, "1/K");
536  _console << std::endl;
537 }
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 455 of file FluidPropertiesInterrogator.C.

Referenced by execute1Phase().

460 {
461  const Real v = 1.0 / rho;
462  const Real h = fp->h_from_p_T(p, T);
463  const Real s = fp->s_from_v_e(v, e);
464  const Real c = fp->c_from_v_e(v, e);
465  const Real mu = fp->mu_from_v_e(v, e);
466  const Real cp = fp->cp_from_v_e(v, e);
467  const Real cv = fp->cv_from_v_e(v, e);
468  const Real k = fp->k_from_v_e(v, e);
469  const Real beta = fp->beta_from_p_T(p, T);
470 
471  outputProperty("Pressure", p, "Pa");
472  outputProperty("Temperature", T, "K");
473  outputProperty("Density", rho, "kg/m^3");
474  outputProperty("Specific volume", v, "m^3/kg");
475  outputProperty("Specific internal energy", e, "J/kg");
476  outputProperty("Specific enthalpy", h, "J/kg");
477  outputProperty("Specific entropy", s, "J/kg");
478  _console << std::endl;
479  outputProperty("Sound speed", c, "m/s");
480  outputProperty("Dynamic viscosity", mu, "Pa-s");
481  outputProperty("Specific heat at constant pressure", cp, "J/(kg-K)");
482  outputProperty("Specific heat at constant volume", cv, "J/(kg-K)");
483  outputProperty("Thermal conductivity", k, "W/(m-K)");
484  outputProperty("Volumetric expansion coefficient", beta, "1/K");
485  _console << std::endl;
486 }
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 570 of file FluidPropertiesInterrogator.C.

Referenced by executeVaporMixture().

577 {
578  const Real h = e + p / rho;
579  const Real h0 = h + 0.5 * vel * vel;
580 
581  outputProperty("Specific enthalpy", h0, "J/kg");
582  _console << std::endl;
583 }
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 540 of file FluidPropertiesInterrogator.C.

Referenced by executeVaporMixture().

545 {
546  const Real v = 1.0 / rho;
547  const Real h = e + p / rho;
548  const Real c = _fp_vapor_mixture->c_from_p_T(p, T, x_ncg);
549  const Real mu = _fp_vapor_mixture->mu_from_p_T(p, T, x_ncg);
550  const Real cp = _fp_vapor_mixture->cp_from_p_T(p, T, x_ncg);
551  const Real cv = _fp_vapor_mixture->cv_from_p_T(p, T, x_ncg);
552  const Real k = _fp_vapor_mixture->k_from_p_T(p, T, x_ncg);
553 
554  outputProperty("Pressure", p, "Pa");
555  outputProperty("Temperature", T, "K");
556  outputProperty("Density", rho, "kg/m^3");
557  outputProperty("Specific volume", v, "m^3/kg");
558  outputProperty("Specific internal energy", e, "J/kg");
559  outputProperty("Specific enthalpy", h, "J/kg");
560  _console << std::endl;
561  outputProperty("Sound speed", c, "m/s");
562  outputProperty("Dynamic viscosity", mu, "Pa-s");
563  outputProperty("Specific heat at constant pressure", cp, "J/(kg-K)");
564  outputProperty("Specific heat at constant volume", cv, "J/(kg-K)");
565  outputProperty("Thermal conductivity", k, "W/(m-K)");
566  _console << std::endl;
567 }
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 166 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 168 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 170 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 172 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 184 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 186 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 188 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 175 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 179 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 181 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 177 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 191 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 194 of file FluidPropertiesInterrogator.h.

Referenced by outputProperty().


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