LCOV - code coverage report
Current view: top level - src/bcs - LoadingUnloadingDirichletBC.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 9 46 19.6 %
Date: 2025-02-21 01:06:12 Functions: 1 4 25.0 %

          Line data    Source code
       1             : //* This file is part of the RACCOON application
       2             : //* being developed at Dolbow lab at Duke University
       3             : //* http://dolbow.pratt.duke.edu
       4             : 
       5             : #include "LoadingUnloadingDirichletBC.h"
       6             : #include "FEProblemBase.h"
       7             : 
       8             : registerMooseObject("raccoonApp", LoadingUnloadingDirichletBC);
       9             : 
      10             : InputParameters
      11         138 : LoadingUnloadingDirichletBC::validParams()
      12             : {
      13         138 :   InputParameters params = DirichletBCBase::validParams();
      14         138 :   params.addClassDescription(
      15             :       "This class applies a loading/unloading BC. The load ramps up linearly until it reaches the "
      16             :       "load cap. Once the load cap is reached, the load cap is incremented and unlading begins. "
      17             :       "Once the unloaded indicator becomes negative, loading starts. If the load cap exceeds the "
      18             :       "ultimate load, the entire loading/unloading terminates, and the current simulation is "
      19             :       "terminated.");
      20         276 :   params.addRequiredParam<Real>(
      21             :       "initial_load_cap",
      22             :       "Initial cap of the loading. The load is decreased once it reaches the cap, the cap is "
      23             :       "then increased according to the load cap increment.");
      24         276 :   params.addRequiredParam<Real>("load_cap_increment",
      25             :                                 "The amount to increase the load cap everytime it is reached.");
      26         276 :   params.addRequiredParam<Real>("load_step", "The amount to increase the load every step.");
      27         276 :   params.addRequiredParam<Real>("ultimate_load",
      28             :                                 "The load, upon reached, to terminate the simulation.");
      29         276 :   params.addRequiredParam<PostprocessorName>(
      30             :       "unloaded_indicator",
      31             :       "A postprocessor whose value serves as an indicator for unloaded status. Once its value is "
      32             :       "below zero, the system is completely unloaded, and loading starts again.");
      33         138 :   return params;
      34           0 : }
      35             : 
      36           0 : LoadingUnloadingDirichletBC::LoadingUnloadingDirichletBC(const InputParameters & parameters)
      37             :   : DirichletBCBase(parameters),
      38           0 :     _load(0.0),
      39           0 :     _load_cap(getParam<Real>("initial_load_cap")),
      40           0 :     _load_cap_inc(getParam<Real>("load_cap_increment")),
      41           0 :     _load_step(getParam<Real>("load_step")),
      42           0 :     _ultimate_load(getParam<Real>("ultimate_load")),
      43           0 :     _unloaded_indicator(getPostprocessorValue("unloaded_indicator")),
      44           0 :     _loading(true)
      45             : {
      46           0 : }
      47             : 
      48             : void
      49           0 : LoadingUnloadingDirichletBC::timestepSetup()
      50             : {
      51           0 :   _console << COLOR_BLUE << "Unloading indicator = " << COLOR_DEFAULT << std::scientific
      52           0 :            << _unloaded_indicator << std::endl;
      53           0 :   if (_unloaded_indicator < 0.0)
      54             :   {
      55           0 :     _loading = true;
      56           0 :     _console << COLOR_BLUE << "Completely unloaded, start loading next." << COLOR_DEFAULT
      57           0 :              << std::endl;
      58             :   }
      59             : 
      60           0 :   if (_loading)
      61             :   {
      62           0 :     _load += _load_step;
      63           0 :     if (_load > _load_cap)
      64             :     {
      65           0 :       _load_cap += _load_cap_inc;
      66           0 :       _load -= 2.0 * _load_step;
      67           0 :       _loading = false;
      68           0 :       _console << COLOR_BLUE << "Load cap exceeded, start unloading next." << COLOR_DEFAULT
      69           0 :                << std::endl;
      70           0 :       _console << COLOR_BLUE << "Load cap increased to " << COLOR_DEFAULT << std::scientific
      71           0 :                << _load_cap << COLOR_DEFAULT << std::endl;
      72             :     }
      73             :   }
      74             :   else
      75             :   {
      76           0 :     _load -= _load_step;
      77             :   }
      78             : 
      79           0 :   _console << COLOR_BLUE << "Current load = " << COLOR_DEFAULT << std::scientific << _load
      80           0 :            << std::endl
      81           0 :            << std::flush;
      82             : 
      83           0 :   if (_load > _ultimate_load)
      84           0 :     _fe_problem.terminateSolve();
      85             : 
      86           0 :   fflush(stdout);
      87           0 : }
      88             : 
      89             : Real
      90           0 : LoadingUnloadingDirichletBC::computeQpValue()
      91             : {
      92           0 :   return _load;
      93             : }

Generated by: LCOV version 1.16