www.mooseframework.org
C1ICBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "C1ICBase.h"
11 
12 // Portions of this code Copyright 2007-2009 Roy Stogner
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 //"Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 
30 template <>
31 InputParameters
33 {
34  InputParameters params = validParams<InitialCondition>();
35 
36  params.addParam<Real>("average", 0, "The average value");
37  params.addParam<Real>("amplitude", 1., "The amplitude");
38  params.addParam<Real>("length", 0.75, "The length");
39  params.addParam<Real>("width", .125, "The width");
40  params.addParam<Real>("buffer", 0.03125, "A small area between the max value and the interface");
41  params.addParam<Real>("interface", 0.03125, "The interface width");
42 
43  return params;
44 }
45 
46 C1ICBase::C1ICBase(const InputParameters & parameters)
47  : InitialCondition(parameters),
48  _average(parameters.get<Real>("average")),
49  _amplitude(parameters.get<Real>("amplitude")),
50  _length(parameters.get<Real>("length")),
51  _width(parameters.get<Real>("width")),
52  _buffer(parameters.get<Real>("buffer")),
53  _interface(parameters.get<Real>("interface"))
54 {
55 }
56 
57 Number
59 {
60  Real x = (r - _buffer) / _interface;
61 
62  if (x < 0.0)
63  return (_average + _amplitude);
64  if (x > 1.0)
65  return (_average - _amplitude);
66 
67  return ((1.0 + 4.0 * x * x * x - 6.0 * x * x) * _amplitude + _average);
68 }
69 
70 Number
72 {
73  Real x = (r - _buffer) / _interface;
74 
75  if (x < 0.0)
76  return 0.0;
77  if (x > 1.0)
78  return 0.0;
79 
80  return ((12.0 * x * x - 12.0 * x) * _amplitude);
81 }
C1ICBase::_interface
Real _interface
Definition: C1ICBase.h:56
C1ICBase::_average
Real _average
Definition: C1ICBase.h:51
C1ICBase::C1ICBase
C1ICBase(const InputParameters &parameters)
Definition: C1ICBase.C:46
C1ICBase.h
C1ICBase::_amplitude
Real _amplitude
Definition: C1ICBase.h:52
C1ICBase::interfaceValue
Number interfaceValue(Real r)
Definition: C1ICBase.C:58
C1ICBase::_buffer
Real _buffer
Definition: C1ICBase.h:55
validParams< C1ICBase >
InputParameters validParams< C1ICBase >()
Definition: C1ICBase.C:32
C1ICBase::interfaceDerivative
Number interfaceDerivative(Real r)
Definition: C1ICBase.C:71