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

Periodic boundary for calculation periodic BC on domains where the translation is given by functions. More...

#include <FunctionPeriodicBoundary.h>

Inheritance diagram for FunctionPeriodicBoundary:
[legend]

Public Member Functions

 FunctionPeriodicBoundary (FEProblemBase &subproblem, std::vector< std::string > fn_names)
 Initialize the periodic boundary with three functions. More...
 
 FunctionPeriodicBoundary (const FunctionPeriodicBoundary &o)
 Copy constructor for creating the periodic boundary and inverse periodic boundary. More...
 
virtual Point get_corresponding_pos (const Point &pt) const override
 Get the translation based on point 'pt'. More...
 
virtual std::unique_ptr< PeriodicBoundaryBase > clone (TransformationType t) const override
 Required interface, this class must be able to clone itself. More...
 

Protected Member Functions

void init ()
 An initialization method to make certain that intialSetup() of a function prior to value() More...
 

Protected Attributes

unsigned int _dim
 
Function_tr_x
 Pointer to Function for x-component of the boundary. More...
 
Function_tr_y
 Pointer to Function for y-component of the boundary. More...
 
Function_tr_z
 Pointer to Function for z-component of the boundary. More...
 

Detailed Description

Periodic boundary for calculation periodic BC on domains where the translation is given by functions.

Definition at line 33 of file FunctionPeriodicBoundary.h.

Constructor & Destructor Documentation

FunctionPeriodicBoundary::FunctionPeriodicBoundary ( FEProblemBase subproblem,
std::vector< std::string >  fn_names 
)

Initialize the periodic boundary with three functions.

Definition at line 26 of file FunctionPeriodicBoundary.C.

28  : _dim(fn_names.size()),
29  _tr_x(&feproblem.getFunction(fn_names[0])),
30  _tr_y(_dim > 1 ? &feproblem.getFunction(fn_names[1]) : NULL),
31  _tr_z(_dim > 2 ? &feproblem.getFunction(fn_names[2]) : NULL)
32 {
33 
34  // Make certain the the dimensions agree
35  if (_dim != feproblem.mesh().dimension())
36  mooseError("Transform function has to have the same dimension as the problem being solved.");
37 
38  // Initialize the functions (i.e., call thier initialSetup methods)
39  init();
40 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
Function * _tr_y
Pointer to Function for y-component of the boundary.
Function * _tr_z
Pointer to Function for z-component of the boundary.
Function * _tr_x
Pointer to Function for x-component of the boundary.
void init()
An initialization method to make certain that intialSetup() of a function prior to value() ...
FunctionPeriodicBoundary::FunctionPeriodicBoundary ( const FunctionPeriodicBoundary o)

Copy constructor for creating the periodic boundary and inverse periodic boundary.

Parameters
o- Periodic boundary being copied

Definition at line 42 of file FunctionPeriodicBoundary.C.

43  : PeriodicBoundaryBase(o), _dim(o._dim), _tr_x(o._tr_x), _tr_y(o._tr_y), _tr_z(o._tr_z)
44 {
45  // Initialize the functions (i.e., call thier initialSetup methods)
46  init();
47 }
Function * _tr_y
Pointer to Function for y-component of the boundary.
Function * _tr_z
Pointer to Function for z-component of the boundary.
Function * _tr_x
Pointer to Function for x-component of the boundary.
void init()
An initialization method to make certain that intialSetup() of a function prior to value() ...

Member Function Documentation

std::unique_ptr< PeriodicBoundaryBase > FunctionPeriodicBoundary::clone ( TransformationType  t) const
overridevirtual

Required interface, this class must be able to clone itself.

Definition at line 80 of file FunctionPeriodicBoundary.C.

81 {
82  if (t == INVERSE)
83  mooseError("No way to automatically clone() an inverse FunctionPeriodicBoundary object");
84 
85  return libmesh_make_unique<FunctionPeriodicBoundary>(*this);
86 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
Point FunctionPeriodicBoundary::get_corresponding_pos ( const Point &  pt) const
overridevirtual

Get the translation based on point 'pt'.

Parameters
pt- point on the 'source' boundary
Returns
point on the paired boundary

Definition at line 50 of file FunctionPeriodicBoundary.C.

51 {
52  // Force thread-safe evaluation of what could be ParsedFunctions.
53  Threads::spin_mutex::scoped_lock lock(parsed_function_mutex);
54 
55  Real t = 0.;
56  Point p;
57  switch (_dim)
58  {
59  case 1:
60  return Point(_tr_x->value(t, pt));
61 
62  case 2:
63  mooseAssert(_tr_y, "Must provide a function to map y in 2D.");
64  return Point(_tr_x->value(t, pt), _tr_y->value(t, pt));
65 
66  case 3:
67  mooseAssert(_tr_y, "Must provide a function to map y in 2D.");
68  mooseAssert(_tr_z, "Must provide a function to map z in 3D.");
69  return Point(_tr_x->value(t, pt), _tr_y->value(t, pt), _tr_z->value(t, pt));
70 
71  default:
72  mooseError("Unsupported dimension");
73  break;
74  }
75 
76  return pt;
77 }
virtual Real value(Real t, const Point &p)
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
Definition: Function.C:43
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
Function * _tr_y
Pointer to Function for y-component of the boundary.
Function * _tr_z
Pointer to Function for z-component of the boundary.
Function * _tr_x
Pointer to Function for x-component of the boundary.
Threads::spin_mutex parsed_function_mutex
void FunctionPeriodicBoundary::init ( )
protected

An initialization method to make certain that intialSetup() of a function prior to value()

Definition at line 89 of file FunctionPeriodicBoundary.C.

Referenced by FunctionPeriodicBoundary().

90 {
91  switch (_dim)
92  {
93  case 1:
95  break;
96  case 2:
99  break;
100  case 3:
101  _tr_x->initialSetup();
102  _tr_y->initialSetup();
103  _tr_z->initialSetup();
104  break;
105  default:
106  mooseError("Unsupported dimension");
107  break;
108  }
109 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
Function * _tr_y
Pointer to Function for y-component of the boundary.
Function * _tr_z
Pointer to Function for z-component of the boundary.
Function * _tr_x
Pointer to Function for x-component of the boundary.
virtual void initialSetup()
Gets called at the beginning of the simulation before this object is asked to do its job...

Member Data Documentation

unsigned int FunctionPeriodicBoundary::_dim
protected
Function* FunctionPeriodicBoundary::_tr_x
protected

Pointer to Function for x-component of the boundary.

Definition at line 65 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().

Function* FunctionPeriodicBoundary::_tr_y
protected

Pointer to Function for y-component of the boundary.

Definition at line 68 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().

Function* FunctionPeriodicBoundary::_tr_z
protected

Pointer to Function for z-component of the boundary.

Definition at line 71 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().


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