https://mooseframework.inl.gov
Public Types | Public Member Functions | Public Attributes | 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 Types

enum  TransformationType
 

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 libMesh::Point get_corresponding_pos (const libMesh::Point &pt) const override
 Get the translation based on point 'pt'. More...
 
virtual std::unique_ptr< libMesh::PeriodicBoundaryBaseclone (TransformationType t) const override
 Required interface, this class must be able to clone itself. More...
 
void set_variable (unsigned int var)
 
void merge (const PeriodicBoundaryBase &pb)
 
bool is_my_variable (unsigned int var_num) const
 
bool has_transformation_matrix () const
 
const DenseMatrix< Real > & get_transformation_matrix () const
 
void set_transformation_matrix (const DenseMatrix< Real > &matrix)
 
const std::set< unsigned int > & get_variables () const
 

Public Attributes

 FORWARD
 
 INVERSE
 
boundary_id_type myboundary
 
boundary_id_type pairedboundary
 

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
 
const Function *const _tr_x
 Pointer to Function for x-component of the boundary. More...
 
const Function *const _tr_y
 Pointer to Function for y-component of the boundary. More...
 
const Function *const _tr_z
 Pointer to Function for z-component of the boundary. More...
 
std::set< unsigned intvariables
 
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
 

Detailed Description

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

Definition at line 27 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 }
const Function *const _tr_y
Pointer to Function for y-component of the boundary.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const Function *const _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() ...
const Function *const _tr_z
Pointer to Function for z-component of the boundary.

◆ 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.

39 {
40  // Initialize the functions (i.e., call thier initialSetup methods)
41  init();
42 }
const Function *const _tr_y
Pointer to Function for y-component of the boundary.
const Function *const _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() ...
const Function *const _tr_z
Pointer to Function for z-component of the boundary.

Member Function Documentation

◆ clone()

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

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

Implements libMesh::PeriodicBoundaryBase.

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 std::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:302

◆ get_corresponding_pos()

Point FunctionPeriodicBoundary::get_corresponding_pos ( const libMesh::Point pt) const
overridevirtual

Get the translation based on point 'pt'.

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

Implements libMesh::PeriodicBoundaryBase.

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 }
const Function *const _tr_y
Pointer to Function for y-component of the boundary.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const Function *const _tr_x
Pointer to Function for x-component of the boundary.
Threads::spin_mutex parsed_function_mutex
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Function *const _tr_z
Pointer to Function for z-component of the boundary.
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
Definition: Function.C:44

◆ 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:
89  const_cast<Function *>(_tr_x)->initialSetup();
90  break;
91  case 2:
92  const_cast<Function *>(_tr_x)->initialSetup();
93  const_cast<Function *>(_tr_y)->initialSetup();
94  break;
95  case 3:
96  const_cast<Function *>(_tr_x)->initialSetup();
97  const_cast<Function *>(_tr_y)->initialSetup();
98  const_cast<Function *>(_tr_z)->initialSetup();
99  break;
100  default:
101  mooseError("Unsupported dimension");
102  break;
103  }
104 }
const Function *const _tr_y
Pointer to Function for y-component of the boundary.
Base class for function objects.
Definition: Function.h:36
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const Function *const _tr_x
Pointer to Function for x-component of the boundary.
const Function *const _tr_z
Pointer to Function for z-component of the boundary.

Member Data Documentation

◆ _dim

unsigned int FunctionPeriodicBoundary::_dim
protected

◆ _tr_x

const Function* const FunctionPeriodicBoundary::_tr_x
protected

Pointer to Function for x-component of the boundary.

Definition at line 59 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().

◆ _tr_y

const Function* const FunctionPeriodicBoundary::_tr_y
protected

Pointer to Function for y-component of the boundary.

Definition at line 62 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().

◆ _tr_z

const Function* const FunctionPeriodicBoundary::_tr_z
protected

Pointer to Function for z-component of the boundary.

Definition at line 65 of file FunctionPeriodicBoundary.h.

Referenced by get_corresponding_pos(), and init().


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