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 initialSetup() 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 28 of file FunctionPeriodicBoundary.h.

Constructor & Destructor Documentation

◆ FunctionPeriodicBoundary() [1/2]

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

Initialize the periodic boundary with three functions.

Definition at line 21 of file FunctionPeriodicBoundary.C.

23  : _dim(fn_names.size()),
24  _tr_x(&feproblem.getFunction(fn_names[0])),
25  _tr_y(_dim > 1 ? &feproblem.getFunction(fn_names[1]) : NULL),
26  _tr_z(_dim > 2 ? &feproblem.getFunction(fn_names[2]) : NULL)
27 {
28 
29  // Make certain the the dimensions agree
30  if (_dim != feproblem.mesh().dimension())
31  mooseError("Transform function has to have the same dimension as the problem being solved.");
32 
33  // Initialize the functions (i.e., call thier initialSetup methods)
34  init();
35 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
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 initialSetup() of a function prior to value() ...

◆ FunctionPeriodicBoundary() [2/2]

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 37 of file FunctionPeriodicBoundary.C.

38  : PeriodicBoundaryBase(o), _dim(o._dim), _tr_x(o._tr_x), _tr_y(o._tr_y), _tr_z(o._tr_z)
39 {
40  // Initialize the functions (i.e., call thier initialSetup methods)
41  init();
42 }
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 initialSetup() of a function prior to value() ...

Member Function Documentation

◆ clone()

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

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

Definition at line 75 of file FunctionPeriodicBoundary.C.

76 {
77  if (t == INVERSE)
78  mooseError("No way to automatically clone() an inverse FunctionPeriodicBoundary object");
79 
80  return libmesh_make_unique<FunctionPeriodicBoundary>(*this);
81 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208

◆ get_corresponding_pos()

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 45 of file FunctionPeriodicBoundary.C.

46 {
47  // Force thread-safe evaluation of what could be ParsedFunctions.
48  Threads::spin_mutex::scoped_lock lock(parsed_function_mutex);
49 
50  Real t = 0.;
51  Point p;
52  switch (_dim)
53  {
54  case 1:
55  return Point(_tr_x->value(t, pt));
56 
57  case 2:
58  mooseAssert(_tr_y, "Must provide a function to map y in 2D.");
59  return Point(_tr_x->value(t, pt), _tr_y->value(t, pt));
60 
61  case 3:
62  mooseAssert(_tr_y, "Must provide a function to map y in 2D.");
63  mooseAssert(_tr_z, "Must provide a function to map z in 3D.");
64  return Point(_tr_x->value(t, pt), _tr_y->value(t, pt), _tr_z->value(t, pt));
65 
66  default:
67  mooseError("Unsupported dimension");
68  break;
69  }
70 
71  return pt;
72 }
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:38
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
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

◆ init()

void FunctionPeriodicBoundary::init ( )
protected

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

Definition at line 84 of file FunctionPeriodicBoundary.C.

Referenced by FunctionPeriodicBoundary().

85 {
86  switch (_dim)
87  {
88  case 1:
90  break;
91  case 2:
94  break;
95  case 3:
99  break;
100  default:
101  mooseError("Unsupported dimension");
102  break;
103  }
104 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
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

◆ _dim

unsigned int FunctionPeriodicBoundary::_dim
protected

◆ _tr_x

Function* FunctionPeriodicBoundary::_tr_x
protected

Pointer to Function for x-component of the boundary.

Definition at line 60 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().

◆ _tr_y

Function* FunctionPeriodicBoundary::_tr_y
protected

Pointer to Function for y-component of the boundary.

Definition at line 63 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().

◆ _tr_z

Function* FunctionPeriodicBoundary::_tr_z
protected

Pointer to Function for z-component of the boundary.

Definition at line 66 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().


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