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

MultiBoundingBoxIC allows setting the initial condition of a value of a field inside and outside multiple bounding boxes. More...

#include <MultiBoundingBoxIC.h>

Inheritance diagram for MultiBoundingBoxIC:
[legend]

Public Member Functions

 MultiBoundingBoxIC (const InputParameters &parameters)
 
virtual Real value (const Point &p) override
 

Protected Attributes

const unsigned int _nbox
 number of boxes More...
 
const unsigned int _dim
 dimensionality of the mesh More...
 
const std::vector< Real > _inside
 values inside the boxes More...
 
const Real _outside
 values outside the boxes More...
 
const std::vector< Point > _c1
 lists of opposite corners More...
 
const std::vector< Point > _c2
 

Detailed Description

MultiBoundingBoxIC allows setting the initial condition of a value of a field inside and outside multiple bounding boxes.

Each box is axis-aligned and is specified by passing in the x,y,z coordinates of opposite corners. Separate values for each box may be supplied.

Definition at line 26 of file MultiBoundingBoxIC.h.

Constructor & Destructor Documentation

◆ MultiBoundingBoxIC()

MultiBoundingBoxIC::MultiBoundingBoxIC ( const InputParameters &  parameters)

Definition at line 49 of file MultiBoundingBoxIC.C.

50  : InitialCondition(parameters),
51  _c1(getParam<std::vector<Point>>("corners")),
52  _c2(getParam<std::vector<Point>>("opposite_corners")),
53  _nbox(_c1.size()),
54  _dim(_fe_problem.mesh().dimension()),
55  _inside(sizeVector(getParam<std::vector<Real>>("inside"), _nbox)),
56  _outside(getParam<Real>("outside"))
57 {
58  // make sure inputs are the same length
59  if (_c2.size() != _nbox || _inside.size() != _nbox)
60  mooseError("vector inputs must all be the same size");
61 }
const unsigned int _dim
dimensionality of the mesh
const std::vector< Real > _inside
values inside the boxes
const std::vector< Point > _c2
const unsigned int _nbox
number of boxes
const Real _outside
values outside the boxes
const std::vector< Point > _c1
lists of opposite corners

Member Function Documentation

◆ value()

Real MultiBoundingBoxIC::value ( const Point &  p)
overridevirtual

Definition at line 64 of file MultiBoundingBoxIC.C.

65 {
66  Real value = _outside;
67 
68  for (unsigned int b = 0; b < _nbox; ++b)
69  {
70  if ((_c1[b](0) < _c2[b](0) && p(0) >= _c1[b](0) && p(0) <= _c2[b](0)) ||
71  (_c1[b](0) >= _c2[b](0) && p(0) <= _c1[b](0) && p(0) >= _c2[b](0)))
72  if (_dim <= 1 || (_c1[b](1) < _c2[b](1) && p(1) >= _c1[b](1) && p(1) <= _c2[b](1)) ||
73  (_c1[b](1) >= _c2[b](1) && p(1) <= _c1[b](1) && p(1) >= _c2[b](1)))
74  if (_dim <= 2 || (_c1[b](2) < _c2[b](2) && p(2) >= _c1[b](2) && p(2) <= _c2[b](2)) ||
75  (_c1[b](2) >= _c2[b](2) && p(2) <= _c1[b](2) && p(2) >= _c2[b](2)))
76  {
77  value = _inside[b];
78  break;
79  }
80  }
81 
82  return value;
83 }
const unsigned int _dim
dimensionality of the mesh
const std::vector< Real > _inside
values inside the boxes
const std::vector< Point > _c2
const unsigned int _nbox
number of boxes
virtual Real value(const Point &p) override
const Real _outside
values outside the boxes
const std::vector< Point > _c1
lists of opposite corners

Member Data Documentation

◆ _c1

const std::vector<Point> MultiBoundingBoxIC::_c1
protected

lists of opposite corners

Definition at line 35 of file MultiBoundingBoxIC.h.

Referenced by value().

◆ _c2

const std::vector<Point> MultiBoundingBoxIC::_c2
protected

Definition at line 36 of file MultiBoundingBoxIC.h.

Referenced by MultiBoundingBoxIC(), and value().

◆ _dim

const unsigned int MultiBoundingBoxIC::_dim
protected

dimensionality of the mesh

Definition at line 43 of file MultiBoundingBoxIC.h.

Referenced by value().

◆ _inside

const std::vector<Real> MultiBoundingBoxIC::_inside
protected

values inside the boxes

Definition at line 46 of file MultiBoundingBoxIC.h.

Referenced by MultiBoundingBoxIC(), and value().

◆ _nbox

const unsigned int MultiBoundingBoxIC::_nbox
protected

number of boxes

Definition at line 40 of file MultiBoundingBoxIC.h.

Referenced by MultiBoundingBoxIC(), and value().

◆ _outside

const Real MultiBoundingBoxIC::_outside
protected

values outside the boxes

Definition at line 49 of file MultiBoundingBoxIC.h.

Referenced by value().


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