LCOV - code coverage report
Current view: top level - src/auxkernels - NSLiquidFractionAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 21 23 91.3 %
Date: 2025-08-14 10:14: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 "NSLiquidFractionAux.h"
      11             : #include "MooseMesh.h"
      12             : #include "NS.h"
      13             : 
      14             : registerMooseObject("NavierStokesApp", NSLiquidFractionAux);
      15             : 
      16             : InputParameters
      17         121 : NSLiquidFractionAux::validParams()
      18             : {
      19         121 :   InputParameters params = AuxKernel::validParams();
      20         121 :   params.addClassDescription("Computes liquid fraction $f_l$ given the temperature.");
      21         121 :   params.addRequiredParam<MooseFunctorName>(NS::temperature, "The temperature.");
      22         242 :   params.addRequiredParam<MooseFunctorName>("T_solidus", "The solidus temperature.");
      23         242 :   params.addRequiredParam<MooseFunctorName>("T_liquidus", "The liquidus temperature.");
      24         121 :   return params;
      25           0 : }
      26             : 
      27          64 : NSLiquidFractionAux::NSLiquidFractionAux(const InputParameters & parameters)
      28             :   : AuxKernel(parameters),
      29         128 :     _T(getFunctor<Real>(NS::temperature)),
      30         128 :     _T_solidus(getFunctor<Real>("T_solidus")),
      31         192 :     _T_liquidus(getFunctor<Real>("T_liquidus"))
      32             : {
      33          64 : }
      34             : 
      35             : Real
      36       38395 : NSLiquidFractionAux::computeValue()
      37             : {
      38             :   using namespace MetaPhysicL;
      39             : 
      40       38395 :   const auto elem_arg = makeElemArg(_current_elem);
      41       38395 :   const auto state = determineState();
      42             : 
      43       38395 :   if (_T_liquidus(elem_arg, state) < _T_solidus(elem_arg, state))
      44           0 :     mooseError("The specified liquidus temperature is smaller than the solidus temperature.");
      45             : 
      46       38395 :   Real fl = (_T(elem_arg, state) - _T_solidus(elem_arg, state)) /
      47       38395 :             (_T_liquidus(elem_arg, state) - _T_solidus(elem_arg, state));
      48             : 
      49       38395 :   fl = (fl > 1.0) ? 1.0 : fl;
      50       12875 :   fl = (fl < 0.0) ? 0.0 : fl;
      51             : 
      52       38395 :   return fl;
      53             : }

Generated by: LCOV version 1.14