LCOV - code coverage report
Current view: top level - src/userobjects - PorousFlowFluidStateMultiComponentBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 23 24 95.8 %
Date: 2025-09-04 07:55:56 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 "PorousFlowFluidStateMultiComponentBase.h"
      11             : 
      12             : InputParameters
      13        1406 : PorousFlowFluidStateMultiComponentBase::validParams()
      14             : {
      15        1406 :   InputParameters params = PorousFlowFluidStateFlash::validParams();
      16        2812 :   params.addParam<unsigned int>(
      17        2812 :       "liquid_fluid_component", 0, "The fluid component number of the primary liquid component");
      18        2812 :   params.addParam<unsigned int>("salt_component", 2, "The component number of salt");
      19        1406 :   params.addClassDescription("Base class for multiple component fluid state classes");
      20        1406 :   return params;
      21           0 : }
      22             : 
      23         703 : PorousFlowFluidStateMultiComponentBase::PorousFlowFluidStateMultiComponentBase(
      24         703 :     const InputParameters & parameters)
      25             :   : PorousFlowFluidStateFlash(parameters),
      26         703 :     _aqueous_fluid_component(getParam<unsigned int>("liquid_fluid_component")),
      27        1406 :     _salt_component(getParam<unsigned int>("salt_component")),
      28         703 :     _pidx(0),
      29         703 :     _Zidx(1),
      30         703 :     _Tidx(2),
      31         703 :     _Xidx(3)
      32             : {
      33         703 : }
      34             : 
      35             : void
      36     1046704 : PorousFlowFluidStateMultiComponentBase::phaseState(Real Zi,
      37             :                                                    Real Xi,
      38             :                                                    Real Yi,
      39             :                                                    FluidStatePhaseEnum & phase_state) const
      40             : {
      41     1046704 :   if (Zi <= Xi)
      42             :   {
      43             :     // In this case, there is not enough component i to form a gas phase,
      44             :     // so only a liquid phase is present
      45      943537 :     phase_state = FluidStatePhaseEnum::LIQUID;
      46             :   }
      47      103167 :   else if (Zi > Xi && Zi < Yi)
      48             :   {
      49             :     // Two phases are present
      50       86790 :     phase_state = FluidStatePhaseEnum::TWOPHASE;
      51             :   }
      52             :   else // (Zi >= Yi)
      53             :   {
      54             :     // In this case, there is not enough water to form a liquid
      55             :     // phase, so only a gas phase is present
      56       16377 :     phase_state = FluidStatePhaseEnum::GAS;
      57             :   }
      58     1046704 : }

Generated by: LCOV version 1.14