LCOV - code coverage report
Current view: top level - src/bcs - SpecifiedVaporPressureBC.C (source / functions) Hit Total Coverage
Test: idaholab/blackbear: 75f23c Lines: 28 30 93.3 %
Date: 2025-07-17 04:05:57 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************/
       2             : /*               DO NOT MODIFY THIS HEADER                      */
       3             : /*                       BlackBear                              */
       4             : /*                                                              */
       5             : /*           (c) 2017 Battelle Energy Alliance, LLC             */
       6             : /*                   ALL RIGHTS RESERVED                        */
       7             : /*                                                              */
       8             : /*          Prepared by Battelle Energy Alliance, LLC           */
       9             : /*            Under Contract No. DE-AC07-05ID14517              */
      10             : /*            With the U. S. Department of Energy               */
      11             : /*                                                              */
      12             : /*            See COPYRIGHT for full restrictions               */
      13             : /****************************************************************/
      14             : 
      15             : #include "SpecifiedVaporPressureBC.h"
      16             : 
      17             : registerMooseObject("BlackBearApp", SpecifiedVaporPressureBC);
      18             : 
      19             : InputParameters
      20         208 : SpecifiedVaporPressureBC::validParams()
      21             : {
      22         208 :   InputParameters params = NodalBC::validParams();
      23         208 :   params.set<Real>("duration") = 0.0;
      24         416 :   params.addRequiredParam<Real>("vapor_pressure", "in Pa");
      25         416 :   params.addParam<Real>("T_ref", 20.0, "Initial temperature in C");
      26         416 :   params.addParam<Real>("rh_ref", 0.96, "initial relative humidity");
      27         416 :   params.addCoupledVar("temperature", "nonlinear variable name holding temperature field");
      28         208 :   params.addClassDescription(
      29             :       "Prescribed vapor pressure boundary condition for moisture transport in concrete.");
      30         208 :   return params;
      31           0 : }
      32             : 
      33         104 : SpecifiedVaporPressureBC::SpecifiedVaporPressureBC(const InputParameters & parameters)
      34             :   : NodalBC(parameters),
      35         104 :     _duration(getParam<Real>("duration")),
      36         208 :     _vapor_pressure(getParam<Real>("vapor_pressure")),
      37         208 :     _T_ref(getParam<Real>("T_ref")),
      38         208 :     _rh_ref(getParam<Real>("rh_ref")),
      39             : 
      40         104 :     _has_temperature(isCoupled("temperature")),
      41         208 :     _temp(_has_temperature ? coupledValue("temperature") : _zero)
      42             : {
      43         104 : }
      44             : 
      45             : Real
      46       45738 : SpecifiedVaporPressureBC::computeQpResidual()
      47             : {
      48       45738 :   Real T_ref_K = _T_ref + 273.15;
      49             : 
      50       45738 :   Real p_sat0 = 101325.0 * std::exp(4871.3 * (T_ref_K - 100.0) / 373.15 / T_ref_K);
      51       45738 :   _initial = _rh_ref * p_sat0;
      52       45738 :   _final = _vapor_pressure;
      53             : 
      54             :   // avoid sudden boundary jump conditions
      55             :   Real value;
      56       45738 :   if (_t < _duration)
      57           0 :     value = _initial + (_final - _initial) / _duration * _t;
      58             :   else
      59             :     value = _final;
      60             : 
      61             :   Real T = T_ref_K;
      62       45738 :   if (_has_temperature)
      63       45738 :     T = _temp[_qp] + 273.15;
      64             : 
      65       45738 :   Real p_sat = 101325.0 * std::exp(4871.3 * (T - 100.0) / 373.15 / T);
      66       45738 :   Real rh = value / p_sat;
      67             : 
      68       45738 :   return _u[_qp] - rh;
      69             : }

Generated by: LCOV version 1.14