LCOV - code coverage report
Current view: top level - src/functions - HydrostaticPressureFunction.C (source / functions) Hit Total Coverage
Test: idaholab/moose fluid_properties: #32971 (54bef8) with base c6cf66 Lines: 21 22 95.5 %
Date: 2026-05-29 20:36:28 Functions: 4 4 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 "HydrostaticPressureFunction.h"
      11             : #include "SinglePhaseFluidProperties.h"
      12             : 
      13             : registerMooseObject("FluidPropertiesApp", HydrostaticPressureFunction);
      14             : 
      15             : InputParameters
      16          19 : HydrostaticPressureFunction::validParams()
      17             : {
      18          19 :   InputParameters params = Function::validParams();
      19          19 :   params += GravityVectorInterface::validParams();
      20             : 
      21          19 :   params.addClassDescription("Computes hydrostatic pressure from a reference point.");
      22             : 
      23          38 :   params.addRequiredParam<Real>("reference_pressure", "Pressure at the reference point [Pa]");
      24          38 :   params.addRequiredParam<Real>("reference_temperature",
      25             :                                 "Reference temperature for density evaluation [K]");
      26          38 :   params.addRequiredParam<Point>("reference_point",
      27             :                                  "Reference point where pressure is specified [m]");
      28             : 
      29          38 :   params.addRequiredParam<UserObjectName>("fluid_properties",
      30             :                                           "Name of the SinglePhaseFluidProperties user object");
      31             : 
      32          19 :   return params;
      33           0 : }
      34             : 
      35          10 : HydrostaticPressureFunction::HydrostaticPressureFunction(const InputParameters & parameters)
      36             :   : Function(parameters),
      37             :     GravityVectorInterface(this),
      38          10 :     _p_ref(getParam<Real>("reference_pressure")),
      39          20 :     _T_ref(getParam<Real>("reference_temperature")),
      40          30 :     _r_ref(getParam<Point>("reference_point"))
      41             : {
      42          10 : }
      43             : 
      44             : void
      45          10 : HydrostaticPressureFunction::initialSetup()
      46             : {
      47          10 :   Function::initialSetup();
      48             : 
      49          10 :   const auto & fp = getUserObject<SinglePhaseFluidProperties>("fluid_properties");
      50          10 :   _rho = fp.rho_from_p_T(_p_ref, _T_ref);
      51          10 : }
      52             : 
      53             : Real
      54          18 : HydrostaticPressureFunction::value(Real /*t*/, const Point & r) const
      55             : {
      56          18 :   return _p_ref - _rho * gravityVector() * (_r_ref - r);
      57             : }

Generated by: LCOV version 1.14