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 44 of file CrossIC.h.

Constructor & Destructor Documentation

◆ CrossIC()

CrossIC::CrossIC ( const InputParameters &  parameters)

Definition at line 45 of file CrossIC.C.

46  : C1ICBase(parameters),
47  _x1(parameters.get<Real>("x1")),
48  _y1(parameters.get<Real>("y1")),
49  _x2(parameters.get<Real>("x2")),
50  _y2(parameters.get<Real>("y2"))
51 {
52 }
const Real _x2
Definition: CrossIC.h:54
const Real _y1
Definition: CrossIC.h:53
const Real _x1
Definition: CrossIC.h:52
const Real _y2
Definition: CrossIC.h:55
C1ICBase(const InputParameters &parameters)
Definition: C1ICBase.C:46

Member Function Documentation

◆ gradient()

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

Definition at line 269 of file CrossIC.C.

270 {
271  Point pxminus = p, pxplus = p, pyminus = p, pyplus = p;
272 
273  pxminus(0) -= TOLERANCE;
274  pyminus(1) -= TOLERANCE;
275  pxplus(0) += TOLERANCE;
276  pyplus(1) += TOLERANCE;
277 
278  Number uxminus = value(pxminus), uxplus = value(pxplus), uyminus = value(pyminus),
279  uyplus = value(pyplus);
280 
281  return Gradient((uxplus - uxminus) / 2.0 / TOLERANCE, (uyplus - uyminus) / 2.0 / TOLERANCE);
282 }
virtual Real value(const Point &p)
Definition: CrossIC.C:55

◆ interfaceDerivative()

Number C1ICBase::interfaceDerivative ( Real  r)
protectedinherited

Definition at line 71 of file C1ICBase.C.

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 }
Real _interface
Definition: C1ICBase.h:57
Real _amplitude
Definition: C1ICBase.h:53
Real _buffer
Definition: C1ICBase.h:56

◆ interfaceValue()

Number C1ICBase::interfaceValue ( Real  r)
protectedinherited

Definition at line 58 of file C1ICBase.C.

Referenced by value().

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 }
Real _interface
Definition: C1ICBase.h:57
Real _average
Definition: C1ICBase.h:52
Real _amplitude
Definition: C1ICBase.h:53
Real _buffer
Definition: C1ICBase.h:56

◆ value()

Real CrossIC::value ( const Point &  p)
virtual

Definition at line 55 of file CrossIC.C.

Referenced by gradient().

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

Member Data Documentation

◆ _amplitude

Real C1ICBase::_amplitude
protectedinherited

Definition at line 53 of file C1ICBase.h.

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

◆ _average

Real C1ICBase::_average
protectedinherited

Definition at line 52 of file C1ICBase.h.

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

◆ _buffer

Real C1ICBase::_buffer
protectedinherited

Definition at line 56 of file C1ICBase.h.

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

◆ _interface

Real C1ICBase::_interface
protectedinherited

Definition at line 57 of file C1ICBase.h.

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

◆ _length

Real C1ICBase::_length
protectedinherited

Definition at line 54 of file C1ICBase.h.

Referenced by value().

◆ _width

Real C1ICBase::_width
protectedinherited

Definition at line 55 of file C1ICBase.h.

Referenced by value().

◆ _x1

const Real CrossIC::_x1

Definition at line 52 of file CrossIC.h.

Referenced by value().

◆ _x2

const Real CrossIC::_x2

Definition at line 54 of file CrossIC.h.

Referenced by value().

◆ _y1

const Real CrossIC::_y1

Definition at line 53 of file CrossIC.h.

Referenced by value().

◆ _y2

const Real CrossIC::_y2

Definition at line 55 of file CrossIC.h.

Referenced by value().


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