libMesh::DirichletBoundary Class Reference

Class for specifying Dirichlet boundary conditions as constraints. More...

#include <dirichlet_boundaries.h>

Public Member Functions

 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const FunctionBase< Number > *f_in, const FunctionBase< Gradient > *g_in=nullptr)
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const FunctionBase< Number > &f_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const FunctionBase< Number > &f_in, const FunctionBase< Gradient > &g_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const System &f_sys_in, const FEMFunctionBase< Number > *f_in, const FEMFunctionBase< Gradient > *g_in=nullptr)
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const System &f_sys_in, const FEMFunctionBase< Number > &f_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const System &f_sys_in, const FEMFunctionBase< Number > &f_in, const FEMFunctionBase< Gradient > &g_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 
 DirichletBoundary (const DirichletBoundary &dirichlet_in)
 
 ~DirichletBoundary ()
 

Public Attributes

std::set< boundary_id_typeb
 
std::vector< unsigned int > variables
 
std::unique_ptr< FunctionBase< Number > > f
 
std::unique_ptr< FunctionBase< Gradient > > g
 
std::unique_ptr< FEMFunctionBase< Number > > f_fem
 
std::unique_ptr< FEMFunctionBase< Gradient > > g_fem
 
const Systemf_system
 

Detailed Description

Class for specifying Dirichlet boundary conditions as constraints.

This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids and system variable ids.

Dirichlet values must be supplied as the input function "f"; when using some specialized elements, gradient values must be supplied via the input function "g".

Dirichlet functions may be subclasses of FunctionBase or FEMFunctionBase; in the latter case the user must also supply a reference to the System on which the FEMFunctionBase will be evaluated.

Dirichlet functions are allowed to return NaN; if this is encountered, then the degree of freedom values in a patch around the location of the returned NaN will be left unconstrained. E.g. a NaN on a boundary edge in 3D would leave that edge and the two adjoining face interiors unconstrained, but would still permit the other edge and node DoFs around those faces to be constrained.

Author
Roy Stogner
Date
2012

Definition at line 89 of file dirichlet_boundaries.h.

Constructor & Destructor Documentation

◆ DirichletBoundary() [1/7]

libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const FunctionBase< Number > *  f_in,
const FunctionBase< Gradient > *  g_in = nullptr 
)

Constructor for a system-variable-order boundary using pointers-to-functors.

Definition at line 34 of file dirichlet_boundary.C.

References f, and g.

37  :
38  b(b_in),
39  variables(variables_in),
40  f(f_in ? f_in->clone() : nullptr),
41  g(g_in ? g_in->clone() : nullptr),
42  f_system(nullptr)
43 {
44  libmesh_assert(f);
45  f->init();
46  if (g)
47  g->init();
48 }
std::unique_ptr< FunctionBase< Number > > f
std::vector< unsigned int > variables
std::unique_ptr< FunctionBase< Gradient > > g
virtual std::unique_ptr< FunctionBase< Output > > clone() const =0
std::set< boundary_id_type > b

◆ DirichletBoundary() [2/7]

libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const FunctionBase< Number > &  f_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a boundary from reference-to-functor.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 52 of file dirichlet_boundary.C.

References libMesh::FunctionBase< Output >::clone(), f, and libMesh::LOCAL_VARIABLE_ORDER.

55  :
56  b(b_in),
57  variables(variables_in),
58  f_system(nullptr)
59 {
60  if (type == LOCAL_VARIABLE_ORDER)
61  {
62  auto c = libmesh_make_unique<CompositeFunction<Number>>();
63  c->attach_subfunction(f_in, variables_in);
64  f = std::move(c);
65  }
66  else
67  f = f_in.clone();
68 
69  f->init();
70 }
std::unique_ptr< FunctionBase< Number > > f
std::vector< unsigned int > variables
virtual std::unique_ptr< FunctionBase< Output > > clone() const =0
std::set< boundary_id_type > b

◆ DirichletBoundary() [3/7]

libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const FunctionBase< Number > &  f_in,
const FunctionBase< Gradient > &  g_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a system-variable-order boundary from references-to-functors.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 74 of file dirichlet_boundary.C.

References libMesh::FunctionBase< Output >::clone(), f, g, and libMesh::LOCAL_VARIABLE_ORDER.

78  :
79  b(b_in),
80  variables(variables_in),
81  f_system(nullptr)
82 {
83  if (type == LOCAL_VARIABLE_ORDER)
84  {
85  auto cf = libmesh_make_unique<CompositeFunction<Number>>();
86  cf->attach_subfunction(f_in, variables_in);
87  f = std::move(cf);
88 
89  auto cg = libmesh_make_unique<CompositeFunction<Gradient>>();
90  cg->attach_subfunction(g_in, variables_in);
91  g = std::move(cg);
92  }
93  else
94  {
95  f = f_in.clone();
96  g = g_in.clone();
97  }
98 
99  f->init();
100  g->init();
101 }
std::unique_ptr< FunctionBase< Number > > f
std::vector< unsigned int > variables
std::unique_ptr< FunctionBase< Gradient > > g
virtual std::unique_ptr< FunctionBase< Output > > clone() const =0
std::set< boundary_id_type > b

◆ DirichletBoundary() [4/7]

libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const System f_sys_in,
const FEMFunctionBase< Number > *  f_in,
const FEMFunctionBase< Gradient > *  g_in = nullptr 
)

Constructor for a system-variable-order boundary from pointers-to-fem-functors.

Definition at line 105 of file dirichlet_boundary.C.

References f_fem.

109  :
110  b(b_in),
111  variables(variables_in),
112  f_fem(f_in ? f_in->clone() : nullptr),
113  g_fem(g_in ? g_in->clone() : nullptr),
114  f_system(&f_sys_in)
115 {
116  libmesh_assert(f_fem);
117 }
std::unique_ptr< FEMFunctionBase< Gradient > > g_fem
std::vector< unsigned int > variables
std::unique_ptr< FEMFunctionBase< Number > > f_fem
std::set< boundary_id_type > b

◆ DirichletBoundary() [5/7]

libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const System f_sys_in,
const FEMFunctionBase< Number > &  f_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a system-variable-order boundary from reference-to-fem-functor.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 121 of file dirichlet_boundary.C.

References libMesh::FEMFunctionBase< Output >::clone(), f_fem, and libMesh::LOCAL_VARIABLE_ORDER.

125  :
126  b(b_in),
127  variables(variables_in),
128  f_system(&f_sys_in)
129 {
130  if (type == LOCAL_VARIABLE_ORDER)
131  {
132  auto c = libmesh_make_unique<CompositeFEMFunction<Number>>();
133  c->attach_subfunction(f_in, variables_in);
134  f_fem = std::move(c);
135  }
136  else
137  f_fem = f_in.clone();
138 }
std::vector< unsigned int > variables
std::unique_ptr< FEMFunctionBase< Number > > f_fem
std::set< boundary_id_type > b

◆ DirichletBoundary() [6/7]

libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const System f_sys_in,
const FEMFunctionBase< Number > &  f_in,
const FEMFunctionBase< Gradient > &  g_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a system-variable-order boundary from references-to-fem-functors.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 142 of file dirichlet_boundary.C.

References libMesh::FEMFunctionBase< Output >::clone(), f_fem, g_fem, and libMesh::LOCAL_VARIABLE_ORDER.

147  :
148  b(b_in),
149  variables(variables_in),
150  f_system(&f_sys_in)
151 {
152  if (type == LOCAL_VARIABLE_ORDER)
153  {
154  auto cf = libmesh_make_unique<CompositeFEMFunction<Number>>();
155  cf->attach_subfunction(f_in, variables_in);
156  f_fem = std::move(cf);
157 
158  auto cg = libmesh_make_unique<CompositeFEMFunction<Gradient>>();
159  cg->attach_subfunction(g_in, variables_in);
160  g_fem = std::move(cg);
161  }
162  else
163  {
164  f_fem = f_in.clone();
165  g_fem = g_in.clone();
166  }
167 }
std::unique_ptr< FEMFunctionBase< Gradient > > g_fem
std::vector< unsigned int > variables
std::unique_ptr< FEMFunctionBase< Number > > f_fem
std::set< boundary_id_type > b

◆ DirichletBoundary() [7/7]

libMesh::DirichletBoundary::DirichletBoundary ( const DirichletBoundary dirichlet_in)

Copy constructor. Deep copies (clones) functors; shallow copies any System reference

Definition at line 171 of file dirichlet_boundary.C.

References f, f_fem, f_system, g, and g_fem.

171  :
172  b(d_in.b),
173  variables(d_in.variables),
174  f(d_in.f ? d_in.f->clone() : nullptr),
175  g(d_in.g ? d_in.g->clone() : nullptr),
176  f_fem(d_in.f_fem ? d_in.f_fem->clone() : nullptr),
177  g_fem(d_in.g_fem ? d_in.g_fem->clone() : nullptr),
178  f_system(d_in.f_system)
179 {
180  libmesh_assert(f || f_fem);
181  libmesh_assert(!(f && f_fem));
182  libmesh_assert(!(f && g_fem));
183  libmesh_assert(!(f_fem && g));
184  libmesh_assert(!(f_fem && !f_system));
185  if (f)
186  f->init();
187  if (g)
188  g->init();
189 }
std::unique_ptr< FEMFunctionBase< Gradient > > g_fem
std::unique_ptr< FunctionBase< Number > > f
std::vector< unsigned int > variables
std::unique_ptr< FEMFunctionBase< Number > > f_fem
std::unique_ptr< FunctionBase< Gradient > > g
std::set< boundary_id_type > b

◆ ~DirichletBoundary()

libMesh::DirichletBoundary::~DirichletBoundary ( )

Standard destructor

Definition at line 192 of file dirichlet_boundary.C.

192 {}

Member Data Documentation

◆ b

◆ f

std::unique_ptr<FunctionBase<Number> > libMesh::DirichletBoundary::f

Definition at line 177 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

◆ f_fem

std::unique_ptr<FEMFunctionBase<Number> > libMesh::DirichletBoundary::f_fem

Definition at line 180 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

◆ f_system

const System* libMesh::DirichletBoundary::f_system

Definition at line 183 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

◆ g

std::unique_ptr<FunctionBase<Gradient> > libMesh::DirichletBoundary::g

Definition at line 178 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

◆ g_fem

std::unique_ptr<FEMFunctionBase<Gradient> > libMesh::DirichletBoundary::g_fem

Definition at line 181 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

◆ variables

std::vector<unsigned int> libMesh::DirichletBoundary::variables

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