LCOV - code coverage report
Current view: top level - src/functions - RichardsExcavGeom.C (source / functions) Hit Total Coverage
Test: idaholab/moose richards: #31405 (292dce) with base fef103 Lines: 26 41 63.4 %
Date: 2025-09-04 07:56:35 Functions: 2 3 66.7 %
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 "RichardsExcavGeom.h"
      11             : 
      12             : registerMooseObject("RichardsApp", RichardsExcavGeom);
      13             : 
      14             : InputParameters
      15           1 : RichardsExcavGeom::validParams()
      16             : {
      17           1 :   InputParameters params = Function::validParams();
      18           2 :   params.addRequiredParam<RealVectorValue>(
      19             :       "start_posn",
      20             :       "Start point of the excavation.  This is an (x,y,z) point in the middle of the "
      21             :       "coal face at the very beginning of the panel.");
      22           2 :   params.addRequiredParam<Real>("start_time", "Commencement time of the excavation");
      23           2 :   params.addRequiredParam<RealVectorValue>("end_posn",
      24             :                                            "End position of the excavation.  This is "
      25             :                                            "an (x,y,z) point in the middle of the coal "
      26             :                                            "face at the very end of the panel.");
      27           2 :   params.addRequiredParam<Real>("end_time", "Time at the completion of the excavation");
      28           2 :   params.addRequiredParam<Real>("active_length",
      29             :                                 "This function is only active at a point if the "
      30             :                                 "distance between the point and the coal face <= "
      31             :                                 "active_length.");
      32           2 :   params.addParam<Real>("true_value",
      33           2 :                         1.0,
      34             :                         "Return this value if a point is in the active zone.  "
      35             :                         "This is usually used for controlling "
      36             :                         "permeability-changes");
      37           2 :   params.addParam<Real>(
      38           2 :       "deactivation_time", 1.0E30, "Time at which this function is totally turned off");
      39           1 :   params.addClassDescription("This function defines excavation geometry.  It can be used to "
      40             :                              "enforce pressures at the boundary of excavations, and to record "
      41             :                              "fluid fluxes into excavations.");
      42           1 :   return params;
      43           0 : }
      44             : 
      45           1 : RichardsExcavGeom::RichardsExcavGeom(const InputParameters & parameters)
      46             :   : Function(parameters),
      47           1 :     _start_posn(getParam<RealVectorValue>("start_posn")),
      48           2 :     _start_time(getParam<Real>("start_time")),
      49           2 :     _end_posn(getParam<RealVectorValue>("end_posn")),
      50           2 :     _end_time(getParam<Real>("end_time")),
      51           2 :     _active_length(getParam<Real>("active_length")),
      52           2 :     _true_value(getParam<Real>("true_value")),
      53           2 :     _deactivation_time(getParam<Real>("deactivation_time")),
      54           1 :     _retreat_vel(_end_posn - _start_posn)
      55             : {
      56           1 :   if (_start_time >= _end_time)
      57           1 :     mooseError("Start time for excavation set to ",
      58           1 :                _start_time,
      59             :                " but this must be less than the end time, which is ",
      60           1 :                _end_time);
      61           0 :   _retreat_vel /= (_end_time - _start_time); // this is now a velocity
      62           0 :   _norm_retreat_vel = _retreat_vel.norm();
      63           0 : }
      64             : 
      65             : Real
      66           0 : RichardsExcavGeom::value(Real t, const Point & p) const
      67             : {
      68           0 :   if (t < _start_time || (p - _start_posn) * _retreat_vel < 0)
      69             :     // point is behind start posn - it'll never be active
      70           0 :     return 0.0;
      71             : 
      72           0 :   if (t >= _deactivation_time)
      73             :     return 0.0;
      74             : 
      75             :   RealVectorValue current_posn;
      76           0 :   if (t >= _end_time)
      77           0 :     current_posn = _end_posn;
      78             :   else
      79           0 :     current_posn = _start_posn + (t - _start_time) * _retreat_vel;
      80             : 
      81           0 :   Real distance_into_goaf = (current_posn - p) * _retreat_vel / _norm_retreat_vel;
      82             : 
      83           0 :   if (distance_into_goaf < 0)
      84             :     // point is ahead of current_posn
      85             :     return 0.0;
      86             : 
      87           0 :   if (distance_into_goaf > _active_length)
      88             :     // point is too far into goaf
      89             :     return 0.0;
      90             : 
      91           0 :   return _true_value;
      92             : }

Generated by: LCOV version 1.14