www.mooseframework.org
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CrossIC Class Reference

CrossIC creates a C1 continuous initial condition that looks like a cross in the middle of the domain. More...

#include <CrossIC.h>

Inheritance diagram for CrossIC:
[legend]

Public Member Functions

 CrossIC (const InputParameters &parameters)
 
virtual Real value (const Point &p)
 
virtual RealGradient gradient (const Point &p)
 

Public Attributes

const Real _x1
 
const Real _y1
 
const Real _x2
 
const Real _y2
 

Protected Member Functions

Number interfaceValue (Real r)
 
Number interfaceDerivative (Real r)
 

Protected Attributes

Real _average
 
Real _amplitude
 
Real _length
 
Real _width
 
Real _buffer
 
Real _interface
 

Detailed Description

CrossIC creates a C1 continuous initial condition that looks like a cross in the middle of the domain.

Definition at line 41 of file CrossIC.h.

Constructor & Destructor Documentation

CrossIC::CrossIC ( const InputParameters &  parameters)

Definition at line 40 of file CrossIC.C.

41  : C1ICBase(parameters),
42  _x1(parameters.get<Real>("x1")),
43  _y1(parameters.get<Real>("y1")),
44  _x2(parameters.get<Real>("x2")),
45  _y2(parameters.get<Real>("y2"))
46 {
47 }
const Real _x2
Definition: CrossIC.h:51
const Real _y1
Definition: CrossIC.h:50
const Real _x1
Definition: CrossIC.h:49
const Real _y2
Definition: CrossIC.h:52
C1ICBase(const InputParameters &parameters)
Definition: C1ICBase.C:43

Member Function Documentation

RealGradient CrossIC::gradient ( const Point &  p)
virtual

Definition at line 264 of file CrossIC.C.

265 {
266  Point pxminus = p, pxplus = p, pyminus = p, pyplus = p;
267 
268  pxminus(0) -= TOLERANCE;
269  pyminus(1) -= TOLERANCE;
270  pxplus(0) += TOLERANCE;
271  pyplus(1) += TOLERANCE;
272 
273  Number uxminus = value(pxminus), uxplus = value(pxplus), uyminus = value(pyminus),
274  uyplus = value(pyplus);
275 
276  return Gradient((uxplus - uxminus) / 2.0 / TOLERANCE, (uyplus - uyminus) / 2.0 / TOLERANCE);
277 }
virtual Real value(const Point &p)
Definition: CrossIC.C:50
Number C1ICBase::interfaceDerivative ( Real  r)
protectedinherited

Definition at line 68 of file C1ICBase.C.

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
Real _amplitude
Definition: C1ICBase.h:50
Real _buffer
Definition: C1ICBase.h:53
Number C1ICBase::interfaceValue ( Real  r)
protectedinherited

Definition at line 55 of file C1ICBase.C.

Referenced by value().

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 }
Real _interface
Definition: C1ICBase.h:54
Real _average
Definition: C1ICBase.h:49
Real _amplitude
Definition: C1ICBase.h:50
Real _buffer
Definition: C1ICBase.h:53
Real CrossIC::value ( const Point &  p)
virtual

Definition at line 50 of file CrossIC.C.

Referenced by gradient().

51 {
52  const Real x = (p(0) - _x1) / (_x2 - _x1);
53  const Real y = (p(1) - _y1) / (_y2 - _y1);
54 
55  const Real cmax = _average + _amplitude;
56  const Real cmin = _average - _amplitude;
57 
58  if (x > (0.5 + _length / 2.0 + _buffer + _interface))
59  {
60  return cmin;
61  }
62  else if (x > 0.5 + _length / 2.0)
63  {
64  if (y > 0.5 + _width / 2.0 + _buffer + _interface)
65  {
66  return cmin;
67  }
68  else if (y > 0.5 + _width / 2.0)
69  {
70  Real xd = x - .5 - _length / 2.0;
71  Real yd = y - .5 - _width / 2.0;
72  Real r = std::sqrt(xd * xd + yd * yd);
73  return interfaceValue(r);
74  }
75  else if (y > 0.5 - _width / 2.0)
76  {
77  return interfaceValue(x - .5 - _length / 2.0);
78  }
79  else if (y > 0.5 - _width / 2. - _buffer - _interface)
80  {
81  Real xd = x - .5 - _length / 2.0;
82  Real yd = y - .5 + _width / 2.0;
83  Real r = std::sqrt(xd * xd + yd * yd);
84  return interfaceValue(r);
85  }
86  else
87  {
88  return cmin;
89  }
90  }
91  else if (x > 0.5 + _width / 2. + 2. * _buffer + _interface)
92  {
93  if (y > 0.5 + _width / 2 + _buffer + _interface)
94  return cmin;
95  else if (y > 0.5 + _width / 2.0)
96  return interfaceValue(y - .5 - _width / 2.0);
97  else if (y > 0.5 - _width / 2.0)
98  return cmax;
99  else if (y > 0.5 - _width / 2. - _buffer - _interface)
100  return interfaceValue(.5 - _width / 2. - y);
101  else
102  return cmin;
103  }
104  else if (x > 0.5 + _width / 2.0)
105  {
106  if (y > 0.5 + _length / 2. + _buffer + _interface)
107  {
108  return cmin;
109  }
110  else if (y > 0.5 + _length / 2.0)
111  {
112  Real xd = x - (.5 + _width / 2.0);
113  Real yd = y - (.5 + _length / 2.0);
114  Real r = std::sqrt(xd * xd + yd * yd);
115  return interfaceValue(r);
116  }
117  else if (y > 0.5 + _width / 2. + 2. * _buffer + _interface)
118  {
119  return interfaceValue(x - .5 - _width / 2.0);
120  }
121  else if (y > 0.5 + _width / 2.0)
122  {
123  Real xd = x - (.5 + _width / 2. + 2. * _buffer + _interface);
124  Real yd = y - (.5 + _width / 2. + 2. * _buffer + _interface);
125  Real r = std::sqrt(xd * xd + yd * yd);
126  return interfaceValue(2. * _buffer + _interface - r);
127  }
128  else if (y > 0.5 - _width / 2.0)
129  {
130  return cmax;
131  }
132  else if (y > 0.5 - _width / 2. - 2. * _buffer - _interface)
133  {
134  Real xd = x - (.5 + _width / 2. + 2. * _buffer + _interface);
135  Real yd = y - (.5 - _width / 2. - 2. * _buffer - _interface);
136  Real r = std::sqrt(xd * xd + yd * yd);
137  return interfaceValue(2. * _buffer + _interface - r);
138  }
139  else if (y > 0.5 - _length / 2.0)
140  {
141  return interfaceValue(x - .5 - _width / 2.0);
142  }
143  else if (y > 0.5 - _length / 2. - _buffer - _interface)
144  {
145  Real xd = x - (.5 + _width / 2.0);
146  Real yd = y - (.5 - _length / 2.0);
147  Real r = std::sqrt(xd * xd + yd * yd);
148  return interfaceValue(r);
149  }
150  else
151  {
152  return cmin;
153  }
154  }
155  else if (x > 0.5 - _width / 2.0)
156  {
157  if (y > 0.5 + _length / 2 + _buffer + _interface)
158  return cmin;
159  else if (y > 0.5 + _length / 2.0)
160  return interfaceValue(y - .5 - _length / 2.0);
161  else if (y > 0.5 - _length / 2.0)
162  return cmax;
163  else if (y > 0.5 - _length / 2. - _buffer - _interface)
164  return interfaceValue(.5 - _length / 2. - y);
165  else
166  return cmin;
167  }
168  else if (x > 0.5 - _width / 2. - 2. * _buffer - _interface)
169  {
170  if (y > 0.5 + _length / 2. + _buffer + _interface)
171  {
172  return cmin;
173  }
174  else if (y > 0.5 + _length / 2.0)
175  {
176  Real xd = x - (.5 - _width / 2.0);
177  Real yd = y - (.5 + _length / 2.0);
178  Real r = std::sqrt(xd * xd + yd * yd);
179  return interfaceValue(r);
180  }
181  else if (y > 0.5 + _width / 2. + 2. * _buffer + _interface)
182  {
183  return interfaceValue(.5 - _width / 2. - x);
184  }
185  else if (y > 0.5 + _width / 2.0)
186  {
187  Real xd = x - (.5 - _width / 2. - 2. * _buffer - _interface);
188  Real yd = y - (.5 + _width / 2. + 2. * _buffer + _interface);
189  Real r = std::sqrt(xd * xd + yd * yd);
190  return interfaceValue(2. * _buffer + _interface - r);
191  }
192  else if (y > 0.5 - _width / 2.0)
193  {
194  return cmax;
195  }
196  else if (y > 0.5 - _width / 2. - 2. * _buffer - _interface)
197  {
198  Real xd = x - (.5 - _width / 2. - 2. * _buffer - _interface);
199  Real yd = y - (.5 - _width / 2. - 2. * _buffer - _interface);
200  Real r = std::sqrt(xd * xd + yd * yd);
201  return interfaceValue(2. * _buffer + _interface - r);
202  }
203  else if (y > 0.5 - _length / 2.0)
204  {
205  return interfaceValue(.5 - _width / 2. - x);
206  }
207  else if (y > 0.5 - _length / 2. - _buffer - _interface)
208  {
209  Real xd = x - (.5 - _width / 2.0);
210  Real yd = y - (.5 - _length / 2.0);
211  Real r = std::sqrt(xd * xd + yd * yd);
212  return interfaceValue(r);
213  }
214  else
215  {
216  return cmin;
217  }
218  }
219  else if (x > 0.5 - _length / 2.0)
220  {
221  if (y > 0.5 + _width / 2 + _buffer + _interface)
222  return cmin;
223  else if (y > 0.5 + _width / 2.0)
224  return interfaceValue(y - .5 - _width / 2.0);
225  else if (y > 0.5 - _width / 2.0)
226  return cmax;
227  else if (y > 0.5 - _width / 2. - _buffer - _interface)
228  return interfaceValue(.5 - _width / 2. - y);
229  else
230  return cmin;
231  }
232  else if (x > (.5 - _length / 2. - _buffer - _interface))
233  {
234  if (y > 0.5 + _width / 2. + _buffer + _interface)
235  {
236  return cmin;
237  }
238  else if (y > 0.5 + _width / 2.0)
239  {
240  Real xd = x - (.5 - _length / 2.0);
241  Real yd = y - .5 - _width / 2.0;
242  Real r = std::sqrt(xd * xd + yd * yd);
243  return interfaceValue(r);
244  }
245  else if (y > 0.5 - _width / 2.0)
246  {
247  return interfaceValue(.5 - _length / 2. - x);
248  }
249  else if (y > 0.5 - _width / 2. - _buffer - _interface)
250  {
251  Real xd = x - (.5 - _length / 2.0);
252  Real yd = y - .5 + _width / 2.0;
253  Real r = std::sqrt(xd * xd + yd * yd);
254  return interfaceValue(r);
255  }
256  else
257  return cmin;
258  }
259  else
260  return cmin;
261 }
const Real _x2
Definition: CrossIC.h:51
Real _interface
Definition: C1ICBase.h:54
Real _average
Definition: C1ICBase.h:49
Real _length
Definition: C1ICBase.h:51
Real _amplitude
Definition: C1ICBase.h:50
Number interfaceValue(Real r)
Definition: C1ICBase.C:55
const Real _y1
Definition: CrossIC.h:50
const Real _x1
Definition: CrossIC.h:49
const Real _y2
Definition: CrossIC.h:52
Real _width
Definition: C1ICBase.h:52
Real _buffer
Definition: C1ICBase.h:53

Member Data Documentation

Real C1ICBase::_amplitude
protectedinherited

Definition at line 50 of file C1ICBase.h.

Referenced by C1ICBase::interfaceDerivative(), C1ICBase::interfaceValue(), and value().

Real C1ICBase::_average
protectedinherited

Definition at line 49 of file C1ICBase.h.

Referenced by C1ICBase::interfaceValue(), and value().

Real C1ICBase::_buffer
protectedinherited

Definition at line 53 of file C1ICBase.h.

Referenced by C1ICBase::interfaceDerivative(), C1ICBase::interfaceValue(), and value().

Real C1ICBase::_interface
protectedinherited

Definition at line 54 of file C1ICBase.h.

Referenced by C1ICBase::interfaceDerivative(), C1ICBase::interfaceValue(), and value().

Real C1ICBase::_length
protectedinherited

Definition at line 51 of file C1ICBase.h.

Referenced by value().

Real C1ICBase::_width
protectedinherited

Definition at line 52 of file C1ICBase.h.

Referenced by value().

const Real CrossIC::_x1

Definition at line 49 of file CrossIC.h.

Referenced by value().

const Real CrossIC::_x2

Definition at line 51 of file CrossIC.h.

Referenced by value().

const Real CrossIC::_y1

Definition at line 50 of file CrossIC.h.

Referenced by value().

const Real CrossIC::_y2

Definition at line 52 of file CrossIC.h.

Referenced by value().


The documentation for this class was generated from the following files: