https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VaporMixtureFluidProperties.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
19
24
26
27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Woverloaded-virtual"
29
30Real
32 Real,
33 unsigned int,
34 unsigned int) const
35{
36 mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
37}
38
41 const ADReal &,
42 unsigned int,
43 unsigned int) const
44{
45 mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented.");
46}
47
48Real
50{
51 return 1 - std::accumulate(x.begin(), x.end(), 0.0);
52}
53
54Real
55VaporMixtureFluidProperties::mixtureMolarMass(const std::vector<Real> & molar_fractions,
56 const std::vector<Real> & molar_masses) const
57{
58 mooseAssert(molar_fractions.size() == molar_masses.size(), "Must have same size");
59
60 Real molar_mass_mix = 0;
61 for (const auto i : index_range(molar_fractions))
62 molar_mass_mix += molar_fractions[i] * molar_masses[i];
63 return molar_mass_mix;
64}
65
66std::vector<Real>
68 const std::vector<Real> & molar_fractions, const std::vector<Real> & molar_masses) const
69{
70 mooseAssert(molar_fractions.size() == molar_masses.size(), "Must have same size");
71
72 const auto molar_mass_mix = mixtureMolarMass(molar_fractions, molar_masses);
73
74 std::vector<Real> mass_fractions(molar_fractions.size(), 0.0);
75 for (const auto i : index_range(molar_fractions))
76 mass_fractions[i] = molar_masses[i] / molar_mass_mix * molar_fractions[i];
77 return mass_fractions;
78}
79
80#pragma GCC diagnostic pop
DualNumber< Real, DNDerivativeType, true > ADReal
const std::vector< double > x
static InputParameters validParams()
const std::string & name() const
void mooseError(Args &&... args) const
Real primaryMassFraction(const std::vector< Real > &x) const
Computes the mass fraction of the primary vapor given mass fractions of the secondary vapors.
VaporMixtureFluidProperties(const InputParameters &parameters)
std::vector< Real > massFractionsFromMolarFractions(const std::vector< Real > &molar_fractions, const std::vector< Real > &molar_masses) const
Computes the mass fractions for given molar fractions and molar masses.
virtual Real binaryDiffusionCoefficient(Real p, Real T, unsigned int i, unsigned int j) const
Computes the binary diffusion coefficient of a pair of components [m^2/s].
Real mixtureMolarMass(const std::vector< Real > &molar_fractions, const std::vector< Real > &molar_masses) const
Computes the mixture molar mass for given molar fractions and molar masses.