LCOV - code coverage report
Current view: top level - src/fluidproperties - VaporMixtureFluidProperties.C (source / functions) Hit Total Coverage
Test: idaholab/moose fluid_properties: #31405 (292dce) with base fef103 Lines: 19 19 100.0 %
Date: 2025-09-04 07:53:14 Functions: 6 7 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "VaporMixtureFluidProperties.h"
      11             : 
      12             : InputParameters
      13         183 : VaporMixtureFluidProperties::validParams()
      14             : {
      15         183 :   InputParameters params = FluidProperties::validParams();
      16             : 
      17         183 :   return params;
      18             : }
      19             : 
      20         103 : VaporMixtureFluidProperties::VaporMixtureFluidProperties(const InputParameters & parameters)
      21         103 :   : FluidProperties(parameters)
      22             : {
      23         103 : }
      24             : 
      25         101 : VaporMixtureFluidProperties::~VaporMixtureFluidProperties() {}
      26             : 
      27             : #pragma GCC diagnostic push
      28             : #pragma GCC diagnostic ignored "-Woverloaded-virtual"
      29             : 
      30             : Real
      31        6158 : VaporMixtureFluidProperties::primaryMassFraction(const std::vector<Real> & x) const
      32             : {
      33        6158 :   return 1 - std::accumulate(x.begin(), x.end(), 0.0);
      34             : }
      35             : 
      36             : Real
      37          22 : VaporMixtureFluidProperties::mixtureMolarMass(const std::vector<Real> & molar_fractions,
      38             :                                               const std::vector<Real> & molar_masses) const
      39             : {
      40             :   mooseAssert(molar_fractions.size() == molar_masses.size(), "Must have same size");
      41             : 
      42             :   Real molar_mass_mix = 0;
      43          66 :   for (const auto i : index_range(molar_fractions))
      44          44 :     molar_mass_mix += molar_fractions[i] * molar_masses[i];
      45          22 :   return molar_mass_mix;
      46             : }
      47             : 
      48             : std::vector<Real>
      49          22 : VaporMixtureFluidProperties::massFractionsFromMolarFractions(
      50             :     const std::vector<Real> & molar_fractions, const std::vector<Real> & molar_masses) const
      51             : {
      52             :   mooseAssert(molar_fractions.size() == molar_masses.size(), "Must have same size");
      53             : 
      54          22 :   const auto molar_mass_mix = mixtureMolarMass(molar_fractions, molar_masses);
      55             : 
      56          22 :   std::vector<Real> mass_fractions(molar_fractions.size(), 0.0);
      57          66 :   for (const auto i : index_range(molar_fractions))
      58          44 :     mass_fractions[i] = molar_masses[i] / molar_mass_mix * molar_fractions[i];
      59          22 :   return mass_fractions;
      60             : }
      61             : 
      62             : #pragma GCC diagnostic pop

Generated by: LCOV version 1.14