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