LCOV - code coverage report
Current view: top level - src/fluidproperties - TwoPhaseNCGPartialPressureFluidProperties.C (source / functions) Hit Total Coverage
Test: idaholab/moose fluid_properties: #31405 (292dce) with base fef103 Lines: 26 27 96.3 %
Date: 2025-09-04 07:53:14 Functions: 3 3 100.0 %
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 "TwoPhaseNCGPartialPressureFluidProperties.h"
      11             : #include "IdealGasMixtureFluidProperties.h"
      12             : #include "SinglePhaseFluidProperties.h"
      13             : 
      14             : registerMooseObject("FluidPropertiesApp", TwoPhaseNCGPartialPressureFluidProperties);
      15             : 
      16             : InputParameters
      17          62 : TwoPhaseNCGPartialPressureFluidProperties::validParams()
      18             : {
      19          62 :   InputParameters params = TwoPhaseNCGFluidProperties::validParams();
      20             : 
      21          62 :   params.addClassDescription(
      22             :       "Two-phase fluid with single NCG using partial pressure mixture model");
      23             : 
      24         124 :   params.addRequiredParam<UserObjectName>("fp_ncg", "NCG fluid properties object");
      25             : 
      26          62 :   return params;
      27           0 : }
      28             : 
      29          33 : TwoPhaseNCGPartialPressureFluidProperties::TwoPhaseNCGPartialPressureFluidProperties(
      30          33 :     const InputParameters & parameters)
      31             :   : TwoPhaseNCGFluidProperties(parameters),
      32             : 
      33          33 :     _fp_ncg(getUserObject<SinglePhaseFluidProperties>("fp_ncg"))
      34             : {
      35          33 :   _fp_2phase = &_fe_problem.getUserObject<TwoPhaseFluidProperties>(_2phase_name);
      36          33 :   _fp_vapor_primary = &_fe_problem.getUserObject<SinglePhaseFluidProperties>(getVaporName());
      37             : 
      38             :   // create vapor mixture fluid properties
      39          33 :   if (_tid == 0)
      40             :   {
      41          27 :     const std::string class_name = "IdealGasMixtureFluidProperties";
      42          27 :     InputParameters params = _app.getFactory().getValidParams(class_name);
      43          54 :     params.set<std::vector<UserObjectName>>("component_fluid_properties") = {
      44         135 :         getVaporName(), getParam<UserObjectName>("fp_ncg")};
      45          27 :     _fe_problem.addUserObject(class_name, _vapor_mixture_name, params);
      46          27 :   }
      47          33 :   _fp_vapor_mixture = &_fe_problem.getUserObject<VaporMixtureFluidProperties>(_vapor_mixture_name);
      48             : 
      49          33 :   _molar_masses = {_fp_vapor_primary->molarMass(), _fp_ncg.molarMass()};
      50          87 : }
      51             : 
      52             : Real
      53          22 : TwoPhaseNCGPartialPressureFluidProperties::x_sat_ncg_from_p_T(Real p, Real T) const
      54             : {
      55          22 :   const auto molar_fraction_ncg = (p - _fp_2phase->p_sat(T)) / p;
      56          22 :   const std::vector<Real> molar_fractions = {1.0 - molar_fraction_ncg, molar_fraction_ncg};
      57             :   const auto mass_fractions =
      58          22 :       _fp_vapor_mixture->massFractionsFromMolarFractions(molar_fractions, _molar_masses);
      59          22 :   return mass_fractions[1];
      60          22 : }

Generated by: LCOV version 1.14