www.mooseframework.org
GeometricCutUserObject.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 // MOOSE includes
11 #include "MooseError.h"
12 
13 template <>
14 InputParameters
16 {
17  // Get input parameters from parent class
18  InputParameters params = validParams<CrackFrontPointsProvider>();
19 
20  // Add optional parameters
21  params.addParam<Real>("time_start_cut", 0.0, "Start time of geometric cut propagation");
22  params.addParam<Real>("time_end_cut", 0.0, "End time of geometric cut propagation");
23  // Class description
24  params.addClassDescription("Base UserObject class for XFEM Geometric Cuts");
25  // Return the parameters
26  return params;
27 }
28 
29 GeometricCutUserObject::GeometricCutUserObject(const InputParameters & parameters)
30  //: GeneralUserObject(parameters), _start_times(), _end_times()
31  : CrackFrontPointsProvider(parameters),
32  _cut_time_ranges()
33 {
34  _cut_time_ranges.push_back(
35  std::make_pair(getParam<Real>("time_start_cut"), getParam<Real>("time_end_cut")));
36 }
37 
38 Real
39 GeometricCutUserObject::cutFraction(unsigned int cut_num, Real time) const
40 {
41  Real fraction = 0.0;
42 
43  if (time >= _cut_time_ranges[cut_num].first)
44  {
45  if (time >= _cut_time_ranges[cut_num].second)
46  fraction = 1.0;
47  else
48  fraction = (time - _cut_time_ranges[cut_num].first) /
49  (_cut_time_ranges[cut_num].second - _cut_time_ranges[cut_num].first);
50  }
51  return fraction;
52 }
Real cutFraction(unsigned int cut_num, Real time) const
std::vector< std::pair< Real, Real > > _cut_time_ranges
GeometricCutUserObject(const InputParameters &parameters)
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
Base class for crack front points provider.
InputParameters validParams< GeometricCutUserObject >()
InputParameters validParams< CrackFrontPointsProvider >()